SteamWar/BauSystem2.0
Archiviert
12
0

Commits vergleichen

..

433 Commits

Autor SHA1 Nachricht Datum
yoyosource
47d5f29ae6 Fix SmartPlaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-08-03 22:28:04 +02:00
yoyosource
552a1ea7fc Add SmartPlaceListener for Block under Repeater
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-07-18 20:00:33 +02:00
yoyosource
d77e8e829e Fix BauSystem.properties
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-07-17 14:39:42 +02:00
yoyosource
bd06bce3dc Fix NoGravityListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-07-17 14:25:01 +02:00
yoyosource
76ecc8e6e4 Add NoGravityCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-07-17 14:22:43 +02:00
yoyosource
820e7fcbb2 Add NoGravityCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-07-17 14:19:19 +02:00
yoyosource
94958de2da Merge remote-tracking branch 'origin/master'
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-07-17 14:04:03 +02:00
yoyosource
2214b7dc3d Fix ClipboardListener 2024-07-17 14:03:55 +02:00
75e6b28e0e Trigger Rebuild
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-07-17 07:45:51 +02:00
a1dd919afa Merge pull request 'Added debug message for trace history map nullpointer and potential fix' (#257) from fix-trace-history-nullpointer into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #257
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-07-16 22:38:04 +02:00
D4rkr34lm
2b0b2a08d7 Added todo for debug removal
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-07-16 22:31:09 +02:00
D4rkr34lm
7fc76e5e2a fixed wrong map in debug message
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-07-16 22:19:11 +02:00
D4rkr34lm
5153609776 Added debug message for trace history map nullpointer and potential fix
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-07-16 21:56:08 +02:00
593113bbc3 Merge pull request 'fix(tracer): Fixed first point of advanced flag incorrect calc order' (#254) from fix-tracer-advanced-flag-first-tick-calc into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #254
2024-07-06 18:48:59 +02:00
D4rkr34lm
a62c08b097 fix(tracer): Fixed first point of advanced flag incorrect calc order
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-07-06 12:54:09 +02:00
442ba6f483 Merge pull request 'fix(tracer): Fixed wrong velocity taken in advanced flag' (#253) from fix-direction-decision-in-advanced-flag into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #253
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-07-04 17:17:15 +02:00
D4rkr34lm
e253e12994 use fixed ci
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-07-04 17:15:19 +02:00
D4rkr34lm
38bb687c5b fix(tracer): Fixed wrong velocity taken in advanced flag
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-07-04 15:33:40 +02:00
yoyosource
30ddf671ae Fix messages for clear command
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-05-18 11:08:41 +02:00
yoyosource
2829706d6b Fix DesignEndStone
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Fix DevServer kicking every member not added
Fix WarpListener for 1.20+
2024-05-16 16:36:59 +02:00
yoyosource
ab6c762323 Fix DesignEndStone
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-05-16 15:47:30 +02:00
yoyosource
d5acfa3f5c Fix DesignEndStone
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-05-16 15:42:34 +02:00
yoyosource
3370e211f9 Merge remote-tracking branch 'origin/master'
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-05-16 15:31:00 +02:00
yoyosource
29c7732166 Potential fix for weird starting behaviour 2024-05-16 15:30:53 +02:00
ec3a8a1421 Merge pull request 'Improved Advanced-Flag to backtrack instead of going forward' (#252) from tracer/advanced-flag-improvemnt into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #252
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-05-12 09:14:35 +02:00
D4rkr34lm
f054710a95 Improved Advanced-Flag to backtrack instead of going forward
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-05-10 18:34:50 +02:00
67f6363852 Merge pull request 'Fixed build-destory-only not working' (#251) from tracer/fixed-only-destroy-flags into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #251
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-05-09 17:49:24 +02:00
7182635558 Merge pull request 'Added advanced logging for trace read EOF' (#250) from tracer/debug-corrupted-records-save-files into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #250
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-05-09 17:49:08 +02:00
D4rkr34lm
7d01ebf4ed Fixed build-destory-only not working
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-05-09 12:18:27 +02:00
D4rkr34lm
595c45bb54 Added advanced logging for trace read EOF
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-05-09 11:44:50 +02:00
45a61e554f Merge pull request 'Fixed clear nullpointer' (#249) from tracer/fix-clear-nullpointer into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #249
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-05-04 15:53:21 +02:00
D4rkr34lm
a43e141340 Fixed clear nullpointer
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-05-04 13:56:10 +02:00
4a334d8693 Merge pull request 'Made Trace Records loading syncronized' (#247) from tracer/made-records-loading-syncronized into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #247
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-05-02 21:06:29 +02:00
D4rkr34lm
6a6833a0e0 Made Trace Records loading syncronized
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-05-02 20:49:28 +02:00
daedbb26a7 Merge pull request 'Fixed laufbau first tnt bug' (#246) from fix-laufbau into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #246
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-05-01 13:44:46 +02:00
D4rkr34lm
d5ab11addd Fixed laufbau first tnt bug
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-05-01 13:42:44 +02:00
Chaoscaot
aa22ccf5b4 Merge pull request 'tracer/simulator-autotrace-fix' (#245) from tracer/simulator-autotrace-fix into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #245
Reviewed-by: Chaoscaot <chaoscaot@zohomail.eu>
2024-04-29 21:43:19 +02:00
D4rkr34lm
723b86b955 Removed debugstatement
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-29 20:18:44 +02:00
D4rkr34lm
a116f7e4b1 Fixed fuse 80 subtick calc order problem with failsafe
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-29 20:16:27 +02:00
680f9d8b3f Merge pull request 'hotfix flag autocomplete' (#244) from tracer/hotfix-flag-autocomplete into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #244
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-04-28 15:12:11 +02:00
D4rkr34lm
00dcb10451 hotfix flag autocomplete
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-28 15:05:50 +02:00
c815cd52fb Merge pull request 'Hotfixed failsafe' (#243) from tracer/hotfix-failsafe into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #243
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-04-28 12:31:06 +02:00
D4rkr34lm
ddb701cbd6 Hotfixed failsafe
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-28 12:30:07 +02:00
929400b4d9 Merge pull request 'tracer/bug-354-Fix-smaller-trace-issues' (#242) from tracer/bug-354-Fix-smaller-trace-issues into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #242
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-04-28 12:15:17 +02:00
D4rkr34lm
e9ff8a7dc5 Merge master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-28 12:14:08 +02:00
D4rkr34lm
a36bae3a8d ...
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-28 12:11:22 +02:00
D4rkr34lm
7502270b96 Fixed killall interaction
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-04-28 12:10:33 +02:00
D4rkr34lm
0c91261d55 Inlined failsave 2024-04-28 12:09:14 +02:00
D4rkr34lm
add259788d Fixed stop message
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-28 12:02:03 +02:00
D4rkr34lm
4568ceee36 Changed auto trace toggle to setable
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-28 11:59:42 +02:00
106a13bd13 Merge pull request 'Fix' (#240) from tracer/fix-historyMap-nullpointer into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #240
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-04-28 11:49:38 +02:00
D4rkr34lm
2aec97304d Made -- to -
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-28 11:18:41 +02:00
D4rkr34lm
7fa31704f4 Added non toggle methods for auto tracer to recorder
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-28 11:17:09 +02:00
D4rkr34lm
95132a17d3 Fixed tnt point tss wrong
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-28 11:01:37 +02:00
D4rkr34lm
e08e53a554 Fix
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-25 20:32:05 +02:00
5ab6b8832b Merge pull request 'trace/trace-del-and-trace-share-fix' (#239) from trace/trace-del-and-trace-share-fix into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #239
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-04-22 22:57:11 +02:00
D4rkr34lm
2861a4e19b fixed help messag
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-22 22:56:14 +02:00
D4rkr34lm
18430e13fe Renamed trace share to trace broadcast
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-22 22:51:28 +02:00
D4rkr34lm
e8eeeb729a Changed behavior of trace deletion while being recorded
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-22 22:49:13 +02:00
792b089e4f Merge pull request 'Fix trace Rserver null error ?' (#237) from trace/server-nullpointer-fix into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #237
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-04-22 21:17:47 +02:00
D4rkr34lm
b602fb06d0 Used Compute if absent
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-22 20:27:34 +02:00
18769a6931 Merge pull request 'Trace now closes on being deleted' (#238) from trace/trace-clear-not-stopping-trace-fix into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #238
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-04-22 20:20:09 +02:00
D4rkr34lm
f1b3b27c14 Trace now closes on being deleted
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-22 20:15:05 +02:00
D4rkr34lm
fd17b8315f Fix trace Rserver null error ?
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-22 19:58:34 +02:00
2ed6008aea Merge pull request 'Final fix' (#236) from trace/exeption-fix-3 into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #236
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-04-22 19:00:44 +02:00
D4rkr34lm
a5b90be2db Final fix
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-22 18:37:04 +02:00
yoyosource
c278b1cfe1 Merge remote-tracking branch 'origin/master'
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-22 17:36:08 +02:00
yoyosource
486d04dd66 Hotfix BauSystem.properties for InfoCommand 2024-04-22 17:36:02 +02:00
f1d929e33b Merge pull request 'Fix trace is added two times to manager' (#235) from trace-2times-in-manager-bug into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #235
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-04-22 17:28:22 +02:00
6f6b61b310 Merge pull request 'Added alias for trace clear' (#234) from trace-clear-alias into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #234
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-04-22 17:28:09 +02:00
yoyosource
f50d887da5 Hotfix TraceEntity 2.0?
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-22 15:21:47 +02:00
D4rkr34lm
5d2886c0a5 Fix trace is added two times to manager
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-21 22:13:27 +02:00
D4rkr34lm
9d96d5a2a8 Added alias for trace clear
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-21 21:57:00 +02:00
yoyosource
07cd605d2c Hotfix TraceEntity
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-21 19:42:13 +02:00
aeb5ebfc12 Merge pull request 'Trace Refactor' (#233) from TracerGUI into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #233
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-04-21 16:03:24 +02:00
yoyosource
7e96d1c846 Fix TraceRecordingWrapper.startTick
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-21 16:00:34 +02:00
yoyosource
5595f3177c Remove redundancy in data storage
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-21 15:55:26 +02:00
yoyosource
e931d7157e Rewrite ViewFlag.filter with Stream API to reduce copies of lists
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-21 15:47:18 +02:00
yoyosource
b64e06479f Disable IsolateFlag if no isolation is active
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-21 15:36:12 +02:00
yoyosource
86cf7e8ca5 Fix messages
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-21 15:31:45 +02:00
yoyosource
69b629d72e Fix messages 2024-04-21 15:30:12 +02:00
D4rkr34lm
143ba020ed Add message
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-21 15:27:14 +02:00
D4rkr34lm
d0a08bc331 Fix isolate click message
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-21 15:21:12 +02:00
D4rkr34lm
d81fb4e020 Merge remote-tracking branch 'origin/TracerGUI' into TracerGUI
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
# Conflicts:
#	BauSystem_Main/src/BauSystem.properties
#	BauSystem_Main/src/BauSystem_de.properties
2024-04-21 15:02:53 +02:00
D4rkr34lm
7ddfcb83ec Added isolate on trace entity 2024-04-21 14:57:44 +02:00
yoyosource
09aa662171 Add messages to TraceCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-21 14:46:47 +02:00
yoyosource
56a72b1e83 Add TraceCommand.share
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-21 14:36:15 +02:00
yoyosource
295eb82fe9 Add TraceCommand.share
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-21 14:29:26 +02:00
yoyosource
f7727eb01c Add TraceScoreboardElement
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-21 13:23:15 +02:00
yoyosource
4e56760eea Merge remote-tracking branch 'origin/TracerGUI' into TracerGUI
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-21 13:17:36 +02:00
yoyosource
f69cbd2724 Add TraceScoreboardElement 2024-04-21 13:17:28 +02:00
D4rkr34lm
0d09db2284 Docs at 90 Percent
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: D4rkr34lm <darth.m.frohn@gmail.com>
2024-04-20 00:51:51 +02:00
yoyosource
47772ad23d Update ViewFlag.TIME
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-18 18:08:11 +02:00
yoyosource
83e5324986 Update ViewFlag.FUSE
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-18 18:06:05 +02:00
D4rkr34lm
8512a7bec5 Merge remote-tracking branch 'origin/TracerGUI' into TracerGUI
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-04-18 17:56:50 +02:00
D4rkr34lm
35988bfcd3 Made name consistent with old naming
Signed-off-by: D4rkr34lm <darth.m.frohn@gmail.com>
2024-04-18 17:56:45 +02:00
yoyosource
67a34ee5ca Fix bundle counting entity twice
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-18 17:54:20 +02:00
yoyosource
5af9cfcaad Fix Trace.bundleRecords
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-18 17:42:40 +02:00
yoyosource
8b07e93a70 Fix Trace.bundleRecords
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-18 17:25:47 +02:00
D4rkr34lm
4d9aacfc3e Merge remote-tracking branch 'origin/TracerGUI' into TracerGUI
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-18 17:13:00 +02:00
D4rkr34lm
6a3f3f8b0a fixed filters
Signed-off-by: D4rkr34lm <darth.m.frohn@gmail.com>
2024-04-18 17:12:53 +02:00
yoyosource
4e6755033a Fix some stuff
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-18 17:08:39 +02:00
D4rkr34lm
4422c249dc Made loose filter more loose
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: D4rkr34lm <darth.m.frohn@gmail.com>
2024-04-18 17:07:16 +02:00
D4rkr34lm
1a3850600c Merge branch 'TracerGUI' of https://steamwar.de/devlabs/SteamWar/BauSystem2.0 into TracerGUI
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-18 16:48:48 +02:00
yoyosource
33d687b216 Add gzip compression to trace data
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-18 16:19:23 +02:00
D4rkr34lm
2eab79cf69 Merge branch 'TracerGUI' of https://steamwar.de/devlabs/SteamWar/BauSystem2.0 into TracerGUI 2024-04-18 16:17:58 +02:00
D4rkr34lm
1bcf415186 Closed recource leak
Signed-off-by: D4rkr34lm <darth.m.frohn@gmail.com>
2024-04-18 16:14:49 +02:00
yoyosource
27dc30619b Merge remote-tracking branch 'origin/TracerGUI' into TracerGUI
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-18 16:11:53 +02:00
yoyosource
17a8389703 Add Loader.single 2024-04-18 16:11:46 +02:00
D4rkr34lm
d170e96542 Made trace clear region wise
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: D4rkr34lm <darth.m.frohn@gmail.com>
2024-04-18 16:10:15 +02:00
yoyosource
356b14d49c Fix some stuff
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-18 15:52:30 +02:00
D4rkr34lm
7a9a2283a9 Merge remote-tracking branch 'origin/TracerGUI' into TracerGUI
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-17 21:50:04 +02:00
D4rkr34lm
d5d8c52862 Fixed Ignite Flag
Fixed Formating

Signed-off-by: D4rkr34lm <darth.m.frohn@gmail.com>
2024-04-17 21:49:47 +02:00
yoyosource
163967483f Remove accidental committed stuff
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-17 21:41:56 +02:00
yoyosource
ed799b2937 Fix some things maybe!
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-17 16:31:36 +02:00
D4rkr34lm
d13c415565 Added savind and loading for traces
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-16 22:35:07 +02:00
yoyosource
39d2205b85 Fix TraceCommand.delete
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-12 17:58:20 +02:00
yoyosource
c4296a3781 Fix performance stuff
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-12 17:18:39 +02:00
yoyosource
31e0a0172f Fix some stuff and make it more ugly
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-12 17:13:27 +02:00
yoyosource
bcdad382c7 Update tracer
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-12 16:24:32 +02:00
yoyosource
597c968463 Update tracer
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-12 16:18:30 +02:00
D4rkr34lm
43a04a68bf Renamed TNTRecord sec
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: D4rkr34lm <darth.m.frohn@gmail.com>
2024-04-11 17:49:23 +02:00
D4rkr34lm
80967ab4e7 Add date to Trace
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: D4rkr34lm <darth.m.frohn@gmail.com>
2024-04-09 23:10:49 +02:00
D4rkr34lm
e06d612a0e Renamed TNTRecord
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: D4rkr34lm <darth.m.frohn@gmail.com>
2024-04-09 22:46:00 +02:00
yoyosource
224127eac6 Update tracer
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-09 18:10:18 +02:00
yoyosource
1aa63255e7 Update tracer
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-09 14:59:19 +02:00
yoyosource
7f4834412d Remove legacy materials if there were any
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-08 17:27:34 +02:00
yoyosource
e01ac8ac58 Fix TPSSystem
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-08 17:20:23 +02:00
yoyosource
7ece12de47 Update materials of KillcheckerVisualizer
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-08 14:23:59 +02:00
yoyosource
af19931946 Optimize ProcessingTracesState
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-08 13:25:13 +02:00
yoyosource
b8e79f9c55 Update Trace and TraceManager
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-08 11:56:52 +02:00
yoyosource
c7b8b5d2da Hotfix RegionCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-08 08:28:52 +02:00
yoyosource
41d4ce2472 Fix build errors
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-07 17:22:37 +02:00
yoyosource
4ed5f40fed Fix build errors
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-07 17:21:05 +02:00
yoyosource
a6867cb4f9 Fix SimulatorExecutor
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-04-07 17:19:13 +02:00
yoyosource
7cd61fd9a4 Add ViewFlagHolder
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-04-07 17:15:54 +02:00
yoyosource
3f9f3341a3 Fix AtFlag
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-04-07 16:51:24 +02:00
yoyosource
e7438029b0 Add /rgc and /rgp and /region copy and /region paste
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-07 16:39:00 +02:00
3755395eab Integrated TraceRecorder with Simulator
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Signed-off-by: D4rkr34lm <darth.m.frohn@gmail.com>
2024-04-07 15:20:58 +02:00
yoyosource
e64c50b566 Reformat many things
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-04-07 13:38:36 +02:00
yoyosource
207826ae8a Optimize BundleFilter
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-04-07 13:29:30 +02:00
9b70f2b365 Merge pull request 'Close #226 and #227' (#230) from SmallSimFixes into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #230
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-04-07 13:07:57 +02:00
D4rkr34lm
ae470ffadd Fixed spelling
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-07 13:06:58 +02:00
D4rkr34lm
4a0cd6c51e Add subpixel alignment to storage
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-07 13:05:25 +02:00
D4rkr34lm
3b53926195 Updated ui name
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-07 12:57:50 +02:00
D4rkr34lm
687cb4451e Made text input move of group relativ
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-07 12:56:26 +02:00
D4rkr34lm
41fab57e1a Fixed Sub_Pixel to big
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-07 12:46:39 +02:00
yoyosource
d8d049d5d9 Merge remote-tracking branch 'origin/TracerGUI' into TracerGUI
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-04-07 12:32:43 +02:00
yoyosource
e8db5d86c2 Merge branch 'master' into TracerGUI
# Conflicts:
#	BauSystem_Main/src/BauSystem.properties
#	BauSystem_Main/src/BauSystem_de.properties
#	BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java
#	BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java
#	BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TracerBauGuiItem.java
#	BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/Recorder.java
#	BauSystem_Main/src/de/steamwar/bausystem/features/tracer/record/SingleTraceRecorder.java
#	BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/TraceShowManager.java
2024-04-07 12:32:13 +02:00
D4rkr34lm
1fc9a43604 Added trace follow
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-04-03 00:14:37 +02:00
D4rkr34lm
488866cee6 Added comand for trace at
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-04-02 23:52:18 +02:00
D4rkr34lm
eefe92309d Fixed #226
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Added text input for simulator group
2024-04-02 22:59:40 +02:00
D4rkr34lm
c369662a28 Fixed #227 and made subpixelalignment more user friendly
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-02 22:35:27 +02:00
D4rkr34lm
870578dcf9 Added at-Flag
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-30 16:09:06 +01:00
D4rkr34lm
987a00ae51 Added proper info print to chat
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Refactored Isolate
2024-03-26 22:11:08 +01:00
D4rkr34lm
c0dcb99f7b Changes by jojo
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-21 16:30:10 +01:00
D4rkr34lm
d80e4cf3e0 Fixed inverse x required flags
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Fixed exeption handeling in record ClassMapper
Fixed advanced flag
Added flag aliasses
2024-03-21 16:29:51 +01:00
D4rkr34lm
2d7ae67335 Added required Flags
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-21 15:04:09 +01:00
D4rkr34lm
be25b71cb8 added render call to isolate
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-21 14:45:10 +01:00
D4rkr34lm
a94f5747a0 Implemented trace isolate
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-21 14:03:20 +01:00
D4rkr34lm
5a59578a66 Changed Record id from uuid to incremental int
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-19 16:09:32 +01:00
D4rkr34lm
10a63f1876 Fixed build destroy and testblock destroy flags
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-18 22:47:16 +01:00
D4rkr34lm
5ec9fbb6e0 Fixed Trace id assignment
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Fixed trace recording of source tnt
2024-03-18 22:40:41 +01:00
719b38f5af Merge pull request 'Fix BucketEntityEvent on 1.15 (and 1.19 Build servers)' (#225) from fixBucketEntityEvent into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #225
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-03-15 16:34:19 +01:00
aa8d2bfcd0 Fix BucketEntityEvent on 1.15 (and 1.19 Build servers)
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-15 16:27:43 +01:00
yoyosource
cf329f4236 Fix TPSScoreboardElement
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-14 21:53:10 +01:00
yoyosource
6abeed0b02 Fix ShieldPrinting setting air on click on block
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-14 17:01:56 +01:00
D4rkr34lm
45cc3abd0a Fixed Advanced flag having gravity
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-14 12:31:17 +01:00
D4rkr34lm
2cd3c3527e Added Micromotion view Flag
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-14 12:25:54 +01:00
5a835acb80 Fix Techhider
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-14 11:50:52 +01:00
5a991de55a Fix Techhider
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-14 11:49:04 +01:00
D4rkr34lm
827929382a Added source, build-destroy, testblock-destroy
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-13 23:59:17 +01:00
D4rkr34lm
1282f6066c Added count, fuse and time flags
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-13 23:18:57 +01:00
D4rkr34lm
8a78dcbc78 Added Advanced flag
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-13 23:14:27 +01:00
D4rkr34lm
04b49fe827 Added Ignite Flag
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Added inverse flags
2024-03-12 22:28:33 +01:00
D4rkr34lm
8a3d8a9c33 Expanded Command with delete option
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-12 20:31:20 +01:00
D4rkr34lm
dfd20f03b6 Fixed auto trace
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-12 15:20:38 +01:00
yoyosource
234f476672 Merge remote-tracking branch 'origin/master'
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-11 20:42:00 +01:00
yoyosource
b7cb909986 Add interactAt to documentation 2024-03-11 20:41:52 +01:00
5b8d7bc28f Merge pull request 'Type zum BlockInteract Event im Scriptsystem hinzugefügt' (#224) from ScriptEventDataExpansion into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #224
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-03-09 13:58:29 +01:00
D4rkr34lm
f1db3c2047 Updated doc
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-08 22:23:13 +01:00
D4rkr34lm
2d5bedc63a Added block type to playerInteract event in script api
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-08 22:10:41 +01:00
D4rkr34lm
8781da6a3d Added hide command
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-08 22:06:07 +01:00
yoyosource
a91c352b15 Update pos definition and some other stuff
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-07 22:20:35 +01:00
yoyosource
f7481bfa0f Add server.onlinePlayerCount to Script System
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-07 15:40:52 +01:00
yoyosource
2ccc7920d5 Fix BauScoreboard
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-05 12:21:11 +01:00
yoyosource
3ecd31e80c Update ScoreboardLib
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-05 12:13:30 +01:00
yoyosource
1da5b65460 Add ScoreboardLib and TpsLib
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-05 11:06:31 +01:00
D4rkr34lm
1cbe614171 Fixed nullpointer in auto trace finish check
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-03 22:18:31 +01:00
D4rkr34lm
4620e83a82 Reintroduced id return on trace recording start
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-02 22:18:04 +01:00
D4rkr34lm
6ec62d9720 Reintroduced trace id
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-02 22:14:56 +01:00
D4rkr34lm
335e2cc437 Added docs
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-02 22:11:46 +01:00
D4rkr34lm
75edfc8375 Made for easier interfacing with api by allowing to toggle
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
show from manager
2024-03-02 22:10:36 +01:00
D4rkr34lm
ccf155d500 Fixed flag static init order leading to null pointer exeption
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-02 21:51:49 +01:00
D4rkr34lm
e4346a36e1 Temporarily removed trace from lua api
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-02 21:35:51 +01:00
D4rkr34lm
8aa0ee4d9d Updated simulator fo new trace api
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-02 21:35:09 +01:00
D4rkr34lm
fccdcb2519 Made auto-traces finish
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-02 21:19:52 +01:00
yoyosource
b47d85ebe9 Fix Config.save
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-02 11:34:22 +01:00
D4rkr34lm
0c37cfc3bb Readded auto-trace
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-01 23:48:53 +01:00
D4rkr34lm
1094f4a979 Readded Explosion Flag
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-01 23:19:11 +01:00
D4rkr34lm
c03fbb65e6 Refactored view flag to be abstract class
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-01 23:06:36 +01:00
D4rkr34lm
48175de8d8 Addapted laufbau for new trace api
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-01 22:08:34 +01:00
D4rkr34lm
eeb47f1d08 Added id to filter for records of same tnt
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-01 11:46:30 +01:00
D4rkr34lm
e71ccc3160 Replaced doubly linked list structure with ArrayList refrence, for tnt history
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-03-01 11:40:24 +01:00
D4rkr34lm
40f4af2a06 Started adapting laufbau
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-02-29 21:27:21 +01:00
D4rkr34lm
3c22840278 Removed old trace
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-02-29 11:03:59 +01:00
D4rkr34lm
c621048014 Removed old iterators
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-02-29 11:00:56 +01:00
D4rkr34lm
1644b96886 Moved Classes
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Reimplemented basic command
2024-02-22 20:29:10 +01:00
D4rkr34lm
f62d9e626b Added live rendering
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-02-21 13:34:25 +01:00
D4rkr34lm
3a3c4819f9 Removed null returns
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-02-20 23:22:34 +01:00
D4rkr34lm
5c96da9acd Fixed bugs with trace rendering
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Added toString
2024-02-20 23:11:58 +01:00
yoyosource
5a03623b14 Fix ScriptSystem in 1.15?
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-18 12:15:00 +01:00
yoyosource
f837b37b50 Fix ClipboardListener.onLogin loading copy schem for builder
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-17 18:13:25 +01:00
yoyosource
fd603f3c7f Fix Config
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-17 16:27:23 +01:00
yoyosource
280b5b2613 Recolor Players in InfoCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-17 16:19:57 +01:00
yoyosource
7f62ad8005 Update InfoCommand output
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-17 15:22:48 +01:00
yoyosource
d1196c6e4e Add AutostartListener Bedrock autostarter
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-17 13:37:17 +01:00
yoyosource
009a1f3fa4 Fix PanzernCommand for glass blocks
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-17 13:12:10 +01:00
yoyosource
a05116a16c Fix SpectatorListener.resendChunks
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-17 12:22:56 +01:00
yoyosource
cc15781b44 Hotfix Config
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-17 09:32:26 +01:00
yoyosource
8053796341 Update permission of BackupCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-17 09:15:43 +01:00
yoyosource
9466a8c981 Fix AntiBauAddMemberFix
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-17 08:55:47 +01:00
yoyosource
338980f0d3 Fix AntiBauAddMemberFix 2024-02-17 08:55:33 +01:00
e4dc05ce02 Merge pull request 'Update Permission' (#220) from PermissionUpdate into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #220
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-02-17 08:53:30 +01:00
yoyosource
de08488371 Fix AxiomPermissionCheck
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-17 08:36:51 +01:00
yoyosource
21e7bd89af Fix BindCommand and SteamWarLuaPlugin
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-16 08:24:42 +01:00
yoyosource
953db69425 Fix BackupCommand
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-02-16 08:09:40 +01:00
yoyosource
1d49a6981b Merge branch 'master' into PermissionUpdate
# Conflicts:
#	BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/ServerLib.java
#	BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSSystem.java
#	BauSystem_Main/src/de/steamwar/bausystem/features/world/AxiomPermissionCheck.java
2024-02-16 08:09:13 +01:00
d9dd64271e Merge pull request 'Potential WE axe fix' (#223) from potentialWEAxeFix into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #223
Reviewed-by: Chaoscaot <chaoscaot@zohomail.eu>
2024-02-13 10:51:46 +01:00
yoyosource
c2c686319d Fix ServerLib
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-11 15:17:07 +01:00
7ded9eefa4 Potential WE axe fix
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-06 22:39:33 +01:00
yoyosource
b211f9cf79 Hot Hot Hot-fix Players on Bauserver without add
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-04 01:18:50 +01:00
yoyosource
2ba51e66e0 Fix BindCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-01 21:48:14 +01:00
yoyosource
f83ba6ab96 Fix AxiomPermissionCheck
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-02-01 20:02:43 +01:00
yoyosource
b891c5adf1 Fix TPSSystem
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-01-30 19:48:43 +01:00
yoyosource
78c0bc51b9 Fix SimulatorSaver
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-01-30 16:10:50 +01:00
yoyosource
d1afb344d9 Fix SimulatorSaver
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-01-30 16:06:53 +01:00
yoyosource
e77680d25a Fix AxiomPermissionCheck
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-01-23 10:11:19 +01:00
yoyosource
94bf2f3ae6 Hotfix SpectatorListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-01-20 20:35:19 +01:00
yoyosource
775d428671 Fix SpectatorListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-01-19 20:33:27 +01:00
yoyosource
ea5df6cee3 Fix SteamWarLuaPlugin
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-01-19 17:08:11 +01:00
yoyosource
da1ea27f61 Remove Permission.SPECTATOR
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-01-19 17:02:57 +01:00
yoyosource
2bf0b0c6e8 Merge branch 'master' into PermissionUpdate
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-01-19 16:51:09 +01:00
85e6aab9e6 Merge pull request 'Fix freeze order.' (#222) from checkpoint into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #222
2024-01-19 15:53:03 +01:00
ad9b0aeab0 Fix freeze order.
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-01-19 15:52:06 +01:00
016a2a3469 Merge pull request 'Checkpoint idle server' (#221) from checkpoint into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #221
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-01-18 01:23:41 +01:00
c2bec98063 Checkpoint idle server
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-01-17 16:20:24 +01:00
yoyosource
ada8fefd62 Fix SimulatorSaver
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-01-14 11:52:20 +01:00
yoyosource
21aa22d75f Fix SteamWarLuaPlugin WE permission for WorldEdit commands
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-27 17:34:00 +01:00
yoyosource
a3f5098137 Merge branch 'master' into PermissionUpdate
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-25 11:41:44 +01:00
yoyosource
cdac4235f5 Fix SimulatorTNTPhaseSettingsGui
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-25 11:38:20 +01:00
yoyosource
b166d8ff6b Merge branch 'master' into PermissionUpdate
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
# Conflicts:
#	BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCursor.java
2023-12-25 11:31:44 +01:00
yoyosource
2c5a50bff3 Update BauMemberUpdate
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-23 17:54:54 +01:00
D4rkr34lm
beb49cdcd1 Added option for bundeling to trace rendering
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-12-23 17:43:34 +01:00
yoyosource
96b84a798b Update BauMemberUpdate
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-23 16:45:48 +01:00
yoyosource
6e9693d838 Update Techhider of Spectators
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-23 15:06:49 +01:00
yoyosource
2a55f607d3 Add dynamic spectator disable
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-23 14:18:32 +01:00
yoyosource
0ac735c30f Add ForceSpectatorCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Add TechHiderCommand.toggleHider for spectators
2023-12-23 13:02:44 +01:00
yoyosource
b00babdcbd Fix permission messages
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-23 08:01:38 +01:00
yoyosource
f5e4d725fe Add BauMemberUpdate and BauMemberUpdateEvent
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-22 16:55:41 +01:00
yoyosource
ca8a916042 Optimize imports
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-22 15:16:28 +01:00
yoyosource
8da1fdac58 Fix SmartPlaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-22 14:57:54 +01:00
yoyosource
927ce1f495 Fix SmartPlaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-22 11:48:55 +01:00
yoyosource
0bf27db398 Fix SmartPlaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-22 10:19:40 +01:00
yoyosource
202e03c957 Fix SmartPlaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-22 10:03:24 +01:00
yoyosource
2cfed8b84d Fix CancelPacketHandleException in SmartPlaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-22 09:24:49 +01:00
yoyosource
ec10b0fe71 Add Observer to Simulator
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-22 09:01:54 +01:00
yoyosource
bff63482ef Add BauLockStateScoreboard
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-22 08:44:54 +01:00
yoyosource
4f266a30ab Fix StorageLib in 1.15
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-20 20:39:23 +01:00
D4rkr34lm
85512be3a8 Added methode to hide trail
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-12-19 16:22:54 +01:00
yoyosource
67c9f66d13 Fix AutostartListener for specific GameMode configs 2023-12-19 16:22:54 +01:00
yoyosource
f2a957c88f Hotfix AntiCursorReCentering 2023-12-19 16:22:54 +01:00
yoyosource
d1ff80b9dc Hotfix AntiCursorReCentering 2023-12-19 16:22:54 +01:00
yoyosource
41ed83dfe0 Add AntiCursorReCentering 2023-12-19 16:22:54 +01:00
D4rkr34lm
2bf3cfbb1d Reimplemented trace rendering
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-12-19 16:17:14 +01:00
yoyosource
19bb7cc733 Fix synchronized errors
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-17 13:07:48 +01:00
yoyosource
17c03f629a Fix SimulatorBaseGui open
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-17 12:48:05 +01:00
yoyosource
f6644d8ad8 Fix Gui not populated on tpslimit 0
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-17 12:24:01 +01:00
yoyosource
4ff706e1ef Fix Gui
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-17 12:20:36 +01:00
yoyosource
3d0ebbe743 Fix TNTPhase spawning in frozen Region
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-16 22:22:53 +01:00
yoyosource
5556bd7875 Update SimulatorBauGuiItem Permission
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-16 21:39:25 +01:00
yoyosource
5fe0079e30 Merge branch 'master' into PermissionUpdate 2023-12-16 21:38:01 +01:00
yoyosource
006a0edef6 Add SimulatorBauGuiItem back
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-16 21:36:13 +01:00
yoyosource
6305453e15 Fix Permission for SignEdit and other stuff
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-16 21:34:29 +01:00
yoyosource
a61f1e2c8c Fix Permission for ServerLib.getBlockAt and setBlockAt and exec
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-16 18:08:48 +01:00
yoyosource
78f7e42629 Fix Permission
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-16 16:52:59 +01:00
D4rkr34lm
3dddb48d0c Adjusted more permissions
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-12-16 15:53:02 +01:00
yoyosource
37e6628aaa Fix SpectatorListener
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-12-16 15:12:16 +01:00
yoyosource
bcb8b31ba9 Add Permission.MEMBER
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-12-16 14:51:24 +01:00
D4rkr34lm
832484c2a2 Merge branch 'PermissionUpdate' of https://steamwar.de/devlabs/SteamWar/BauSystem2.0 into PermissionUpdate
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-12-16 14:49:01 +01:00
D4rkr34lm
7802a03f48 Addjusted permissions 2023-12-16 14:47:33 +01:00
yoyosource
20af36a4a2 Add SpectatorListener
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-12-16 14:42:01 +01:00
yoyosource
0cec90c55c Add validator for player and commandsender for checking build Permission
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-12-16 14:19:30 +01:00
yoyosource
0b70bdfe97 Fix Permission.SPECTATOR
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-12-16 14:05:58 +01:00
yoyosource
ec93dfd8ec Add Permission.SPECTATOR
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-12-16 14:04:46 +01:00
yoyosource
1a6c0de502 Update Permission
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-12-16 14:01:42 +01:00
yoyosource
b73af3e2ec Hotfix SimulatorStorage
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-16 12:48:52 +01:00
27627c3b41 Merge pull request 'SimRework2.0' (#216) from SimRework2.0 into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #216
2023-12-16 12:30:56 +01:00
4f592e754c Merge branch 'master' into SimRework2.0
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-16 12:29:50 +01:00
yoyosource
52fcb69e1e Optimize imports
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-16 12:27:33 +01:00
yoyosource
a0ff726fb4 Add several Anvil Guis
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Fix some lifetime and offset contraints for RedstonePhases
2023-12-15 19:56:59 +01:00
yoyosource
61282c0f84 Fix MaterialCommand triggering WorldEditListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-03 15:19:19 +01:00
yoyosource
1ed10c8c86 Fix SmartPlaceListener click on Comparator
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-12-02 12:58:31 +01:00
D4rkr34lm
f94aeeda01 Added next link in tnt record
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-11-26 17:00:02 +01:00
yoyosource
4c7f56be7c Fix ColorCodes
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-11-18 20:29:41 +01:00
yoyosource
36e0c4c910 Fix NPE for Point convertion to Pos
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-11-17 18:18:55 +01:00
yoyosource
bdeb7da4c6 Add a few RegionLib getters
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Add storage saving and loading
2023-11-17 18:14:16 +01:00
b58e418ea4 Changed Data Structure for TNTRecords and TNT tracking, to record update order properly 2023-11-10 15:49:12 +01:00
D4rkr34lm
979428d493 Added methods to record tnt to Recorder 2023-11-06 02:05:17 +01:00
D4rkr34lm
84150aadd2 Added getters to TraceManager 2023-11-06 01:20:59 +01:00
D4rkr34lm
32fb859764 Finished data part of Trace class 2023-11-06 00:56:02 +01:00
D4rkr34lm
b886745113 Finished data class for a tnt record 2023-11-06 00:45:32 +01:00
D4rkr34lm
27a542590c Started Trace Refactoring
Laid out basic class structure
2023-11-06 00:11:03 +01:00
yoyosource
fdc201e99d Add only similar elements inside of groups
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Add delete to group gui and redstone and tnt
Rework SimulatorRedstoneGui
Add 'Make Group' option to SimulatorTNTGui
Fix Player Join server crash
Add 'Create Sim' to Select Simulator Gui
2023-10-28 23:14:35 +02:00
yoyosource
06a68a7004 Fix lore of sim item
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-28 09:56:24 +02:00
yoyosource
11fdd08f79 Fix some stuff and layout
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-27 21:08:02 +02:00
yoyosource
8fb4a4669a Fix source/target compatibility
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-27 17:55:13 +02:00
yoyosource
5686b6bc40 Fix source/target compatibility
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-10-27 17:50:33 +02:00
yoyosource
98455a29ce Fix source/target compatibility
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-10-27 17:48:02 +02:00
yoyosource
08839343c3 Fix SimulatorSettingsGui click on XYZ
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-10-27 17:43:59 +02:00
yoyosource
a0859923f0 Add SimulatorAnvilGui and add anvil gui's to everything
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-10-27 17:41:29 +02:00
yoyosource
b379f8457d Fix simulator double activation while tnt still present
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-10-27 16:46:56 +02:00
yoyosource
402de21c47 Add order to SimulatorRedstonePhaseSettingsGui
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-10-27 16:43:03 +02:00
yoyosource
c05724efda Update SimulatorExecutor and fix many bugs
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-10-27 16:34:54 +02:00
yoyosource
c050046820 Remove old and move new
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-27 11:55:47 +02:00
yoyosource
b49c75d6bd Add storage api and implement SimulatorStorage
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-10-26 22:31:30 +02:00
yoyosource
61d1f0bd45 Add loading and saving methods and fix many QOL things
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-10-26 18:08:03 +02:00
yoyosource
61f7218fc0 Add some QOL Simulator changes
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-10-25 23:03:59 +02:00
yoyosource
4ee93b59dd Fix AutostartListener for specific GameMode configs
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-25 14:35:15 +02:00
yoyosource
21ec66b4e2 Fix many things
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-10-25 14:13:45 +02:00
yoyosource
20b116f228 Update many GUI's
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Add SimulatorCursor.onPlayerInteract
2023-10-24 23:05:16 +02:00
yoyosource
d09c3548a7 Add SimulatorStorage
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Add SimulatorCursor showing highlighted entity
2023-10-24 18:23:29 +02:00
yoyosource
c0551c0cf8 Fix SimulatorWatcher for non watched Simulator 2023-10-24 18:23:29 +02:00
yoyosource
648482183a Move some stuff and add SimulatorCursor 2023-10-24 18:23:29 +02:00
yoyosource
4e6ee3b95b Add SimulatorWatcher.show, SimulatorWatcher.hide 2023-10-24 18:23:29 +02:00
yoyosource
3506083416 Add SimulatorExecutor 2023-10-24 18:23:29 +02:00
yoyosource
834039c4d4 Consolidate Item Generation
Fix Back arrow in element gui
2023-10-24 18:23:29 +02:00
yoyosource
327dded73b Consolidate Item Generation
Fix Back arrow in element gui
2023-10-24 18:23:29 +02:00
D4rkr34lm
933e4fe7d9 Removed parent group from group chooser menu 2023-10-24 18:23:29 +02:00
yoyosource
f6ee55c44f Optimize SimulatorBaseGui 2023-10-24 18:23:29 +02:00
yoyosource
9ceb8b40ae Fix useless reopening in old versions 2023-10-24 18:23:29 +02:00
D4rkr34lm
647ef97bfb Add group chooser fix 2023-10-24 18:23:29 +02:00
aef8edca07 Add group choosing and creation 2023-10-24 18:23:29 +02:00
yoyosource
b090b31503 Finalize GUI 2023-10-24 18:23:29 +02:00
yoyosource
e47cf80d60 Finalize GUI 2023-10-24 18:23:29 +02:00
4eb3a310a7 Add sorting of phases 2023-10-24 18:23:29 +02:00
68f81c8c3e Add last Phase and option for adding phase
Refactored for coherent naming sceme
2023-10-24 18:23:29 +02:00
0f7c19da5a Add quick delete fo phases 2023-10-24 18:23:29 +02:00
b5a81eb6db Add rmoval of empty group 2023-10-24 18:23:29 +02:00
D4rkr34lm
6e39f3e92a Made some fixes 2023-10-24 18:23:28 +02:00
D4rkr34lm
1b2d19c31d Add call to tnt phase menu 2023-10-24 18:23:28 +02:00
D4rkr34lm
f067e55d1f Refactored PhaseGuis 2023-10-24 18:23:28 +02:00
D4rkr34lm
273fba879e Add Phase order upper limit 2023-10-24 18:23:28 +02:00
D4rkr34lm
420cf4a5b8 Finalize first gui version 2023-10-24 18:23:28 +02:00
D4rkr34lm
148761fa63 Add Subpixel alignment to SimTNTSettingGui 2023-10-24 18:23:28 +02:00
yoyosource
fbe4f00ac0 Add basic GUI's
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-10-24 18:23:28 +02:00
D4rkr34lm
7980f49dfa Add Licence header 2023-10-24 18:23:28 +02:00
D4rkr34lm
0f1a8f5531 Add final DataStructure 2023-10-24 18:23:28 +02:00
D4rkr34lm
077a9854a5 Add class Hierarchy 2023-10-24 18:23:28 +02:00
D4rkr34lm
44f6d1c15d Added new sim data structure 2023-10-24 18:23:28 +02:00
yoyosource
0be117c001 Hotfix AntiCursorReCentering
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-24 18:23:12 +02:00
yoyosource
758c32e353 Hotfix AntiCursorReCentering
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-24 18:12:03 +02:00
yoyosource
8f1cac6f1f Add AntiCursorReCentering
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-22 12:20:29 +02:00
yoyosource
5de070c90e Update Tracer
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-22 12:07:52 +02:00
yoyosource
c330fdcc1d Fix PistonCalculator for normal Pistons
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-17 08:15:04 +02:00
yoyosource
40dcee6eee Fix Warp and Compass a bit
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-16 17:45:18 +02:00
yoyosource
04e7c5f565 Fix Simulator with tpslimit 0
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-16 17:10:13 +02:00
yoyosource
89e8148158 Fix Trace Show consolidating too early
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-16 17:04:18 +02:00
yoyosource
d281860b81 Fix SmartPlaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-16 14:25:24 +02:00
yoyosource
05c01e25e2 Fix SmartPlaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-16 14:12:33 +02:00
yoyosource
f0741dbc19 Hotfix BEEHIVE sound for SmartPlace
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-15 21:14:27 +02:00
yoyosource
e18b2622eb Fix SmartPlaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-15 18:37:31 +02:00
yoyosource
2b3f2a72d7 Fix SmartPlaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-14 13:09:57 +02:00
yoyosource
8128aa7324 Fix PacketCache growing uncontrollably
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-10-14 12:27:14 +02:00
yoyosource
83a281b278 Update TPSLimit system to TPSSystem
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Cleanup some mess from before
2023-10-11 15:35:02 +02:00
yoyosource
6197fd81c1 Hotfix PlaceItemUtils for Slab/Stairs/Trapdoor
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-10-08 12:07:27 +02:00
yoyosource
fcb1ce4e4b Hotfix PlaceItemUtils and Blackstone placing Walls in 1.19
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-10-07 21:05:01 +02:00
yoyosource
f82d5815ee Hotfix PlaceItemUtils
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Fix TraceCommand not having messages

Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-10-07 08:34:22 +02:00
yoyosource
71f1a1244e Hotfix PlaceItemWrapper15
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-10-06 15:46:23 +02:00
yoyosource
3183d71478 Fix PlaceItemUtils in 1.19
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-10-06 15:26:47 +02:00
cf569d6e76 Merge pull request 'QOL' (#203) from QOL into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #203
2023-10-06 14:59:47 +02:00
yoyosource
cc8c6ba61d Fix SmartPlaceListener sound on force place
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-10-06 14:40:09 +02:00
yoyosource
b8c74db0f3 Fix PlaceItemUtils
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-10-05 21:21:24 +02:00
yoyosource
643486cfe5 Fix Depth
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-10-05 21:10:55 +02:00
yoyosource
1a93f2fc41 Add -water as for /trace show in WarShip regions
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-10-03 11:32:20 +02:00
yoyosource
8217e9645b Add TraceCommand.showAtCommand, TraceCommand.showFromCommand and TraceCommand.showFromToCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-27 11:44:01 +02:00
yoyosource
925ba19ff3 Fix PlaceItemUtils and SmartPlaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-27 11:41:44 +02:00
yoyosource
c0b40d00a5 Fix PlaceItemUtils
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-27 11:19:20 +02:00
yoyosource
b1cd4604eb Fix -ignite -micro enable -water by default
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-26 12:39:42 +02:00
yoyosource
2f5eb080cf Fix PistonCalculator
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-26 10:23:13 +02:00
yoyosource
910762126f Fix Off-Hand Item in Double Swap Hand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-26 09:52:54 +02:00
yoyosource
207953cb98 Add Material GUI click item to get into inv
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-26 09:42:54 +02:00
yoyosource
9982804a20 Update SmartPlaceListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Fix PlaceItemUtils

Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-26 09:27:30 +02:00
yoyosource
898d6269e5 Fix SignEditFrom20
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Add PlaceItemUtils

Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-25 22:27:42 +02:00
yoyosource
8da3c7bcf7 Hotfix SignEditFrom20
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-24 18:10:09 +02:00
yoyosource
71c8b7c062 Add SignEditFrom20 for 1.20+
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Change SignEdit to SignEditUntil19 for <=1.19

Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-24 18:05:01 +02:00
yoyosource
a0c7f024ad Fix Testblock paste
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-24 16:54:11 +02:00
yoyosource
cbe41f7e7f Fix DoubleF for Script System on higher TPS
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-24 15:36:10 +02:00
yoyosource
06cc2bb35b Fix testblock pasting
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-24 15:32:55 +02:00
yoyosource
b956f34a7e Show unmovable Blocks in PistonCalculator
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-24 13:16:08 +02:00
yoyosource
c08bb9d702 Simplify tracer
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-23 15:45:42 +02:00
yoyosource
33e070bc43 Finalize BindCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-23 14:39:56 +02:00
yoyosource
22334ab15a Finalize BindCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-23 14:35:23 +02:00
yoyosource
438010a7fb Fix ItemBindCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-22 23:18:24 +02:00
yoyosource
c0880fc62a Fix ItemBindCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-22 15:08:39 +02:00
D4rkr34lm
d810d50d22 Added Item Bind Command
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-09-21 21:42:53 +02:00
yoyosource
451c47d3ed Add TraceRecordAutoDeletion
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-20 17:14:34 +02:00
yoyosource
5abd29056b Fix BossbarLib
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-19 17:26:54 +02:00
yoyosource
b47210a5ae Hotfix PasteBuilder.removeWater
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-19 16:35:58 +02:00
yoyosource
110172a98a Fix Tracer
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Fix BossbarLib

Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-18 21:14:01 +02:00
yoyosource
292907b735 Fix TestblockCommand permission
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Fix XrayCommand destroy block on right click

Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-18 17:26:44 +02:00
yoyosource
a59bf7345f Fix ShowModeParameterType exclusions
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-18 17:19:42 +02:00
yoyosource
952d2f03dc Add -testblockdestroy and -testblockdestroyonly as Trace Show options
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-18 17:18:27 +02:00
yoyosource
7cd8d40e11 Add /loader speed and /loader wait
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-18 16:36:33 +02:00
yoyosource
c20eb8c331 Add Last Wait in Loader to be 120 ticks
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-18 16:26:05 +02:00
yoyosource
f7cfe5d2bd Translate LoaderComparator
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-18 16:22:18 +02:00
Chaoscaot
b59a4a637e
Fixes and BossbarLib draft
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: Chaoscaot <chaoscaot@zohomail.eu>
2023-09-18 09:02:24 +02:00
yoyosource
23fba7074d Add TNTMode.ONLY_BUILD
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-17 16:37:20 +02:00
yoyosource
42e8df6b53 Remove Redstonetester since nobody uses it
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-17 16:20:27 +02:00
yoyosource
91960f501b Fix LoaderRecorder messages on BlockBreakEvent
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-17 16:14:52 +02:00
yoyosource
9c9d7bc533 Update AutoStart time since start now shown as game ticks
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-17 16:11:19 +02:00
yoyosource
adc394e660 Add LoaderTNT editing
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Add more filter options
Add remove loader element on break block

Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-17 16:03:51 +02:00
yoyosource
13afc55b1f Fix LoaderLectern
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-17 13:56:03 +02:00
yoyosource
8ecb6e173f Update Loader usage and add copy
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-17 13:52:58 +02:00
yoyosource
bf2de904dc Fix AttributeRemoveCommand showing whole attribute instead of name
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Add AutostartListener Chest capability
Update InfoCommand coloring
Add DesignEndStone recalc
Fix KillcheckerVisualizer area for double kills

Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-16 22:55:14 +02:00
yoyosource
f2978a16c0 Fix Event priority of EntityExplodeEvent
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-15 17:37:43 +02:00
yoyosource
9e9c653aba Fix EventListener for TNT explosions in Build Region
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-15 17:32:09 +02:00
Chaoscaot
1da569c41b
Fix NoClip
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: Chaoscaot <chaoscaot@zohomail.eu>
2023-09-10 20:56:14 +02:00
yoyosource
ce6c101df3 Remove color replace on BackupCommand.backupLoad
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-10 15:54:14 +02:00
c6a045fe94 Fix 30 Minute shutdown for empty server
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-09-08 08:55:03 +02:00
yoyosource
e2779ba107 Remove /arceon command
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-07 20:22:58 +02:00
yoyosource
ce1de0dfdf Add AxiomPermissionCheck
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-06 19:54:12 +02:00
yoyosource
6096d48a05 Add AxiomPermissionCheck
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Signed-off-by: yoyosource <yoyosource@nidido.de>
2023-09-06 19:41:43 +02:00
300 geänderte Dateien mit 14733 neuen und 11585 gelöschten Zeilen

10
.gitignore vendored
Datei anzeigen

@ -1,5 +1,7 @@
# Package Files
# Build files
*.jar
**/bin
**/build
# Gradle
.gradle
@ -10,6 +12,10 @@ steamwar.properties
# IntelliJ IDEA
.idea
*.iml
plugin.yml
# Other
lib
lib
#linkage
LinkageUtils.java

Datei anzeigen

@ -27,8 +27,8 @@ version '1.0'
compileJava.options.encoding = 'UTF-8'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17
sourceSets {
main {

Datei anzeigen

@ -1,39 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.tracer.record;
import net.minecraft.server.v1_15_R1.EntityTNTPrimed;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
import org.bukkit.entity.TNTPrimed;
import java.util.stream.Stream;
public class TNTPrimedIterator15 implements TNTPrimedIterator {
private static final CraftWorld WORLD = (CraftWorld) Bukkit.getWorlds().get(0);
@Override
public Stream<TNTPrimed> iterator() {
return WORLD.getHandle().entitiesById.values().stream()
.filter(EntityTNTPrimed.class::isInstance)
.map(entity -> (TNTPrimed) entity.getBukkitEntity());
}
}

Datei anzeigen

@ -106,6 +106,7 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
private static final WorldEditPlugin WORLDEDIT_PLUGIN = Objects.requireNonNull((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
private static final World BUKKITWORLD = new BukkitWorld(Bukkit.getWorlds().get(0));
@Override
public void setSelection(Player p, Point minPoint, Point maxPoint) {
WORLDEDIT_PLUGIN.getSession(p).setRegionSelector(BUKKITWORLD, new CuboidRegionSelector(BUKKITWORLD, toBlockVector3(minPoint), toBlockVector3(maxPoint)));
@ -190,7 +191,7 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
}
@Override
public boolean backup(Point minPoint, Point maxPoint, File file) {
public Clipboard copy(Point minPoint, Point maxPoint, Point copyPoint) {
BukkitWorld bukkitWorld = new BukkitWorld(Bukkit.getWorlds().get(0));
CuboidRegion region = new CuboidRegion(bukkitWorld, toBlockVector3(minPoint), toBlockVector3(maxPoint));
BlockArrayClipboard clipboard = new BlockArrayClipboard(region);
@ -203,12 +204,21 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
copy.setCopyingBiomes(false);
Operations.complete(copy);
clipboard.setOrigin(toBlockVector3(copyPoint));
return clipboard;
} catch (WorldEditException e) {
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e);
return null;
}
}
try (ClipboardWriter writer = BuiltInClipboardFormat.SPONGE_SCHEMATIC.getWriter(new FileOutputStream(file))) {
writer.write(clipboard);
}
@Override
public boolean backup(Point minPoint, Point maxPoint, File file) {
Clipboard clipboard = copy(minPoint, maxPoint, minPoint);
try (ClipboardWriter writer = BuiltInClipboardFormat.SPONGE_SCHEMATIC.getWriter(new FileOutputStream(file))) {
writer.write(clipboard);
return true;
} catch (WorldEditException | IOException e) {
} catch (IOException e) {
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e);
return false;
}

Datei anzeigen

@ -63,38 +63,6 @@ public class NMSWrapper15 implements NMSWrapper {
player.updateInventory();
}
@Override
public void init(LongSupplier longSupplier) {
SystemUtils.a = () -> System.nanoTime() + longSupplier.getAsLong();
}
private static final List<Packet<?>> packets = new ArrayList<>();
private static final Vec3D noMotion = new Vec3D(0, 0, 0);
@Override
public void createTickCache(World world) {
packets.clear();
world.getEntities().stream().filter(entity -> !(entity instanceof Player)).forEach(entity -> {
packets.add(new PacketPlayOutEntityVelocity(entity.getEntityId(), noMotion));
packets.add(new PacketPlayOutEntityTeleport(((CraftEntity) entity).getHandle()));
if (entity instanceof TNTPrimed) {
net.minecraft.server.v1_15_R1.Entity serverEntity = ((CraftEntity) entity).getHandle();
packets.add(new PacketPlayOutEntityMetadata(serverEntity.getId(), serverEntity.getDataWatcher(), true));
}
});
}
@Override
public void sendTickPackets() {
Bukkit.getOnlinePlayers().forEach(player -> {
PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
for (Packet<?> p : packets) {
connection.sendPacket(p);
}
});
}
private static final Reflection.FieldAccessor<Integer> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, int.class, 0);
@Override

Datei anzeigen

@ -0,0 +1,43 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.utils;
import org.bukkit.Material;
public class PlaceItemWrapper15 implements PlaceItemWrapper {
public PlaceItemWrapper15() {
for (Material material : Material.values()) {
if (!material.isBlock()) continue;
if (material.isLegacy()) continue;
String nonWall = material.name().replace("_WALL_", "").replace("WALL_", "").replace("_WALL", "");
try {
Material nonWallMaterial = Material.valueOf(nonWall);
if (nonWallMaterial != material && nonWallMaterial.isItem() && !nonWallMaterial.isBlock()) {
BLOCK_MATERIAL_TO_WALL_BLOCK_MATERIAL.put(nonWallMaterial, material);
}
} catch (Exception e) {
// Ignore
}
}
ITEM_MATERIAL_TO_BLOCK_MATERIAL.put(Material.REDSTONE, Material.REDSTONE_WIRE);
}
}

Datei anzeigen

@ -19,9 +19,12 @@
package de.steamwar.bausystem.utils;
import com.comphenix.tinyprotocol.Reflection;
import de.steamwar.bausystem.utils.PlayerMovementWrapper;
import net.minecraft.server.v1_15_R1.EntityPlayer;
import net.minecraft.server.v1_15_R1.PacketPlayInFlying;
import net.minecraft.server.v1_15_R1.PacketPlayOutEntity;
import net.minecraft.server.v1_15_R1.PacketPlayOutEntityTeleport;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
@ -37,4 +40,20 @@ public class PlayerMovementWrapper15 implements PlayerMovementWrapper {
entityPlayer.setLocation(packetPlayInFlying.a(0.0), packetPlayInFlying.b(0.0), packetPlayInFlying.c(0.0), packetPlayInFlying.a(0F), packetPlayInFlying.b(0F));
}
}
@Override
public Object convertToOut(Player player, Object object) {
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
Object packet = Reflection.newInstance(teleportPacket);
teleportEntity.set(packet, player.getEntityId());
teleportPosition.set(packet, packetPlayInFlying.a(0.0), packetPlayInFlying.b(0.0), packetPlayInFlying.c(0.0));
if (Float.isNaN(packetPlayInFlying.a(Float.NaN))) {
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw()));
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
} else {
teleportYaw.set(packet, rotToByte(packetPlayInFlying.a(0.0F)));
teleportPitch.set(packet, rotToByte(packetPlayInFlying.b(0.0F)));
}
return packet;
}
}

Datei anzeigen

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.simulator.preview;
package de.steamwar.bausystem.utils;
public class Simulator15 implements Simulator {
public class TickListener15 implements TickListener {
}

Datei anzeigen

@ -27,8 +27,8 @@ version '1.0'
compileJava.options.encoding = 'UTF-8'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17
sourceSets {
main {

Datei anzeigen

@ -1,46 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.tracer.record;
import com.comphenix.tinyprotocol.Reflection;
import net.minecraft.server.level.WorldServer;
import net.minecraft.world.level.entity.LevelEntityGetter;
import org.bukkit.Bukkit;
import org.bukkit.entity.TNTPrimed;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
public class TNTPrimedIterator18 implements TNTPrimedIterator {
private static final Reflection.MethodInvoker getWorld = Reflection.getMethod(Reflection.getClass("{obc}.CraftWorld"), "getHandle");
private static final Reflection.MethodInvoker getWorldEntities = Reflection.getTypedMethod(WorldServer.class, null, LevelEntityGetter.class);
private static final Reflection.MethodInvoker getIterable = Reflection.getTypedMethod(LevelEntityGetter.class, null, Iterable.class);
private static final Reflection.MethodInvoker getBukkitEntity = Reflection.getTypedMethod(Reflection.getClass("{nms.world.entity}.Entity"), "getBukkitEntity", null);
@Override
public Stream<TNTPrimed> iterator() {
return StreamSupport.stream(((Iterable<?>) getIterable.invoke(getWorldEntities.invoke(getWorld.invoke(Bukkit.getWorlds().get(0))))).spliterator(), false)
.map(getBukkitEntity::invoke)
.filter(TNTPrimed.class::isInstance)
.map(TNTPrimed.class::cast);
}
}

Datei anzeigen

@ -73,37 +73,6 @@ public class NMSWrapper18 implements NMSWrapper {
player.updateInventory();
}
@Override
public void init(LongSupplier longSupplier) {
SystemUtils.a = () -> System.nanoTime() + longSupplier.getAsLong();
}
private static final List<Packet<?>> packets = new ArrayList<>();
private static final Vec3D noMotion = new Vec3D(0, 0, 0);
@Override
public void createTickCache(World world) {
packets.clear();
world.getEntities().stream().filter(entity -> !(entity instanceof Player)).forEach(entity -> {
packets.add(new PacketPlayOutEntityVelocity(entity.getEntityId(), noMotion));
packets.add(new PacketPlayOutEntityTeleport(((CraftEntity) entity).getHandle()));
if (entity instanceof TNTPrimed) {
net.minecraft.world.entity.Entity serverEntity = ((CraftEntity) entity).getHandle();
packets.add(new PacketPlayOutEntityMetadata(serverEntity.ae(), serverEntity.ai(), true));
}
});
}
@Override
public void sendTickPackets() {
Bukkit.getOnlinePlayers().forEach(player -> {
for (Packet<?> p : packets) {
TinyProtocol.instance.sendPacket(player, p);
}
});
}
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
@Override

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bausystem.utils;
import com.comphenix.tinyprotocol.Reflection;
import de.steamwar.bausystem.utils.PlayerMovementWrapper;
import net.minecraft.network.protocol.game.PacketPlayInFlying;
import net.minecraft.server.level.EntityPlayer;
@ -37,4 +38,20 @@ public class PlayerMovementWrapper18 implements PlayerMovementWrapper {
entityPlayer.e(packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c);
}
}
@Override
public Object convertToOut(Player player, Object object) {
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
Object packet = Reflection.newInstance(teleportPacket);
teleportEntity.set(packet, player.getEntityId());
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c);
if (packetPlayInFlying.h) {
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw()));
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
} else {
teleportYaw.set(packet, rotToByte(packetPlayInFlying.d));
teleportPitch.set(packet, rotToByte(packetPlayInFlying.e));
}
return packet;
}
}

Datei anzeigen

@ -27,8 +27,8 @@ version '1.0'
compileJava.options.encoding = 'UTF-8'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17
sourceSets {
main {
@ -51,6 +51,7 @@ dependencies {
implementation project(":BauSystem_Main")
compileOnly 'org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT'
compileOnly 'io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT'
compileOnly 'it.unimi.dsi:fastutil:8.5.6'
compileOnly 'com.mojang:datafixerupper:4.0.26'
compileOnly 'io.netty:netty-all:4.1.68.Final'

Datei anzeigen

@ -1,178 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.simulator.preview;
import org.bukkit.Axis;
import org.bukkit.util.BoundingBox;
import org.bukkit.util.VoxelShape;
import java.util.ArrayList;
import java.util.List;
public class AxisMovementLimiter19 {
private double x;
private double y;
private double z;
private Axis axis;
private double movement;
private double minX;
private double maxX;
private double minY;
private double maxY;
private double minZ;
private double maxZ;
public AxisMovementLimiter19(double x, double y, double z, Axis axis, double movement) {
this.x = x;
this.y = y;
this.z = z;
this.axis = axis;
this.movement = movement;
// Calculate the min and max values for the movement
minX = x;
maxX = x + 0.98;
minY = y;
maxY = y + 0.98;
minZ = z;
maxZ = z + 0.98;
switch (axis) {
case X:
if (movement < 0) {
minX += movement;
} else if (movement > 0) {
maxX += movement;
}
break;
case Y:
if (movement < 0) {
minY += movement;
} else if (movement > 0) {
maxY += movement;
}
break;
case Z:
if (movement < 0) {
minZ += movement;
} else if (movement > 0) {
maxZ += movement;
}
break;
}
// System.out.println(axis + " " + minX + " -> " + maxX + " " + minY + " -> " + maxY + " " + minZ + " -> " + maxZ);
}
private List<Pos19> possibleCollisions() {
int minX = TNT19.floor(this.minX);
int maxX = TNT19.floor(this.maxX);
int minY = TNT19.floor(this.minY) - 1;
int maxY = TNT19.floor(this.maxY);
int minZ = TNT19.floor(this.minZ);
int maxZ = TNT19.floor(this.maxZ);
List<Pos19> poss = new ArrayList<>();
for (int x = minX; x <= maxX; x++) {
for (int y = minY; y <= maxY; y++) {
for (int z = minZ; z <= maxZ; z++) {
poss.add(new Pos19(x, y, z));
}
}
}
return poss;
}
// TODO: This can be optimized by optimizing the x,y,z loop layout
public double run(SimulatorData19 simulatorData) {
if (movement == 0.0) return 0.0;
BoundingBox movementBoundingBox = new BoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
List<Pos19> poss = possibleCollisions();
Double collision = null;
for (Pos19 pos : poss) {
VoxelShape voxelShape = simulatorData.getVoxelShape(pos);
for (BoundingBox boundingBox : voxelShape.getBoundingBoxes()) {
boundingBox = boundingBox.clone().shift(pos.x, pos.y, pos.z);
boolean collides = boundingBox.overlaps(movementBoundingBox);
if (!collides) continue;
double value;
switch (axis) {
case X:
if (movement < 0) {
value = boundingBox.getMaxX();
} else {
value = boundingBox.getMinX() - 0.98;
}
break;
case Y:
if (movement < 0) {
value = boundingBox.getMaxY();
} else {
value = boundingBox.getMinY() - 0.98;
}
break;
case Z:
if (movement < 0) {
value = boundingBox.getMaxZ();
} else {
value = boundingBox.getMinZ() - 0.98;
}
break;
default:
throw new IllegalStateException("Unexpected value: " + axis);
}
if (collision == null) {
collision = value;
} else {
if (movement < 0) {
collision = Math.max(collision, value);
} else {
collision = Math.min(collision, value);
}
}
}
}
if (collision == null) {
return movement;
} else {
switch (axis) {
case X:
// System.out.println(axis + " " + movement + " " + x + " " + collision);
return collision - x;
case Y:
// System.out.println(axis + " " + movement + " " + y + " " + collision);
return collision - y;
case Z:
// System.out.println(axis + " " + movement + " " + z + " " + collision);
return collision - z;
default:
throw new IllegalStateException("Unexpected value: " + axis);
}
}
}
}

Datei anzeigen

@ -1,218 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.simulator.preview;
import org.bukkit.Material;
import org.bukkit.block.data.Waterlogged;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
public class Explosion19 {
private static final double[] FACE_BLOCKS = new double[(16 * 16 * 2 + 14 * 16 * 2 + 14 * 14 * 2) * 3];
static {
int index = 0;
for (int x = 0; x < 16; ++x) {
for (int y = 0; y < 16; ++y) {
for (int z = 0; z < 16; ++z) {
if (x == 0 || x == 15 || y == 0 || y == 15 || z == 0 || z == 15) {
double dX = x / 15.0F * 2.0F - 1.0F;
double dY = y / 15.0F * 2.0F - 1.0F;
double dZ = z / 15.0F * 2.0F - 1.0F;
double length = Math.sqrt(dX * dX + dY * dY + dZ * dZ);
FACE_BLOCKS[index++] = dX / length;
FACE_BLOCKS[index++] = dY / length;
FACE_BLOCKS[index++] = dZ / length;
}
}
}
}
}
private static final Set<Material> WATER_LOGABLE = new HashSet<>();
static {
for (Material material : Material.values()) {
if (Waterlogged.class.isAssignableFrom(material.data)) {
WATER_LOGABLE.add(material);
}
}
}
private static final Random RANDOM = new Random();
private static final float POWER = 4.0F;
private final TNT19 tnt;
private final double x;
private final double y;
private final double z;
public Explosion19(TNT19 tnt, double x, double y, double z) {
this.tnt = tnt;
this.x = x;
this.y = y;
this.z = z;
}
public void calculate(SimulatorData19 simulatorData) {
Set<Pos19> affectedBlocks = new HashSet<>();
for (int i = 0; i < FACE_BLOCKS.length; i += 3) {
double d = FACE_BLOCKS[i + 0];
double e = FACE_BLOCKS[i + 1];
double f = FACE_BLOCKS[i + 2];
float h = POWER * (0.7F + RANDOM.nextFloat() * 0.6F);
double m = x;
double n = y;
double o = z;
for (; h > 0.0F; h -= 0.22500001F) {
int x = TNT19.floor(m);
int y = TNT19.floor(n);
int z = TNT19.floor(o);
Material material = simulatorData.getBlockType(x, y, z);
if (!material.isAir()) {
h -= (material.getBlastResistance() + 0.3F) * 0.3F;
}
if (WATER_LOGABLE.contains(material)) {
Waterlogged waterlogged = (Waterlogged) simulatorData.getBlockData(x, y, z);
if (waterlogged.isWaterlogged()) {
h = 0.0F;
}
}
if (h > 0.0F) {
affectedBlocks.add(new Pos19(x, y, z));
}
m += d * 0.30000001192092896;
n += e * 0.30000001192092896;
o += f * 0.30000001192092896;
}
}
simulatorData.clearBlocks(affectedBlocks);
float q = POWER * 2.0F;
int k = floor(x - q - 1.0D);
int l = floor(x + q + 1.0D);
int r = floor(y - q - 1.0D);
int s = floor(y + q + 1.0D);
int t = floor(z - q - 1.0D);
int u = floor(z + q + 1.0D);
for (TNT19 currentTNT : simulatorData.tntList) {
if (currentTNT == tnt) continue;
if (!(currentTNT.getX() >= k && currentTNT.getY() >= r && currentTNT.getZ() >= t && currentTNT.getX() <= l && currentTNT.getY() <= s && currentTNT.getZ() <= u)) {
continue;
}
double x = currentTNT.getX() - this.x;
double y = currentTNT.getY() - this.y;
double z = currentTNT.getZ() - this.z;
double aa = Math.sqrt(x * x + y * y + z * z);
double w = aa / q;
if (w > 1.0) {
continue;
}
if (aa == 0.0) {
continue;
}
x /= aa;
y /= aa;
z /= aa;
double ab = getExposure(simulatorData, currentTNT.getX(), currentTNT.getY(), currentTNT.getZ());
double ac = (1.0 - w) * ab;
currentTNT.setVx(currentTNT.getVx() + x * ac);
currentTNT.setVy(currentTNT.getVy() + y * ac);
currentTNT.setVz(currentTNT.getVz() + z * ac);
}
}
private static int floor(double value) {
int i = (int) value;
return value < (double) i ? i - 1 : i;
}
private static final double SIZE = 0.98;
private static final double MIN_POINT = 0.01;
private static final double MAX_POINT = SIZE + MIN_POINT;
private static final double EXPOSURE_CONSTANT_1 = 1.0 / (SIZE * 2 + 1.0);
private static final double EXPOSURE_CONSTANT_2 = (1.0 - Math.floor(1.0 / EXPOSURE_CONSTANT_1) * EXPOSURE_CONSTANT_1) / 2.0;
private float getExposure(SimulatorData19 simulatorData, double x, double y, double z) {
float blockMisses = 0;
float blockTotal = 0;
for (double k = 0.0; k <= 1.0; k += EXPOSURE_CONSTANT_1) {
for (double l = 0.0; l <= 1.0; l += EXPOSURE_CONSTANT_1) {
for (double m = 0.0; m <= 1.0; m += EXPOSURE_CONSTANT_1) {
double dx = lerp(k, MIN_POINT, MAX_POINT) + EXPOSURE_CONSTANT_2 + x;
double dy = lerp(l, 0.0, SIZE) + y;
double dz = lerp(m, MIN_POINT, MAX_POINT) + EXPOSURE_CONSTANT_2 + z;
if (rayTrace(simulatorData, dx, dy, dz, this.x, this.y, this.z)) {
blockMisses++;
}
blockTotal++;
}
}
}
return blockMisses / blockTotal;
}
public static double lerp(double delta, double start, double end) {
return start + delta * (end - start);
}
public static boolean rayTrace(SimulatorData19 simulatorData, double sX, double sY, double sZ, double dX, double dY, double dZ) {
double x = sX;
double y = sY;
double z = sZ;
int oX = sX > dX ? -1 : 1;
int oY = sY > dY ? -1 : 1;
int oZ = sZ > dZ ? -1 : 1;
while (true) {
Material material = simulatorData.getBlockType(floor(x), floor(y), floor(z));
if (material != Material.LAVA && material != Material.WATER && material != Material.AIR) {
return true;
}
double cX = x - (floor(x) + oX);
double cY = y - (floor(y) + oY);
double cZ = z - (floor(z) + oZ);
double maxChange = Math.min(Math.abs(cX), Math.min(Math.abs(cY), Math.abs(cZ)));
x += Math.signum(cX) * maxChange;
y += Math.signum(cY) * maxChange;
z += Math.signum(cZ) * maxChange;
if (floor(x) == floor(dX) && floor(y) == floor(dY) && floor(z) == floor(dZ)) {
return false;
}
}
}
}

Datei anzeigen

@ -1,299 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.simulator.preview;
import org.bukkit.Axis;
import org.bukkit.util.BoundingBox;
import org.bukkit.util.VoxelShape;
public class OptimizedAxisMovementLimiter19 {
private Axis axis;
private double movement;
private double minX;
private double maxX;
private double minY;
private double maxY;
private double minZ;
private double maxZ;
private int minIX;
private int maxIX;
private int minIY;
private int maxIY;
private int minIZ;
private int maxIZ;
private BoundingBox movementBoundingBox;
public OptimizedAxisMovementLimiter19(double x, double y, double z, Axis axis, double movement) {
this.axis = axis;
this.movement = movement;
// Calculate the min and max values for the movement
minX = x;
maxX = x + 0.98;
minY = y;
maxY = y + 0.98;
minZ = z;
maxZ = z + 0.98;
switch (axis) {
case X:
if (movement < 0) {
minX += movement;
} else if (movement > 0) {
maxX += movement;
}
break;
case Y:
if (movement < 0) {
minY += movement;
} else if (movement > 0) {
maxY += movement;
}
break;
case Z:
if (movement < 0) {
minZ += movement;
} else if (movement > 0) {
maxZ += movement;
}
break;
}
minIX = TNT19.floor(minX);
maxIX = TNT19.floor(maxX);
minIY = TNT19.floor(minY) - 1;
maxIY = TNT19.floor(maxY);
minIZ = TNT19.floor(minZ);
maxIZ = TNT19.floor(maxZ);
movementBoundingBox = new BoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
}
public double run(SimulatorData19 simulatorData) {
if (movement == 0.0) return 0.0;
switch (axis) {
case X:
if (movement < 0.0) {
return runNX(simulatorData);
} else {
return runPX(simulatorData);
}
case Y:
if (movement < 0.0) {
return runNY(simulatorData);
} else {
return runPY(simulatorData);
}
case Z:
default:
if (movement < 0.0) {
return runNZ(simulatorData);
} else {
return runPZ(simulatorData);
}
}
}
private double runNX(SimulatorData19 simulatorData) {
Double collision = null;
for (int x = maxIX - 1; x >= minIX; x--) {
for (int y = minIY; y < maxIY; y++) {
for (int z = minIZ; z < maxIZ; z++) {
Pos19 pos = new Pos19(x, y, z);
VoxelShape voxelShape = simulatorData.getVoxelShape(pos);
for (BoundingBox boundingBox : voxelShape.getBoundingBoxes()) {
boundingBox = boundingBox.clone().shift(x, y, z);
if (!boundingBox.overlaps(movementBoundingBox)) continue;
double value = boundingBox.getMaxX();
if (collision == null) {
collision = value;
} else {
collision = Math.max(value, collision);
}
}
}
}
if (collision != null) {
break;
}
}
if (collision == null) {
return movement;
}
return movement + (collision - minX);
}
private double runPX(SimulatorData19 simulatorData) {
Double collision = null;
for (int x = minIX; x < maxIX; x++) {
for (int y = minIY; y < maxIY; y++) {
for (int z = minIZ; z < maxIZ; z++) {
Pos19 pos = new Pos19(x, y, z);
VoxelShape voxelShape = simulatorData.getVoxelShape(pos);
for (BoundingBox boundingBox : voxelShape.getBoundingBoxes()) {
boundingBox = boundingBox.clone().shift(x, y, z);
if (!boundingBox.overlaps(movementBoundingBox)) continue;
double value = boundingBox.getMinX() - 0.98;
if (collision == null) {
collision = value;
} else {
collision = Math.min(value, collision);
}
}
}
}
if (collision != null) {
break;
}
}
if (collision == null) {
return movement;
}
return movement + (collision - minX);
}
private double runNY(SimulatorData19 simulatorData) {
Double collision = null;
for (int y = maxIY - 1; y >= minIY; y--) {
for (int x = minIX; x < maxIX; x++) {
for (int z = minIZ; z < maxIZ; z++) {
Pos19 pos = new Pos19(x, y, z);
VoxelShape voxelShape = simulatorData.getVoxelShape(pos);
for (BoundingBox boundingBox : voxelShape.getBoundingBoxes()) {
boundingBox = boundingBox.clone().shift(x, y, z);
if (!boundingBox.overlaps(movementBoundingBox)) continue;
double value = boundingBox.getMaxY();
if (collision == null) {
collision = value;
} else {
collision = Math.max(value, collision);
}
}
}
}
if (collision != null) {
break;
}
}
if (collision == null) {
return movement;
}
return movement + (collision - minY);
}
private double runPY(SimulatorData19 simulatorData) {
Double collision = null;
for (int y = minIY; y < maxIY; y++) {
for (int x = minIX; x < maxIX; x++) {
for (int z = minIZ; z < maxIZ; z++) {
Pos19 pos = new Pos19(x, y, z);
VoxelShape voxelShape = simulatorData.getVoxelShape(pos);
for (BoundingBox boundingBox : voxelShape.getBoundingBoxes()) {
boundingBox = boundingBox.clone().shift(x, y, z);
if (!boundingBox.overlaps(movementBoundingBox)) continue;
double value = boundingBox.getMinY() - 0.98;
if (collision == null) {
collision = value;
} else {
collision = Math.min(value, collision);
}
}
}
}
if (collision != null) {
break;
}
}
if (collision == null) {
return movement;
}
return movement + (collision - minY);
}
private double runNZ(SimulatorData19 simulatorData) {
Double collision = null;
for (int z = maxIZ - 1; z >= minIZ; z--) {
for (int x = minIX; x < maxIX; x++) {
for (int y = minIY; y < maxIY; y++) {
Pos19 pos = new Pos19(x, y, z);
VoxelShape voxelShape = simulatorData.getVoxelShape(pos);
for (BoundingBox boundingBox : voxelShape.getBoundingBoxes()) {
boundingBox = boundingBox.clone().shift(x, y, z);
if (!boundingBox.overlaps(movementBoundingBox)) continue;
double value = boundingBox.getMaxZ();
if (collision == null) {
collision = value;
} else {
collision = Math.max(value, collision);
}
}
}
}
if (collision != null) {
break;
}
}
if (collision == null) {
return movement;
}
return movement + (collision - minZ);
}
private double runPZ(SimulatorData19 simulatorData) {
Double collision = null;
for (int z = minIZ; z < maxIZ; z++) {
for (int x = minIX; x < maxIX; x++) {
for (int y = minIY; y < maxIY; y++) {
Pos19 pos = new Pos19(x, y, z);
VoxelShape voxelShape = simulatorData.getVoxelShape(pos);
for (BoundingBox boundingBox : voxelShape.getBoundingBoxes()) {
boundingBox = boundingBox.clone().shift(x, y, z);
if (!boundingBox.overlaps(movementBoundingBox)) continue;
double value = boundingBox.getMinZ() - 0.98;
if (collision == null) {
collision = value;
} else {
collision = Math.min(value, collision);
}
}
}
}
if (collision != null) {
break;
}
}
if (collision == null) {
return movement;
}
return movement + (collision - minZ);
}
}

Datei anzeigen

@ -1,107 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.simulator.preview;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.simulator.TNTData;
import de.steamwar.bausystem.features.tracer.show.Record;
import de.steamwar.bausystem.shared.Pair;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.util.Vector;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
public class Simulator19 implements Simulator {
protected static final World WORLD = Bukkit.getWorlds().get(0);
@Override
public BukkitTask run(Pair<Integer, Map<Integer, List<List<Pair<TNTData, Integer>>>>> toCalculate, Consumer<PreviewRecord> consumer) { // TODO: Implement multi tick calculation max 40 ms per tick
if (toCalculate == null) return null;
BukkitRunnable bukkitRunnable = new BukkitRunnable() {
private SimulatorData19 simulatorData = new SimulatorData19();
private PreviewRecord previewRecord = new PreviewRecord();
private int currentTick = 0;
private Map<TNT19, Record.TNTRecord> recordMap = new IdentityHashMap<>();
@Override
public void run() {
long time = System.currentTimeMillis();
while (!simulatorData.tntList.isEmpty() || currentTick <= toCalculate.getKey()) {
if (System.currentTimeMillis() - time >= 40) break;
List<List<Pair<TNTData, Integer>>> toSpawnInTick = toCalculate.getValue().get(currentTick);
if (toSpawnInTick != null) {
int finalCurrentTick = currentTick;
toSpawnInTick.forEach(pairs -> {
AtomicBoolean hasSomeLeft = new AtomicBoolean(true);
while(hasSomeLeft.get()) {
hasSomeLeft.set(false);
pairs.forEach(pair -> {
if (pair.getValue() > 0) {
hasSomeLeft.set(true);
TNT19 tnt = new TNT19(pair.getKey().location.getX(), pair.getKey().location.getY(), pair.getKey().location.getZ());
if (!pair.getKey().xVelocity) tnt.setVx(0.0);
if (!pair.getKey().yVelocity) tnt.setVy(0.0);
if (!pair.getKey().zVelocity) tnt.setVz(0.0);
tnt.setFuse(tnt.getFuse());
simulatorData.tntList.add(tnt);
pair.setValue(pair.getValue() - 1);
Record.TNTRecord record = previewRecord.getRecord().spawn(finalCurrentTick);
record.source(pair.getKey().location.toVector(), new Vector(tnt.getVx(), tnt.getVy(), tnt.getVz()), tnt.getFuse());
recordMap.put(tnt, record);
}
});
}
});
}
currentTick++;
List<TNT19> remove = new ArrayList<>();
for (TNT19 tnt : simulatorData.tntList) {
// System.out.println("CALC: " + simulatorData.blockTypesMap.size() + "/" + simulatorData.blockDataMap.size() + "/" + simulatorData.collisionDataMap.size() + "/" + simulatorData.airBlocks.size() + " " + recordMap.size());
if (tnt.tick(simulatorData)) {
remove.add(tnt);
recordMap.remove(tnt).explode(new Vector(tnt.getX(), tnt.getY(), tnt.getZ()), new Vector(tnt.getVx(), tnt.getVy(), tnt.getVz()), tnt.getFuse());
} else {
recordMap.get(tnt).location(new Vector(tnt.getX(), tnt.getY(), tnt.getZ()), new Vector(tnt.getVx(), tnt.getVy(), tnt.getVz()), tnt.getFuse());
}
}
simulatorData.tntList.removeAll(remove);
}
System.out.println("Time: " + (System.currentTimeMillis() - time) + "ms " + simulatorData.blockTypesMap.size() + "/" + simulatorData.blockDataMap.size() + "/" + simulatorData.collisionDataMap.size() + "/" + simulatorData.airBlocks.size() + " " + recordMap.size());
if (simulatorData.tntList.isEmpty() && currentTick > toCalculate.getKey()) {
previewRecord.setDestroyedBlocks(simulatorData.airBlocks());
previewRecord.setAccessedBlocks(simulatorData.accessedBlocks());
consumer.accept(previewRecord);
cancel();
}
}
};
return bukkitRunnable.runTaskTimer(BauSystem.getInstance(), 0, 1);
}
}

Datei anzeigen

@ -1,113 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.simulator.preview;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.util.BoundingBox;
import org.bukkit.util.Vector;
import org.bukkit.util.VoxelShape;
import java.util.*;
import java.util.function.Predicate;
import java.util.stream.Collectors;
public class SimulatorData19 {
private static final BlockData AIR_BLOCK_DATA = Material.AIR.createBlockData();
private static final VoxelShape AIR_VOXEL_SHAPE = new VoxelShape() {
@Override
public Collection<BoundingBox> getBoundingBoxes() {
return Collections.emptyList();
}
@Override
public boolean overlaps(BoundingBox boundingBox) {
return false;
}
};
long accessed = 0;
long cacheMisses = 0;
long aired = 0;
final List<TNT19> tntList = new ArrayList<>();
final Set<Pos19> airBlocks = new HashSet<>();
final Map<Pos19, Material> blockTypesMap = new HashMap<>();
final Map<Pos19, BlockData> blockDataMap = new HashMap<>();
final Map<Pos19, VoxelShape> collisionDataMap = new HashMap<>();
public Material getBlockType(int x, int y, int z) { // Get BlockType of Chunk Data array?
accessed++;
Pos19 pos = new Pos19(x, y, z);
if (airBlocks.contains(pos)) {
return Material.AIR;
}
return blockTypesMap.computeIfAbsent(pos, v -> {
cacheMisses++;
return Simulator19.WORLD.getBlockAt(x, y, z).getType();
});
}
public BlockData getBlockData(int x, int y, int z) {
accessed++;
Pos19 pos = new Pos19(x, y, z);
if (airBlocks.contains(pos)) {
return AIR_BLOCK_DATA;
}
return blockDataMap.computeIfAbsent(pos, v -> {
cacheMisses++;
return Simulator19.WORLD.getBlockAt(x, y, z).getBlockData();
});
}
public VoxelShape getVoxelShape(Pos19 pos) {
accessed++;
if (airBlocks.contains(pos)) {
return AIR_VOXEL_SHAPE;
}
return collisionDataMap.computeIfAbsent(pos, v -> {
cacheMisses++;
return Simulator19.WORLD.getBlockAt(pos.x, pos.y, pos.z).getCollisionShape();
});
}
public void clearBlock(Pos19 pos) {
aired++;
airBlocks.add(pos);
blockTypesMap.remove(pos);
blockDataMap.remove(pos);
collisionDataMap.remove(pos);
}
public void clearBlocks(Set<Pos19> poss) {
poss.forEach(this::clearBlock);
}
public Set<Vector> airBlocks() {
return airBlocks.stream().map(pos -> new Vector(pos.x, pos.y, pos.z)).collect(Collectors.toSet());
}
public Predicate<Vector> accessedBlocks() {
return vector -> {
Pos19 pos = new Pos19(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
return airBlocks.contains(pos) || blockTypesMap.containsKey(pos) || blockDataMap.containsKey(pos) || collisionDataMap.containsKey(pos);
};
}
}

Datei anzeigen

@ -1,327 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.simulator.preview;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.world.level.RayTrace;
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.Vec3D;
import org.bukkit.Axis;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.*;
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
import org.bukkit.util.Vector;
import java.util.Random;
@Getter
@Setter
public class TNT19 {
private static final Random R = new Random();
// Bottom left corner
private double x;
private double y;
private double z;
private double vx;
private double vy;
private double vz;
private int fuse;
private boolean onGround = false;
private float fallDistance = 0;
private boolean horizontalCollision = false;
private boolean verticalCollision = false;
private Vector movementMultiplier = new Vector(0, 0, 0);
public TNT19(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
double seed = R.nextDouble() * 6.2831854820251465;
this.vx = -Math.sin(seed) * 0.02;
this.vy = 0.20000000298023224;
this.vz = -Math.cos(seed) * 0.02;
this.fuse = 80;
}
public boolean tick(SimulatorData19 simulatorData) {
this.vy -= 0.04;
move(simulatorData, new Vector(this.vx, this.vy, this.vz));
this.vx *= 0.98;
this.vy *= 0.98;
this.vz *= 0.98;
if (onGround) {
this.vx *= 0.7;
this.vy *= -0.5;
this.vz *= 0.7;
}
this.fuse--;
if (this.fuse <= 0) {
Explosion19 explosion = new Explosion19(this, x, y + 0.98 * 0.0625, z);
explosion.calculate(simulatorData);
return true;
} else {
// TODO: Update Water and Lava Flowing
}
return false;
}
private void move(SimulatorData19 simulatorData, Vector movement) {
if (movementMultiplier.lengthSquared() > 1.0E-7) {
movement.multiply(movementMultiplier);
movementMultiplier = new Vector(0, 0, 0);
vx = 0;
vy = 0;
vz = 0;
}
Vector vec3d = adjustMovementForCollisions(simulatorData, movement);
// System.out.println(movement + " " + vec3d);
double lengthSquared = vec3d.lengthSquared();
if (lengthSquared > 1.0E-7) {
if (fallDistance != 0.0F && lengthSquared >= 1.0) {
// TODO: This could be wrong
MovingObjectPosition movingObjectPosition = ((CraftWorld) Simulator19.WORLD).getHandle().a(new RayTrace(new Vec3D(x, y, z), new Vec3D(x + vec3d.getX(), y + vec3d.getY(), z + vec3d.getZ()), RayTrace.BlockCollisionOption.d, RayTrace.FluidCollisionOption.d, null));
if (movingObjectPosition.c() != MovingObjectPosition.EnumMovingObjectType.a) {
onLanding();
}
}
this.x += vec3d.getX();
this.y += vec3d.getY();
this.z += vec3d.getZ();
}
boolean bl = !approximatelyEquals(movement.getX(), vec3d.getX());
boolean bl2 = !approximatelyEquals(movement.getZ(), vec3d.getZ());
this.horizontalCollision = bl || bl2;
this.verticalCollision = movement.getY() != vec3d.getY();
this.onGround = this.verticalCollision && movement.getY() < 0.0D;
Vector blockPos = getLandingPos(simulatorData);
Material material = simulatorData.getBlockType(blockPos.getBlockX(), blockPos.getBlockY(), blockPos.getBlockZ());
BlockData blockData = simulatorData.getBlockData(blockPos.getBlockX(), blockPos.getBlockY(), blockPos.getBlockZ());
fall(vec3d.getY(), onGround);
if (horizontalCollision) {
this.vx = bl ? 0.0 : this.vx;
this.vz = bl2 ? 0.0 : this.vz;
}
if (movement.getY() != vec3d.getY()) {
if (material == Material.SLIME_BLOCK) {
if (this.vy < 0.0) {
this.vy = -this.vy * 0.8;
}
} else if (blockData instanceof Bed) {
if (this.vy < 0.0) {
this.vy = -this.vy * 0.6600000262260437 * 0.8;
}
} else {
this.vy = 0.0;
}
}
if (onGround && material == Material.SLIME_BLOCK) {
double cy = Math.abs(this.vy);
if (cy < 0.1) {
double cy2 = 0.4 + cy * 0.2;
this.vx = vx * cy2;
this.vz = vz * cy2;
}
}
checkBlockCollision(simulatorData);
float j = this.getVelocityMultiplier(simulatorData);
this.vx *= j;
this.vz *= j;
}
private Vector adjustMovementForCollisions(SimulatorData19 simulatorData, Vector movement) {
if (movement.lengthSquared() == 0.0) {
return movement;
}
double mY = new AxisMovementLimiter19(x, y, z, Axis.Y, movement.getY()).run(simulatorData);
boolean bl = Math.abs(movement.getX()) < Math.abs(movement.getZ());
if (bl) {
double mZ = new AxisMovementLimiter19(x, y + mY, z, Axis.Z, movement.getZ()).run(simulatorData);
double mX = new AxisMovementLimiter19(x, y + mY, z + mZ, Axis.X, movement.getX()).run(simulatorData);
return new Vector(mX, mY, mZ);
} else {
double mX = new AxisMovementLimiter19(x, y + mY, z, Axis.X, movement.getX()).run(simulatorData);
double mZ = new AxisMovementLimiter19(x + mX, y + mY, z, Axis.Z, movement.getZ()).run(simulatorData);
return new Vector(mX, mY, mZ);
}
}
private boolean approximatelyEquals(double a, double b) {
return Math.abs(b - a) < 9.999999747378752E-6;
}
public static int floor(double value) {
int i = (int)value;
return value < (double)i ? i - 1 : i;
}
private Vector getLandingPos(SimulatorData19 simulatorData) {
int x = floor(this.x);
int y = floor(this.y - 0.2F);
int z = floor(this.z);
if (simulatorData.getBlockType(x, y, z).isAir()) {
BlockData blockData = simulatorData.getBlockData(x, y - 1, z);
if (blockData instanceof Fence || blockData instanceof Wall || blockData instanceof Gate) {
return new Vector(x, y - 1, z);
}
}
return new Vector(x, y, z);
}
private void fall(double heightDifference, boolean onGround) {
if (onGround) {
if (fallDistance > 0.0F) {
// TODO: onLandedUpon
}
this.onLanding();
} else if (heightDifference < 0.0) {
this.fallDistance -= (float)heightDifference;
}
}
private void checkBlockCollision(SimulatorData19 simulatorData) {
int x1 = floor(x + 1.0E-7);
int y1 = floor(y + 1.0E-7);
int z1 = floor(z + 1.0E-7);
int x2 = floor(x + 0.98 - 1.0E-7);
int y2 = floor(y + 0.98 - 1.0E-7);
int z2 = floor(z + 0.98 - 1.0E-7);
for (int x = x1; x <= x2; x++) {
for (int y = y1; y <= y2; y++) {
for (int z = z1; z <= z2; z++) {
Material material = simulatorData.getBlockType(x, y, z);
if (material == Material.POWDER_SNOW) {
slowMovement(new Vector(0.8999999761581421, 1.5, 0.8999999761581421));
} else if (material == Material.HONEY_BLOCK) {
if (isSliding(new Vector(x, y, z))) {
updateSlidingVelocity();
}
} else if (material == Material.COBWEB) {
slowMovement(new Vector(0.25, 0.05000000074505806, 0.25));
} else if (material == Material.BUBBLE_COLUMN) {
boolean drag = ((BubbleColumn) simulatorData.getBlockData(x, y, z)).isDrag();
if (simulatorData.getBlockType(x, y + 1, z).isAir()) {
if (drag) {
this.vy = Math.max(-0.9, vy - 0.03);
} else {
this.vy = Math.min(1.8, vy + 0.1);
}
} else {
if (drag) {
this.vy = Math.max(-0.3, vy - 0.03);
} else {
this.vy = Math.min(0.7, vy + 0.06);
}
onLanding();
}
}
}
}
}
}
private void slowMovement(Vector movementMultiplier) {
onLanding();
this.movementMultiplier = movementMultiplier;
}
private void updateSlidingVelocity() {
if (vy < -0.13) {
double d = -0.05 / vy;
vx *= d;
vz *= d;
}
vy = -0.05;
onLanding();
}
private boolean isSliding(Vector pos) {
if (onGround) return false;
if (y > pos.getY() + 0.9375 - 1.0E-7) return false;
if (vy >= -0.08) return false;
double d = Math.abs(pos.getX() + 0.5 - x);
double e = Math.abs(pos.getZ() + 0.5 - z);
double f = 0.4375 + 0.98 / 2.0;
return d + 1.0E-7 > f || e + 1.0E-7 > f;
}
private float getVelocityMultiplier(SimulatorData19 simulatorData) {
Material material = simulatorData.getBlockType(floor(x), floor(y), floor(z));
float f = 1F;
if (material == Material.SOUL_SAND) {
f = 0.5F;
} else if (material == Material.HONEY_BLOCK) {
f = 0.4F;
}
if (material != Material.WATER && material != Material.BUBBLE_COLUMN) {
if (f != 1) return f;
material = simulatorData.getBlockType(floor(x), floor(y - 0.5000001), floor(z));
if (material == Material.SOUL_SAND) {
f = 0.5F;
} else if (material == Material.HONEY_BLOCK) {
f = 0.4F;
}
}
return f;
}
private void onLanding() {
this.fallDistance = 0.0F;
}
@Override
public String toString() {
return "TNT{" +
"x=" + x +
", y=" + y +
", z=" + z +
", vx=" + vx +
", vy=" + vy +
", vz=" + vz +
", fuse=" + fuse +
'}';
}
}

Datei anzeigen

@ -73,39 +73,6 @@ public class NMSWrapper19 implements NMSWrapper {
player.updateInventory();
}
@Override
public void init(LongSupplier longSupplier) {
SystemUtils.a = () -> System.nanoTime() + longSupplier.getAsLong();
}
private static final List<Packet<?>> packets = new ArrayList<>();
private static final Vec3D noMotion = new Vec3D(0, 0, 0);
@Override
public void createTickCache(World world) {
packets.clear();
world.getEntities().stream().filter(entity -> !(entity instanceof Player)).forEach(entity -> {
packets.add(new PacketPlayOutEntityVelocity(entity.getEntityId(), noMotion));
packets.add(new PacketPlayOutEntityTeleport(((CraftEntity) entity).getHandle()));
if (entity instanceof TNTPrimed) {
net.minecraft.world.entity.Entity serverEntity = ((CraftEntity) entity).getHandle();
List<DataWatcher.b<?>> list = serverEntity.al().c();
if(list != null)
packets.add(new PacketPlayOutEntityMetadata(serverEntity.ah(), list));
}
});
}
@Override
public void sendTickPackets() {
Bukkit.getOnlinePlayers().forEach(player -> {
for (Packet<?> p : packets) {
TinyProtocol.instance.sendPacket(player, p);
}
});
}
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
@Override

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bausystem.utils;
import com.comphenix.tinyprotocol.Reflection;
import net.minecraft.network.protocol.game.PacketPlayInFlying;
import net.minecraft.server.level.EntityPlayer;
import org.bukkit.Location;
@ -31,50 +32,30 @@ import java.util.UUID;
public class PlayerMovementWrapper19 implements PlayerMovementWrapper {
private static class Position {
private double x;
private double y;
private double z;
private float yaw;
private float pitch;
}
private Map<UUID, Position> playerLocationMap = new HashMap<>();
@Override
public void setPosition(Player player, Object object) {
Position position = playerLocationMap.computeIfAbsent(player.getUniqueId(), uuid -> {
Position pos = new Position();
Location location = player.getLocation();
pos.x = location.getX();
pos.y = location.getY();
pos.z = location.getZ();
pos.yaw = location.getYaw();
pos.pitch = location.getPitch();
return pos;
});
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
if (packetPlayInFlying.h) {
entityPlayer.b(packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c, packetPlayInFlying.d, packetPlayInFlying.e);
position.x = packetPlayInFlying.a;
position.y = packetPlayInFlying.b;
position.z = packetPlayInFlying.c;
position.yaw = packetPlayInFlying.d;
position.pitch = packetPlayInFlying.e;
} else {
entityPlayer.e(packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c);
position.x = packetPlayInFlying.a;
position.y = packetPlayInFlying.b;
position.z = packetPlayInFlying.c;
}
}
@Override
public void disable(Player player) {
Position position = playerLocationMap.remove(player.getUniqueId());
if (position != null) {
player.teleport(new Location(player.getWorld(), position.x, position.y, position.z, position.yaw, position.pitch));
public Object convertToOut(Player player, Object object) {
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
Object packet = Reflection.newInstance(teleportPacket);
teleportEntity.set(packet, player.getEntityId());
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c);
if (packetPlayInFlying.h) {
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw()));
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
} else {
teleportYaw.set(packet, rotToByte(packetPlayInFlying.d));
teleportPitch.set(packet, rotToByte(packetPlayInFlying.e));
}
return packet;
}
}

Datei anzeigen

@ -0,0 +1,51 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.utils;
import com.destroystokyo.paper.event.server.ServerTickEndEvent;
import com.destroystokyo.paper.event.server.ServerTickStartEvent;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.tpslimit.TPSFreezeUtils;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class TickListener19 implements TickListener, Listener {
private boolean tickStartRan = false;
public TickListener19() {
Bukkit.getPluginManager().registerEvents(this, BauSystem.getInstance());
}
@EventHandler
public void onServerTickStart(ServerTickStartEvent event) {
if (TPSFreezeUtils.isFrozen()) return;
Bukkit.getPluginManager().callEvent(new TickStartEvent());
tickStartRan = true;
}
@EventHandler
public void onServerTickEnd(ServerTickEndEvent event) {
if (!tickStartRan) return;
Bukkit.getPluginManager().callEvent(new TickEndEvent());
tickStartRan = false;
}
}

Datei anzeigen

@ -27,8 +27,8 @@ version '1.0'
compileJava.options.encoding = 'UTF-8'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17
sourceSets {
main {

Datei anzeigen

@ -20,32 +20,23 @@
package de.steamwar.bausystem.utils;
import com.comphenix.tinyprotocol.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.features.util.NoClipCommand;
import net.minecraft.SystemUtils;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.*;
import net.minecraft.network.syncher.DataWatcher;
import net.minecraft.network.protocol.game.PacketPlayInSetCreativeSlot;
import net.minecraft.network.protocol.game.PacketPlayOutExplosion;
import net.minecraft.network.protocol.game.PacketPlayOutGameStateChange;
import net.minecraft.server.level.PlayerInteractManager;
import net.minecraft.world.level.EnumGamemode;
import net.minecraft.world.phys.Vec3D;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.List;
import java.util.function.LongSupplier;
public class NMSWrapper20 implements NMSWrapper {
@ -54,7 +45,7 @@ public class NMSWrapper20 implements NMSWrapper {
@Override
@SuppressWarnings("deprecation")
public void setInternalGameMode(Player player, GameMode gameMode) {
playerGameMode.set(((CraftPlayer) player).getHandle().d, EnumGamemode.a(gameMode.getValue()));
playerGameMode.set(((CraftPlayer) player).getHandle().e, EnumGamemode.a(gameMode.getValue()));
}
@Override
@ -73,39 +64,6 @@ public class NMSWrapper20 implements NMSWrapper {
player.updateInventory();
}
@Override
public void init(LongSupplier longSupplier) {
SystemUtils.a = () -> System.nanoTime() + longSupplier.getAsLong();
}
private static final List<Packet<?>> packets = new ArrayList<>();
private static final Vec3D noMotion = new Vec3D(0, 0, 0);
@Override
public void createTickCache(World world) {
packets.clear();
world.getEntities().stream().filter(entity -> !(entity instanceof Player)).forEach(entity -> {
packets.add(new PacketPlayOutEntityVelocity(entity.getEntityId(), noMotion));
packets.add(new PacketPlayOutEntityTeleport(((CraftEntity) entity).getHandle()));
if (entity instanceof TNTPrimed) {
net.minecraft.world.entity.Entity serverEntity = ((CraftEntity) entity).getHandle();
List<DataWatcher.b<?>> list = serverEntity.aj().c();
if(list != null)
packets.add(new PacketPlayOutEntityMetadata(serverEntity.af(), list));
}
});
}
@Override
public void sendTickPackets() {
Bukkit.getOnlinePlayers().forEach(player -> {
for (Packet<?> p : packets) {
TinyProtocol.instance.sendPacket(player, p);
}
});
}
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
@Override

Datei anzeigen

@ -0,0 +1,43 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.utils;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
public class PlaceItemWrapper20 implements PlaceItemWrapper {
public PlaceItemWrapper20() {
for (Material material : Material.values()) {
if (!material.isBlock()) continue;
if (material.isLegacy()) continue;
BlockData blockData = material.createBlockData();
Material placementMaterial = blockData.getPlacementMaterial();
if (material == placementMaterial) continue;
if (placementMaterial == Material.AIR) continue;
if (placementMaterial.isItem() && !placementMaterial.isBlock()) {
ITEM_MATERIAL_TO_BLOCK_MATERIAL.put(placementMaterial, material);
}
if (material.name().contains("WALL")) {
BLOCK_MATERIAL_TO_WALL_BLOCK_MATERIAL.put(placementMaterial, material);
}
}
}
}

Datei anzeigen

@ -19,7 +19,9 @@
package de.steamwar.bausystem.utils;
import com.comphenix.tinyprotocol.Reflection;
import net.minecraft.network.protocol.game.PacketPlayInFlying;
import net.minecraft.network.protocol.game.PacketPlayOutEntityTeleport;
import net.minecraft.server.level.EntityPlayer;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
@ -31,50 +33,30 @@ import java.util.UUID;
public class PlayerMovementWrapper20 implements PlayerMovementWrapper {
private static class Position {
private double x;
private double y;
private double z;
private float yaw;
private float pitch;
}
private Map<UUID, Position> playerLocationMap = new HashMap<>();
@Override
public void setPosition(Player player, Object object) {
Position position = playerLocationMap.computeIfAbsent(player.getUniqueId(), uuid -> {
Position pos = new Position();
Location location = player.getLocation();
pos.x = location.getX();
pos.y = location.getY();
pos.z = location.getZ();
pos.yaw = location.getYaw();
pos.pitch = location.getPitch();
return pos;
});
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
if (packetPlayInFlying.h) {
entityPlayer.b(packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c, packetPlayInFlying.d, packetPlayInFlying.e);
position.x = packetPlayInFlying.a;
position.y = packetPlayInFlying.b;
position.z = packetPlayInFlying.c;
position.yaw = packetPlayInFlying.d;
position.pitch = packetPlayInFlying.e;
} else {
entityPlayer.e(packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c);
position.x = packetPlayInFlying.a;
position.y = packetPlayInFlying.b;
position.z = packetPlayInFlying.c;
}
}
@Override
public void disable(Player player) {
Position position = playerLocationMap.remove(player.getUniqueId());
if (position != null) {
player.teleport(new Location(player.getWorld(), position.x, position.y, position.z, position.yaw, position.pitch));
public Object convertToOut(Player player, Object object) {
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
Object packet = Reflection.newInstance(teleportPacket);
teleportEntity.set(packet, player.getEntityId());
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c);
if (packetPlayInFlying.h) {
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw()));
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
} else {
teleportYaw.set(packet, rotToByte(packetPlayInFlying.d));
teleportPitch.set(packet, rotToByte(packetPlayInFlying.e));
}
return packet;
}
}

Datei anzeigen

@ -27,8 +27,8 @@ version '1.0'
compileJava.options.encoding = 'UTF-8'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17
sourceSets {
main {

Datei anzeigen

@ -35,6 +35,6 @@ public class ScoreboardElement_GENERIC implements LinkageType {
@Override
public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) {
buildPlan.addImport("de.steamwar.bausystem.features.world.BauScoreboard");
methodBuilder.addLine("BauScoreboard.ELEMENTS.add(" + s + ");");
methodBuilder.addLine("BauScoreboard.addElement(" + s + ");");
}
}

Datei anzeigen

@ -1,40 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.linkage.types;
import de.steamwar.linkage.LinkageType;
import de.steamwar.linkage.plan.BuildPlan;
import de.steamwar.linkage.plan.MethodBuilder;
import javax.lang.model.element.TypeElement;
public class SmartPlaceBehaviour_GENERIC implements LinkageType {
@Override
public String method() {
return "linkSmartPlace";
}
@Override
public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) {
buildPlan.addImport("de.steamwar.bausystem.features.smartplace.SmartPlaceListener");
methodBuilder.addLine("SmartPlaceListener.add(" + s + ");");
}
}

Datei anzeigen

@ -27,8 +27,8 @@ version '1.0'
compileJava.options.encoding = 'UTF-8'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17
sourceSets {
main {
@ -54,16 +54,16 @@ dependencies {
implementation project(":BauSystem_Linkage")
annotationProcessor project(":BauSystem_Linkage")
compileOnly 'org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT'
compileOnly 'org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT'
compileOnly 'com.mojang:authlib:1.5.25'
compileOnly 'io.netty:netty-all:4.1.68.Final'
compileOnly swdep('Spigot-1.19')
// compileOnly swdep('WorldEdit-1.15')
compileOnly swdep('Spigot-1.20')
compileOnly swdep('SpigotCore')
annotationProcessor swdep('SpigotCore')
compileOnly swdep('FastAsyncWorldEdit-1.18')
compileOnly swdep('AxiomPaper')
implementation 'org.luaj:luaj-jse:3.0.1'
}

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -21,20 +21,20 @@ package de.steamwar.bausystem;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.bausystem.features.tpslimit.FreezeUtils;
import de.steamwar.bausystem.features.tpslimit.TPSLimitUtils;
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.bausystem.features.tpslimit.TPSWarpUtils;
import de.steamwar.bausystem.features.world.RamUsage;
import de.steamwar.bausystem.features.tpslimit.TPSFreezeUtils;
import de.steamwar.bausystem.linkage.LinkageUtils;
import de.steamwar.bausystem.region.loader.PrototypeLoader;
import de.steamwar.bausystem.region.loader.RegionLoader;
import de.steamwar.bausystem.region.loader.Updater;
import de.steamwar.bausystem.utils.TickListener;
import de.steamwar.bausystem.worlddata.WorldData;
import de.steamwar.bausystem.linkage.LinkageUtils;
import de.steamwar.command.AbstractValidator;
import de.steamwar.command.SWCommandUtils;
import de.steamwar.message.Message;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
@ -52,16 +52,13 @@ public class BauSystem extends JavaPlugin implements Listener {
// This should be treated as final!
public static Message MESSAGE;
public static final boolean DEV_SERVER = !System.getProperty("user.home").endsWith("minecraft");
@Getter
private static BauSystem instance;
private World world;
@Override
public void onEnable() {
world = Bukkit.getWorlds().get(0);
// LOGGER
fixLogging();
@ -76,31 +73,40 @@ public class BauSystem extends JavaPlugin implements Listener {
} catch (SecurityException e) {
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e);
Bukkit.shutdown();
System.exit(1);
return;
}
new Updater(PrototypeLoader.file, PrototypeLoader::load);
new Updater(RegionLoader.file, RegionLoader::load);
LinkageUtils.link();
RamUsage.init();
SWCommandUtils.addValidator(Player.class, validator(Permission.BUILD));
SWCommandUtils.addValidator(CommandSender.class, validator(Permission.BUILD));
SWCommandUtils.addValidator("supervisor", validator(Permission.SUPERVISOR));
SWCommandUtils.addValidator("owner", validator(Permission.OWNER));
// This could disable any watchdog stuff. We need to investigate if this is a problem.
/*
Thread thread = new Thread(() -> {
while (true) {
WatchdogThread.tick();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
try {
LinkageUtils.link();
} catch (Exception e) {
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e);
Bukkit.shutdown();
System.exit(1);
return;
}
TickListener.impl.init();
}
private <T extends CommandSender> AbstractValidator<T, ?> validator(Permission permission) {
return (commandSender, object, messageSender) -> {
if (commandSender instanceof Player) {
if (permission.hasPermission((Player) commandSender)) {
return true;
}
messageSender.send("NO_PERMISSION");
return false;
}
});
thread.setName("WatchdogThread ticker");
thread.setDaemon(true);
thread.start();
*/
return true;
};
}
@Override
@ -139,7 +145,7 @@ public class BauSystem extends JavaPlugin implements Listener {
@Override
public void run() {
if (FreezeUtils.isFrozen()) return;
if (TPSFreezeUtils.isFrozen()) return;
if (counter >= delay) {
runnable.run();
cancel();
@ -157,7 +163,7 @@ public class BauSystem extends JavaPlugin implements Listener {
@Override
public void run() {
if (FreezeUtils.isFrozen()) return;
if (TPSFreezeUtils.isFrozen()) return;
if (counter >= (first ? delay : period)) {
first = false;
runnable.run();

Datei anzeigen

@ -20,72 +20,77 @@
package de.steamwar.bausystem;
import de.steamwar.bausystem.config.BauServer;
import de.steamwar.command.CommandMetaData;
import de.steamwar.command.TypeValidator;
import de.steamwar.bausystem.features.world.BauMemberUpdate;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.SteamwarUser;
import lombok.AllArgsConstructor;
import org.bukkit.command.CommandSender;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Predicate;
@AllArgsConstructor
public enum Permission {
WORLD(BauweltMember::isWorld),
WORLDEDIT(BauweltMember::isWorldEdit),
MEMBER(bauweltMember -> true),
OWNER(bauweltMember -> false);
OWNER(bauweltMember -> false),
SUPERVISOR(bauweltMember -> {
return bauweltMember.isSupervisor();
}),
BUILD(bauweltMember -> {
if (isTempOnlySpectator(bauweltMember)) return false;
return bauweltMember.isBuild() || SUPERVISOR.permissionPredicate.test(bauweltMember);
}),
/**
* Only used for {@link BauMemberUpdate}
*/
REAL_SPECTATOR(bauweltMember -> {
return !bauweltMember.isBuild() && !bauweltMember.isSupervisor();
}),
/**
* Primarily used for {@link de.steamwar.bausystem.linkage.specific.GuiItem}
*/
MEMBER(bauweltMember -> {
return true;
});
private static final Set<Integer> TEMP_ONLY_SPECTATOR = new HashSet<>();
private static boolean isTempOnlySpectator(BauweltMember bauweltMember) {
return TEMP_ONLY_SPECTATOR.contains(bauweltMember.getMemberID());
}
public static boolean isTempOnlySpectator(Player player) {
return TEMP_ONLY_SPECTATOR.contains(SteamwarUser.get(player.getUniqueId()).getId());
}
public static void forceOnlySpectator(Player player) {
TEMP_ONLY_SPECTATOR.add(SteamwarUser.get(player.getUniqueId()).getId());
BauMemberUpdate.baumemberUpdate();
}
/**
* Only used by {@link BauMemberUpdate}
*/
public static void removeForceOnlySpectator(Player player) {
TEMP_ONLY_SPECTATOR.remove(SteamwarUser.get(player.getUniqueId()).getId());
}
private final Predicate<BauweltMember> permissionPredicate;
public boolean hasPermission(BauweltMember bauweltMember) {
if (bauweltMember == null) return false;
return permissionPredicate.test(bauweltMember);
}
public boolean hasPermission(Player member) {
if (member.getUniqueId().equals(BauServer.getInstance().getOwner())) {
return true;
}
BauweltMember bauMember = BauweltMember.getBauMember(BauServer.getInstance().getOwner(), member.getUniqueId());
if (bauMember == null) {
return false;
}
return permissionPredicate.test(bauMember);
}
public static boolean hasPermission(Player member, Permission permission) {
return permission.hasPermission(member);
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
@CommandMetaData.Parameter({Player.class})
@CommandMetaData.ImplicitValidator(handler = Perm.Handler.class, order = -10)
public @interface Perm {
Permission value();
String message() default "";
class Handler implements TypeValidator<Player> {
private Permission permission;
private String message;
public Handler(Perm perm) {
this.permission = perm.value();
this.message = perm.message();
if (message != null && message.isEmpty()) message = null;
}
@Override
public boolean validate(CommandSender commandSender, Player player, MessageSender messageSender) {
if (message == null) {
return permission.hasPermission(player);
}
return !messageSender.send(!permission.hasPermission((Player) commandSender), message);
}
if (SteamwarUser.get(member.getUniqueId()).getId() == BauServer.getInstance().getOwnerID()) {
return this != REAL_SPECTATOR;
}
BauweltMember bauweltMember = BauweltMember.getBauMember(BauServer.getInstance().getOwner(), member.getUniqueId());
if (bauweltMember == null) return this == REAL_SPECTATOR;
return permissionPredicate.test(bauweltMember);
}
}

Datei anzeigen

@ -97,7 +97,7 @@ public class Config implements Listener {
public void saveAll() {
playerConfigurations.forEach((uuid, yapionObject) -> {
String string = yapionObject.toYAPION(new StringOutput()).getResult();
String string = yapionObject.toYAPION(new StringOutput()).getResult().replaceAll("\\+", "\\");
UserConfig.updatePlayerConfig(uuid, "bausystem", string);
});
playerConfigurations.clear();
@ -112,7 +112,7 @@ public class Config implements Listener {
UUID uuid = player.getUniqueId();
if (playerConfigurations.containsKey(uuid)) {
YAPIONObject yapionObject = playerConfigurations.get(uuid);
String string = yapionObject.toYAPION(new StringOutput()).getResult();
String string = yapionObject.toYAPION(new StringOutput()).getResult().replaceAll("\\\\+", "\\\\");
UserConfig.updatePlayerConfig(uuid, "bausystem", string);
}
}

Datei anzeigen

@ -44,7 +44,7 @@ public class AttributeRemoveCommand extends SWCommand {
@Register({"all"})
@Register({"*"})
public void genericCommand(Player player) {
public void genericCommand(@Validator Player player) {
ItemStack itemStack = player.getInventory().getItemInMainHand();
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setLore(new ArrayList<>());
@ -53,7 +53,7 @@ public class AttributeRemoveCommand extends SWCommand {
}
@Register(description = "ATTRIBUTE_REMOVE_COMMAND_HELP")
public void genericCommand(Player player, @Mapper("attribute") String attribute) {
public void genericCommand(@Validator Player player, @Mapper("attribute") String attribute) {
ItemStack itemStack = player.getInventory().getItemInMainHand();
ItemMeta itemMeta = itemStack.getItemMeta();
if (itemMeta == null) {
@ -73,7 +73,7 @@ public class AttributeRemoveCommand extends SWCommand {
BauSystem.MESSAGE.send("ATTRIBUTE_REMOVE_NOT_FOUND", player);
return;
}
lore.removeIf(s -> s.equals("§8-§7 " + attribute));
lore.removeIf(s -> s.startsWith("§8-§7 " + attribute + "§8:"));
if (lore.size() == 1) {
itemStack.setItemMeta(null);
} else {
@ -99,15 +99,13 @@ public class AttributeRemoveCommand extends SWCommand {
return lore.stream()
.skip(1)
.map(s1 -> s1.substring(6))
.map(s1 -> s1.replace('§', '&'))
.map(s1 -> s1.replace(' ', '_'))
.map(s1 -> s1.substring(0, s1.indexOf("§8:")))
.collect(Collectors.toList());
}
@Override
public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
return s.replace('_', ' ')
.replace('&', '§');
return s;
}
};
}

Datei anzeigen

@ -41,7 +41,7 @@ public class AttributesCopyCommand extends SWCommand {
}
@Register
public void genericCommand(Player player) {
public void genericCommand(@Validator Player player) {
Block block = player.getTargetBlockExact(8, FluidCollisionMode.ALWAYS);
if (block == null) return;
ItemStack mainHand = player.getInventory().getItemInMainHand();

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.attributescopy;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@ -40,6 +41,7 @@ public class AttributesPlaceListener implements Listener {
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
ItemStack itemStack = event.getItemInHand();
ItemMeta itemMeta = itemStack.getItemMeta();
if (itemMeta == null) return;

Datei anzeigen

@ -32,7 +32,7 @@ public class AutoStartCommand extends SWCommand {
}
@Register(description = "AUTOSTART_COMMAND_HELP")
public void genericCommand(Player p) {
public void genericCommand(@Validator Player p) {
SWUtils.giveItemToPlayer(p, AutostartListener.getWandItem(p));
}
}

Datei anzeigen

@ -50,6 +50,6 @@ public class AutoStartGuiItem extends BauGuiItem {
@Override
public Permission permission() {
return Permission.MEMBER;
return Permission.BUILD;
}
}

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.autostart;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils;
@ -29,19 +30,22 @@ import de.steamwar.bausystem.utils.ItemUtils;
import de.steamwar.inventory.SWItem;
import de.steamwar.linkage.Linked;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.data.type.Chest;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
@Linked
public class AutostartListener implements Listener {
@ -64,15 +68,42 @@ public class AutostartListener implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
if (!ItemUtils.isItem(event.getItem(), "autostart")) {
return;
}
if (event.getClickedBlock() == null) {
return;
}
if (event.getClickedBlock().getBlockData() instanceof Chest) {
return;
}
if (event.getClickedBlock().getType() == Material.BEDROCK) {
event.getClickedBlock().setType(Material.SLIME_BLOCK);
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
event.getClickedBlock().setType(Material.BEDROCK, false);
}, 1);
}
activate(event.getPlayer());
}
@EventHandler
public void onInventoryClose(InventoryCloseEvent event) {
if (!(event.getPlayer() instanceof Player)) {
return;
}
if(!Permission.BUILD.hasPermission((Player) event.getPlayer())) return;
if (!ItemUtils.isItem(event.getPlayer().getInventory().getItemInMainHand(), "autostart")) {
return;
}
if (event.getInventory().getLocation() == null) {
return;
}
if (event.getInventory().getLocation().getBlock().getBlockData() instanceof Chest) {
activate((Player) event.getPlayer());
}
}
public void activate(Player player) {
Region region = Region.getRegion(player.getLocation());
if (region.isGlobal()) {
@ -96,17 +127,24 @@ public class AutostartListener implements Listener {
if (regionStartTime.isEmpty()) {
return;
}
event.blockList().forEach(block -> {
Region region = Region.getRegion(block.getLocation());
if (!regionStartTime.containsKey(region)) return;
if (!region.hasType(RegionType.TESTBLOCK)) return;
if (!region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) return;
long tickDiff = TPSUtils.currentRealTick.get() - regionStartTime.remove(region);
RegionUtils.message(region, player -> {
return BauSystem.MESSAGE.parse("AUTOSTART_MESSAGE_RESULT1", player, new SimpleDateFormat(BauSystem.MESSAGE.parse("AUTOSTART_MESSAGE_DATE_PATTERN", player)).format(new Date(tickDiff * 50)));
});
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT2", 30, (600 - tickDiff));
long preFightDurationInSeconds = getPreFightDurationInSeconds(region);
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT1", tickDiff);
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT2", preFightDurationInSeconds, ((preFightDurationInSeconds * 20) - tickDiff));
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT3");
});
}
private int getPreFightDurationInSeconds(Region region) {
File file = region.gameModeConfig();
if (file == null) return 30;
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
return config.getInt("Times.PreFightDuration", 30);
}
}

Datei anzeigen

@ -62,7 +62,7 @@ public class BackupCommand extends SWCommand {
}
@Register(value = "create", description = "BACKUP_HELP_CREATE")
public void backupCreate(@Validator Player p) {
public void backupCreate(@Validator("owner") Player p) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) {
return;
@ -79,7 +79,7 @@ public class BackupCommand extends SWCommand {
}
@Register(value = "load", description = "BACKUP_HELP_LOAD")
public void backupLoad(@Validator Player p, @Mapper("backupName") String backupName) {
public void backupLoad(@Validator("owner") Player p, @Mapper("backupName") String backupName) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) {
return;
@ -92,7 +92,6 @@ public class BackupCommand extends SWCommand {
}
EditSession editSession = new PasteBuilder(new PasteBuilder.FileProvider(backupFile))
.pastePoint(region.getMinPoint().add(region.getPrototype().getSizeX() / 2, 0, region.getPrototype().getSizeZ() / 2))
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor())
.minPoint(region.getMinPoint())
.maxPoint(region.getMaxPoint())
.waterLevel(region.getWaterLevel())
@ -131,7 +130,7 @@ public class BackupCommand extends SWCommand {
}
SWListInv<String> swListInv = new SWListInv<>(p, BauSystem.MESSAGE.parse("BACKUP_INV_NAME", p), swListEntries, (clickType, s) -> {
p.getOpenInventory().close();
backupLoad(p, s);
p.performCommand("backup load " + s);
});
swListInv.open();
}
@ -141,13 +140,6 @@ public class BackupCommand extends SWCommand {
return SWCommandUtils.createMapper(s -> s, (commandSender, s) -> listBackup((Player) commandSender));
}
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> backupValidator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "BACKUP_NO_PERMS");
};
}
private List<String> listBackup(Player p) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) {

Datei anzeigen

@ -1,41 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.bau;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import org.bukkit.entity.Player;
@Linked
public class BauCommand extends SWCommand {
@LinkedInstance
public InfoCommand infoCommand;
public BauCommand() {
super("bau", "b", "gs");
}
@Register(value = "info", description = "BAU_COMMAND_HELP_INFO")
public void infoCommand(Player p) {
infoCommand.sendBauInfo(p);
}
}

Datei anzeigen

@ -0,0 +1,73 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.bau;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper;
import de.steamwar.linkage.Linked;
import de.steamwar.techhider.TechHider;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Collection;
import java.util.stream.Collectors;
@Linked
public class ForceSpectatorCommand extends SWCommand {
public ForceSpectatorCommand() {
super("forcespectator");
}
@Register
public void forceSpectator(@Validator("supervisor") Player player, @Mapper("builder") Player other) {
Permission.forceOnlySpectator(other);
}
@Mapper("builder")
public TypeMapper<Player> spectatorMapper() {
return new TypeMapper<>() {
@Override
public Player map(CommandSender commandSender, String[] previousArguments, String s) {
Player player = Bukkit.getPlayer(s);
if (player == null) {
return null;
}
if (Permission.BUILD.hasPermission(player) && !Permission.SUPERVISOR.hasPermission(player)) {
return player;
}
return null;
}
@Override
public Collection<String> tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) {
return Bukkit.getOnlinePlayers().stream()
.filter(Permission.BUILD::hasPermission)
.filter(player -> !Permission.SUPERVISOR.hasPermission(player))
.map(Player::getName)
.collect(Collectors.toList());
}
};
}
}

Datei anzeigen

@ -1,8 +1,8 @@
package de.steamwar.bausystem.features.bau;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.BauServer;
import de.steamwar.bausystem.features.tpslimit.TPSWarpUtils;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.command.SWCommand;
@ -13,9 +13,7 @@ import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.entity.Player;
import java.util.List;
import static de.steamwar.bausystem.features.tpslimit.TPSWarpUtils.getTps;
import java.util.*;
@Linked
public class InfoCommand extends SWCommand {
@ -27,17 +25,8 @@ public class InfoCommand extends SWCommand {
super("bauinfo");
}
@Register(help = true)
public void genericHelp(Player p, String... args) {
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_HELP", p);
}
@Register
@Register(description = "BAU_INFO_COMMAND_HELP")
public void genericCommand(Player p) {
sendBauInfo(p);
}
public void sendBauInfo(Player p) {
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_OWNER", p, SteamwarUser.get(bauServer.getOwnerID()).getUserName());
Region region = Region.getRegion(p.getLocation());
for (Flag flag : Flag.getFlags()) {
@ -50,28 +39,48 @@ public class InfoCommand extends SWCommand {
}
}
List<BauweltMember> members = BauweltMember.getMembers(bauServer.getOwnerID());
StringBuilder membermessage = new StringBuilder();
membermessage.append(BauSystem.MESSAGE.parsePrefixed("BAU_INFO_COMMAND_MEMBER", p));
if (Permission.BUILD.hasPermission(p)) {
List<BauweltMember> members = BauweltMember.getMembers(bauServer.getOwnerID());
Map<Permission, List<BauweltMember>> memberByPermission = new HashMap<>();
members.forEach(member -> {
if (Permission.SUPERVISOR.hasPermission(member)) {
memberByPermission.computeIfAbsent(Permission.SUPERVISOR, __ -> new ArrayList<>()).add(member);
} else if (Permission.BUILD.hasPermission(member)) {
memberByPermission.computeIfAbsent(Permission.BUILD, __ -> new ArrayList<>()).add(member);
} else {
memberByPermission.computeIfAbsent(Permission.MEMBER, __ -> new ArrayList<>()).add(member);
}
});
for (BauweltMember member : members) {
membermessage.append(BauSystem.MESSAGE.parse("BAU_INFO_MEMBER_INFO", p,
SteamwarUser.get(member.getMemberID()).getUserName(),
member.isWorldEdit() ? BauSystem.MESSAGE.parse("BAU_INFO_MEMBER_WE_ALLOW", p) : BauSystem.MESSAGE.parse("BAU_INFO_MEMBER_WE_DISALLOW", p),
member.isWorld() ? BauSystem.MESSAGE.parse("BAU_INFO_MEMBER_WORLD_ALLOW", p) : BauSystem.MESSAGE.parse("BAU_INFO_MEMBER_WORLD_DISALLOW", p)
));
List<BauweltMember> supervisor = memberByPermission.getOrDefault(Permission.SUPERVISOR, Collections.emptyList());
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_MEMBER", p, "§eSupervisor", supervisor.size(), supervisor.isEmpty() ? "§8<none>" : joining(supervisor));
List<BauweltMember> builder = memberByPermission.getOrDefault(Permission.BUILD, Collections.emptyList());
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_MEMBER", p, "§6Builder", builder.size(), builder.isEmpty() ? "§8<none>" : joining(builder));
List<BauweltMember> spectator = memberByPermission.getOrDefault(Permission.MEMBER, Collections.emptyList());
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_MEMBER", p, "§7Spectator", spectator.size(), spectator.isEmpty() ? "§8<none>" : joining(spectator));
}
p.sendMessage(membermessage.toString());
StringBuilder tpsMessage = new StringBuilder();
tpsMessage.append(BauSystem.MESSAGE.parsePrefixed("BAU_INFO_COMMAND_TPS", p));
tpsMessage.append(" ").append(getTps(TPSWatcher.TPSType.ONE_SECOND));
tpsMessage.append(" ").append(getTps(TPSWatcher.TPSType.TEN_SECONDS));
if (!TPSWarpUtils.isWarping()) {
tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_MINUTE));
tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES));
tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES));
}
tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_SECOND));
tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_SECONDS));
tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_MINUTE));
tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES));
tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES));
p.sendMessage(tpsMessage.toString());
}
private String joining(List<BauweltMember> bauweltMembers) {
StringBuilder st = new StringBuilder();
for (int i = 0; i < bauweltMembers.size(); i++) {
if (i != 0) {
st.append("§8, ");
}
st.append("§7");
st.append(SteamwarUser.get(bauweltMembers.get(i).getMemberID()).getUserName());
}
return st.toString();
}
}

Datei anzeigen

@ -28,28 +28,29 @@ import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Linked
public class CannonDetector implements Listener {
private Map<TNTPrimed, Vector> velocities = new HashMap<>();
private Map<TNTPrimed, Set<UUID>> propulsionOfProjectile = new HashMap<>();
@EventHandler
@EventHandler(priority = EventPriority.LOW)
public void onEntityExplode(EntityExplodeEvent event) {
if (!(event.getEntity() instanceof TNTPrimed)) {
return;
}
TNTPrimed tnt = (TNTPrimed) event.getEntity();
propulsionOfProjectile.remove(tnt);
DepthManager.update(tnt, event.blockList());
List<TNTPrimed> tnts = Bukkit.getWorlds().get(0).getEntitiesByClass(TNTPrimed.class)
@ -66,6 +67,7 @@ public class CannonDetector implements Listener {
boolean isEmpty = velocities.isEmpty();
tnts.forEach(tntPrimed -> {
velocities.put(tntPrimed, tntPrimed.getVelocity().clone());
propulsionOfProjectile.computeIfAbsent(tntPrimed, __ -> new HashSet<>()).add(tnt.getUniqueId());
});
if (!isEmpty) {
@ -75,7 +77,10 @@ public class CannonDetector implements Listener {
BauSystem.runTaskLater(BauSystem.getInstance(), () -> {
Map<CannonKey, List<TNTPrimed>> grouped = new HashMap<>();
velocities.forEach((tntPrimed, vector) -> {
grouped.computeIfAbsent(new CannonKey(round(tntPrimed.getLocation().toVector()), round(vector)), ignored -> new ArrayList<>()).add(tntPrimed);
boolean xBiggest = Math.abs(vector.getX()) > Math.abs(vector.getZ());
boolean zBiggest = Math.abs(vector.getZ()) > Math.abs(vector.getX());
Vector vec = new Vector(xBiggest ? Math.signum(vector.getX()) : 0, Math.round(vector.getY() * 100), zBiggest ? Math.signum(vector.getZ()) : 0);
grouped.computeIfAbsent(new CannonKey(propulsionOfProjectile.get(tntPrimed), vec), ignored -> new ArrayList<>()).add(tntPrimed);
});
grouped.forEach((cannonKey, tntPrimeds) -> {
if (tntPrimeds.size() <= 5) return;
@ -88,12 +93,4 @@ public class CannonDetector implements Listener {
velocities.clear();
}, 1);
}
private Vector round(Vector vector) {
vector.multiply(10000);
vector.setX(Math.round(vector.getX()));
vector.setY(Math.round(vector.getY()));
vector.setZ(Math.round(vector.getZ()));
return vector;
}
}

Datei anzeigen

@ -22,12 +22,16 @@ package de.steamwar.bausystem.features.cannon;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.util.Vector;
import java.util.Set;
import java.util.UUID;
@AllArgsConstructor
@EqualsAndHashCode
@Getter
public final class CannonKey {
private Vector locationVector;
private Set<UUID> propulsions;
private Vector velocityVector;
}

Datei anzeigen

@ -51,7 +51,6 @@ public class Depth {
List<Block> blocksList = blocks.stream()
.filter(block -> region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION))
.collect(Collectors.toList());
if (blocksList.isEmpty()) return;
tntCount++;
for (Block block : blocksList) {
internalUpdate(block);

Datei anzeigen

@ -48,6 +48,6 @@ public class CountingwandGuiItem extends BauGuiItem {
@Override
public Permission permission() {
return Permission.WORLDEDIT;
return Permission.MEMBER;
}
}

Datei anzeigen

@ -44,7 +44,8 @@ public class DesignEndStone {
private REntityServer entityServer = new REntityServer();
private List<REntity> entities = new ArrayList<>();
private Set<Location> locations = new HashSet<>();
private List<Player> players = new ArrayList<>();
private boolean wsOrAs;
private double maxBlastResistance;
public DesignEndStone(Region region) {
this.minX = region.getMinPointBuild().getX();
@ -53,9 +54,20 @@ public class DesignEndStone {
this.maxX = region.getMaxPointBuild().getX();
this.maxY = region.getMaxPointBuild().getY();
this.maxZ = region.getMaxPointBuild().getZ();
wsOrAs = region.getName().startsWith("ws") || region.getName().startsWith("as");
maxBlastResistance = wsOrAs ? 6.1 : 9.0;
entityServer.setCallback((player, rEntity, entityAction) -> {
if (entityAction != REntityServer.EntityAction.ATTACK) return;
Location location = new Location(WORLD, rEntity.getX(), rEntity.getY(), rEntity.getZ());
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
location.getBlock().breakNaturally();
calc();
}, 1);
});
}
private void calc() {
public void calc() {
entities.forEach(REntity::die);
entities.clear();
locations.clear();
@ -64,8 +76,24 @@ public class DesignEndStone {
calc(minX, minY, maxZ, maxX, maxY, maxZ, 0, 0, -1, maxZ - minZ);
calc(minX, minY, minZ, minX, maxY, maxZ, 1, 0, 0, maxX - minX);
calc(maxX, minY, minZ, maxX, maxY, maxZ, -1, 0, 0, maxX - minX);
// calc(minX, minY, minZ, maxX, minY, maxZ, 0, 1, 0, maxY - minY);
calc(minX, maxY, minZ, maxX, maxY, maxZ, 0, -1, 0, maxY - minY);
if (wsOrAs) {
calc(minX, minY, minZ, maxX, minY, maxZ, 0, 1, 0, maxY - minY + 1);
} else {
int airBlocks = 0;
double minAirBlocks = (maxX - minX) * (maxZ - minZ) * 0.1;
for (int x = minX; x < maxX; x++) {
for (int z = minZ; z < maxZ; z++) {
if (WORLD.getBlockAt(x, minY, z).getType().isAir()) {
airBlocks++;
if (airBlocks > minAirBlocks) break;
}
}
}
if (airBlocks > minAirBlocks) {
calc(minX, minY, minZ, maxX, minY, maxZ, 0, 1, 0, maxY - minY + 1);
}
}
calc(minX, maxY, minZ, maxX, maxY, maxZ, 0, -1, 0, maxY - minY + 1);
}
private void calc(int minX, int minY, int minZ, int maxX, int maxY, int maxZ, int dirX, int dirY, int dirZ, int steps) {
@ -77,15 +105,16 @@ public class DesignEndStone {
int cy = y + step * dirY;
int cz = z + step * dirZ;
Material material = WORLD.getBlockAt(cx, cy, cz).getType();
if (material == Material.END_STONE || material == Material.END_STONE_BRICKS || material == Material.END_STONE_BRICK_SLAB || material == Material.END_STONE_BRICK_STAIRS || material == Material.END_STONE_BRICK_WALL) {
if (material != Material.WATER && material != Material.LAVA && material.getBlastResistance() >= maxBlastResistance) {
Location location = new Location(WORLD, cx + 0.5, cy, cz + 0.5);
if (locations.contains(location)) break;
if (!locations.add(location)) break;
RFallingBlockEntity entity = new RFallingBlockEntity(entityServer, location, Material.RED_STAINED_GLASS);
entity.setNoGravity(true);
entity.setGlowing(true);
entities.add(entity);
break;
} else if (!material.isAir()) {
} else if (!material.isAir() && material != Material.WATER && material != Material.LAVA) {
break;
}
}
@ -95,15 +124,18 @@ public class DesignEndStone {
}
public void toggle(Player player) {
if (players.contains(player)) {
players.remove(player);
if (entityServer.getPlayers().contains(player)) {
entityServer.removePlayer(player);
BauSystem.MESSAGE.send("DESIGN_ENDSTONE_DISABLE", player, ChatMessageType.ACTION_BAR);
BauSystem.MESSAGE.sendPrefixless("DESIGN_ENDSTONE_DISABLE", player, ChatMessageType.ACTION_BAR);
} else {
players.add(player);
entityServer.addPlayer(player);
calc();
BauSystem.MESSAGE.send("DESIGN_ENDSTONE_ENABLE", player, ChatMessageType.ACTION_BAR);
BauSystem.MESSAGE.sendPrefixless("DESIGN_ENDSTONE_ENABLE", player, ChatMessageType.ACTION_BAR);
}
}
public boolean removePlayer(Player player) {
entityServer.removePlayer(player);
return entityServer.getPlayers().isEmpty();
}
}

Datei anzeigen

@ -22,15 +22,23 @@ package de.steamwar.bausystem.features.design.endstone;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@Linked
public class DesignEndStoneCommand extends SWCommand {
public class DesignEndStoneCommand extends SWCommand implements Listener {
public DesignEndStoneCommand() {
super("designendstone");
@ -39,7 +47,7 @@ public class DesignEndStoneCommand extends SWCommand {
private Map<Region, DesignEndStone> designEndStoneMap = new HashMap<>();
@Register(description = "DESIGN_ENDSTONE_COMMAND_HELP")
public void genericCommand(Player player) {
public void genericCommand(@Validator Player player) {
Region region = Region.getRegion(player.getLocation());
if (!region.hasType(RegionType.BUILD)) {
BauSystem.MESSAGE.send("DESIGN_ENDSTONE_REGION_ERROR", player);
@ -47,4 +55,43 @@ public class DesignEndStoneCommand extends SWCommand {
}
designEndStoneMap.computeIfAbsent(region, DesignEndStone::new).toggle(player);
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
disableDesignEndStone(event.getPlayer());
}
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getNewSpectator().forEach(this::disableDesignEndStone);
}
private void disableDesignEndStone(Player player) {
new HashSet<>(designEndStoneMap.entrySet()).forEach(regionDesignEndStoneEntry -> {
if (regionDesignEndStoneEntry.getValue().removePlayer(player)) {
designEndStoneMap.remove(regionDesignEndStoneEntry.getKey());
}
});
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
update(event.getBlock().getLocation());
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
BauSystem.runTaskLater(BauSystem.getInstance(), () -> {
update(event.getBlock().getLocation());
}, 1);
}
private void update(Location location) {
Region region = Region.getRegion(location);
DesignEndStone designEndStone = designEndStoneMap.get(region);
if (designEndStone == null) {
return;
}
designEndStone.calc();
}
}

Datei anzeigen

@ -47,6 +47,6 @@ public class DetonatorBauGuiItem extends BauGuiItem {
@Override
public Permission permission() {
return Permission.MEMBER;
return Permission.BUILD;
}
}

Datei anzeigen

@ -58,12 +58,12 @@ public class DetonatorCommand extends SWCommand {
}
@Register(value = "wand", description = "DETONATOR_HELP_WAND")
public void giveWand(Player p) {
public void giveWand(@Validator Player p) {
SWUtils.giveItemToPlayer(p, getWAND(p));
}
@Register(value = "click", description = "DETONATOR_HELP_CLICK")
public void clickDetonator(Player p) {
public void clickDetonator(@Validator Player p) {
Detonator.activateDetonator(new ItemStorage(p));
}

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.detonator;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.features.detonator.storage.DetonatorStorage;
import de.steamwar.bausystem.features.detonator.storage.ItemStorage;
@ -65,6 +66,7 @@ public class DetonatorListener implements Listener {
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
Player p = event.getPlayer();
if (Detonator.isDetonator(p.getInventory().getItemInMainHand())) {
event.setCancelled(true);
@ -75,6 +77,7 @@ public class DetonatorListener implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
if (!Detonator.isDetonator(event.getItem())) {
return;
}
@ -89,7 +92,7 @@ public class DetonatorListener implements Listener {
@EventHandler(ignoreCancelled = true)
public void onPlayerMove(PlayerMoveEvent event) {
if (!Detonator.isDetonator(event.getPlayer().getInventory().getItemInMainHand())) {
if (!Permission.BUILD.hasPermission(event.getPlayer()) ||!Detonator.isDetonator(event.getPlayer().getInventory().getItemInMainHand())) {
if (Detonator.hasActiveDetonatorShow(event.getPlayer())) {
Detonator.hideDetonator(event.getPlayer());
}
@ -110,6 +113,7 @@ public class DetonatorListener implements Listener {
@EventHandler
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
if (Detonator.isDetonator(event.getPlayer().getInventory().getItemInMainHand())) {
HAS_UPDATED.add(event.getPlayer());
}
@ -117,6 +121,7 @@ public class DetonatorListener implements Listener {
@EventHandler
public void onPlayerSwapHandItems(PlayerSwapHandItemsEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
if (Detonator.isDetonator(event.getMainHandItem()) || Detonator.isDetonator(event.getOffHandItem())) {
HAS_UPDATED.add(event.getPlayer());
}

Datei anzeigen

@ -81,7 +81,7 @@ public class BauGUI {
}
} else {
p.closeInventory();
BauSystem.MESSAGE.send("GUI_NO_PERMISSION", p);
BauSystem.MESSAGE.send("NO_PERMISSION", p);
}
});
});
@ -108,26 +108,13 @@ public class BauGUI {
if (!permission.hasPermission(p)) {
List<String> lore = meta.getLore();
if (lore == null) {
lore = Collections.singletonList(BauSystem.MESSAGE.parse(permissionString(permission), p));
lore = Collections.singletonList(BauSystem.MESSAGE.parse("NO_PERMISSION", p));
} else {
lore.add(BauSystem.MESSAGE.parse(permissionString(permission), p));
lore.add(BauSystem.MESSAGE.parse("NO_PERMISSION", p));
}
meta.setLore(lore);
}
itemStack.setItemMeta(meta);
return itemStack;
}
private static String permissionString(Permission permission) {
switch (permission) {
case OWNER:
return "GUI_NO_OWNER";
case WORLD:
return "GUI_NO_WORLD";
case WORLDEDIT:
return "GUI_NO_WORLDEDIT";
default:
return "GUI_NO_MEMBER";
}
}
}

Datei anzeigen

@ -35,7 +35,7 @@ public class HotbarCommand extends SWCommand {
}
@Register(value = "load", description = "HOTBAR_HELP_LOAD")
public void loadHotbar(Player p) {
public void loadHotbar(@Validator Player p) {
DefaultHotbar.setHotbar(p);
BauSystem.MESSAGE.send("HOTBAR_LOADED", p);
}

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bausystem.features.hotbar;
import de.steamwar.bausystem.Permission;
import de.steamwar.linkage.Linked;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -30,6 +31,7 @@ public class HotbarListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerJoin(PlayerJoinEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
if (allNull(event.getPlayer().getInventory().getContents()) && allNull(event.getPlayer().getInventory().getArmorContents())) {
DefaultHotbar.setHotbar(event.getPlayer());
}

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.inventoryfiller;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.linkage.Linked;
import net.md_5.bungee.api.ChatMessageType;
@ -38,6 +39,7 @@ public class InventoryFiller implements Listener {
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
if (!event.getPlayer().isSneaking()) return;
Block block = event.getPlayer().getTargetBlockExact(5);
@ -59,6 +61,7 @@ public class InventoryFiller implements Listener {
*/
@EventHandler
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
if (!event.getPlayer().isSneaking()) return;
ItemStack itemStack = event.getPlayer().getInventory().getItemInMainHand();

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.killchecker;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.bausystem.utils.bossbar.BossBarService;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
@ -54,7 +55,7 @@ public class KillcheckerCommand extends SWCommand implements Listener {
}
@Register(value = "enable", description = "KILLCHECKER_HELP_ENABLE")
public void genericCommand(Player player, @OptionalValue("-outline") @StaticValue(value = {"-area", "-outline"}, allowISE = true) boolean onlyOutline) {
public void genericCommand(@Validator Player player, @OptionalValue("-outline") @StaticValue(value = {"-area", "-outline"}, allowISE = true) boolean onlyOutline) {
Region region = Region.getRegion(player.getLocation());
KillcheckerVisualizer killcheckerVisualizer = visualizers.computeIfAbsent(region, region1 -> new KillcheckerVisualizer(region1, bossBarService));
killcheckerVisualizer.recalc();
@ -74,16 +75,22 @@ public class KillcheckerCommand extends SWCommand implements Listener {
BauSystem.MESSAGE.send("KILLCHECKER_DISABLE", player);
}
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getNewSpectator().forEach(this::hide);
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
Set<Region> regions = new HashSet<>();
visualizers.forEach((region, visualizer) -> {
if (visualizer.disconnect(player)) {
regions.add(region);
hide(event.getPlayer());
}
private void hide(Player player) {
new HashSet<>(visualizers.entrySet()).forEach(regionKillcheckerVisualizerEntry -> {
if (regionKillcheckerVisualizerEntry.getValue().hide(player)) {
visualizers.remove(regionKillcheckerVisualizerEntry.getKey());
}
});
regions.forEach(visualizers::remove);
}
private void recalc(Block block) {

Datei anzeigen

@ -34,8 +34,6 @@ import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
import org.bukkit.entity.Player;
import java.util.HashMap;
@ -45,10 +43,25 @@ import java.util.Set;
public class KillcheckerVisualizer {
private static final Material[] MATERIALS = new Material[] {Material.YELLOW_STAINED_GLASS, Material.ORANGE_STAINED_GLASS, Material.RED_STAINED_GLASS, Material.PURPLE_STAINED_GLASS, Material.BLACK_STAINED_GLASS};
private static final Material[] MATERIALS = new Material[]{
Material.LIME_STAINED_GLASS,
Material.LIME_CONCRETE,
Material.GREEN_STAINED_GLASS,
Material.GREEN_CONCRETE,
Material.YELLOW_STAINED_GLASS,
Material.YELLOW_CONCRETE,
Material.ORANGE_STAINED_GLASS,
Material.ORANGE_CONCRETE,
Material.RED_STAINED_GLASS,
Material.RED_CONCRETE,
Material.PURPLE_STAINED_GLASS,
Material.PURPLE_CONCRETE,
Material.BLACK_STAINED_GLASS,
Material.BLACK_CONCRETE,
};
private static final World WORLD = Bukkit.getWorlds().get(0);
private static final double SURROUND = 4;
private static final double SURROUND = 4.5;
private final Point minPoint;
private final Point maxPoint;
@ -57,9 +70,6 @@ public class KillcheckerVisualizer {
private final int zArea;
private final int xArea;
private final Set<Player> players = new HashSet<>();
private final Set<Player> areaPlayers = new HashSet<>();
private final Region region;
private final BossBarService bossBarService;
@ -261,7 +271,7 @@ public class KillcheckerVisualizer {
double zPercent = xCount / (double) zArea;
percent = (xPercent + yPercent + zPercent) / 3;
kills = zKills + yKills + xKills;
players.forEach(this::updateBossBar);
outline.getPlayers().forEach(this::updateBossBar);
Set<Point> pointSet = new HashSet<>(killCount.keySet());
Set<Point> outlinePointsCacheLast = new HashSet<>(outlinePointsCache);
@ -356,40 +366,21 @@ public class KillcheckerVisualizer {
return new Cuboid(minX, minY, minZ, maxX, maxY, maxZ);
}
public boolean show(Player player, boolean onlyOutline) {
public void show(Player player, boolean onlyOutline) {
outline.addPlayer(player);
if (!onlyOutline) {
inner.addPlayer(player);
areaPlayers.add(player);
} else if (areaPlayers.contains(player)) {
} else {
inner.removePlayer(player);
areaPlayers.remove(player);
}
updateBossBar(player);
return players.add(player);
}
public boolean hide(Player player) {
outline.removePlayer(player);
if (areaPlayers.contains(player)) {
inner.removePlayer(player);
}
players.remove(player);
areaPlayers.remove(player);
inner.removePlayer(player);
bossBarService.remove(player, region, "killchecker");
if (players.isEmpty()) {
outline.close();
inner.close();
return true;
}
return false;
}
public boolean disconnect(Player player) {
players.remove(player);
areaPlayers.remove(player);
bossBarService.remove(player, region, "killchecker");
if (players.isEmpty()) {
if (outline.getPlayers().isEmpty() && inner.getPlayers().isEmpty()) {
outline.close();
inner.close();
return true;

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.loader;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.loader.elements.LoaderElement;
import de.steamwar.bausystem.features.loader.elements.LoaderInteractionElement;
import de.steamwar.bausystem.features.loader.elements.impl.LoaderTNT;
@ -35,9 +36,14 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
public class Loader implements Listener {
@ -68,25 +74,45 @@ public class Loader implements Listener {
BauSystem.runTaskTimer(BauSystem.getInstance(), () -> {
if (stage != Stage.RUNNING) return;
if(!Permission.BUILD.hasPermission(p)) return;
if (waitTime > 0) {
waitTime--;
return;
}
if (currentElement >= elements.size()) {
currentElement = 0;
if (stage == Stage.SINGLE) {
stage = Stage.PAUSE;
return;
}
}
while (currentElement < elements.size()) {
LoaderElement element = elements.get(currentElement);
currentElement++;
element.execute(delay -> waitTime = delay);
if (waitTime > 0) {
break;
if (element instanceof LoaderTNT) currentElement--;
return;
}
}
if (currentElement >= elements.size()) {
currentElement = 0;
}
}, 0, 1);
}
public void single() {
if (stage == Stage.END) return;
if (stage == Stage.RUNNING) return;
stage = Stage.SINGLE;
if (recorder != null) {
recorder.stop();
recorder = null;
}
if (elements.isEmpty()) {
BauSystem.MESSAGE.send("LOADER_NOTHING_RECORDED", p);
stop();
}
}
public void start() {
if (stage == Stage.END) return;
if (stage == Stage.RUNNING) return;
@ -121,27 +147,67 @@ public class Loader implements Listener {
LOADER_MAP.remove(p);
}
public boolean setTicksBetweenShots(int delay) {
if (elements.size() == 0) return false;
LoaderElement loaderElement = elements.get(elements.size() - 1);
if (loaderElement instanceof LoaderWait) {
((LoaderWait) loaderElement).setDelay(delay);
return true;
}
return false;
}
public void setTicksBetweenBlocks(int delay) {
for (int i = 0; i < elements.size() - 1; i++) {
LoaderElement loaderElement = elements.get(i);
if (loaderElement instanceof LoaderWait) {
((LoaderWait) loaderElement).setDelay(delay);
}
}
}
public void gui(SettingsSorting settingsSorting) {
List<SWListInv.SWListEntry<LoaderElement>> list = new ArrayList<>();
AtomicBoolean allWait = new AtomicBoolean(true);
Runnable updateRunnable = () -> {
list.clear();
for (LoaderElement element : elements) {
if (settingsSorting != null) {
if (settingsSorting == SettingsSorting.WAIT && !(element instanceof LoaderWait)) {
continue;
}
if (settingsSorting == SettingsSorting.INTERACTIONS && (element instanceof LoaderWait || element instanceof LoaderTNT)) {
continue;
}
for (int i = 0; i < elements.size(); i++) {
LoaderElement previous = i > 0 ? elements.get(i - 1) : null;
LoaderElement current = elements.get(i);
LoaderElement next = i < elements.size() - 1 ? elements.get(i + 1) : null;
if (!settingsSorting.shouldShow(previous, current, next)) {
continue;
}
SWItem item = element.menu(p);
if (element instanceof LoaderInteractionElement<?>) {
LoaderInteractionElement<?> interactionElement = (LoaderInteractionElement<?>) element;
item.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_MODES", p, interactionElement.size()), "§8", BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", p)));
if ((!(current instanceof LoaderWait))) {
allWait.set(false);
}
SWItem item = current.menu(p);
if (current instanceof LoaderInteractionElement<?>) {
LoaderInteractionElement<?> interactionElement = (LoaderInteractionElement<?>) current;
List<String> lore = new ArrayList<>();
if (item.getItemMeta() != null && item.getItemMeta().getLore() != null) {
lore.addAll(item.getItemMeta().getLore());
lore.add("§8");
}
lore.add(BauSystem.MESSAGE.parse("LOADER_SETTING_MODES", p, interactionElement.size()));
lore.add(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", p));
item.setLore(lore);
} else {
item.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", p)));
List<String> lore = new ArrayList<>();
if (item.getItemMeta() != null && item.getItemMeta().getLore() != null) {
lore.addAll(item.getItemMeta().getLore());
lore.add("§8");
}
lore.add(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", p));
item.setLore(lore);
}
list.add(new SWListInv.SWListEntry<>(item, element));
list.add(new SWListInv.SWListEntry<>(item, current));
}
if (list.isEmpty()) {
allWait.set(false);
}
};
updateRunnable.run();
@ -152,65 +218,51 @@ public class Loader implements Listener {
swListInv.open();
}));
SWItem onlyInteractionsElements = new SWItem(Material.REPEATER, BauSystem.MESSAGE.parse("LOADER_GUI_SHOW_INTERACTIONS", p), clickType -> {
gui(settingsSorting == SettingsSorting.INTERACTIONS ? null : SettingsSorting.INTERACTIONS);
SWItem settingItem = new SWItem(settingsSorting.getMaterial(), "§e" + BauSystem.MESSAGE.parse(settingsSorting.getName(), p), clickType -> {
if (clickType == ClickType.LEFT) {
int index = settingsSorting.ordinal() + 1;
if (index >= SettingsSorting.LENGTH) {
index = 0;
}
gui(SettingsSorting.values()[index]);
} else if (clickType == ClickType.RIGHT) {
int index = settingsSorting.ordinal() - 1;
if (index < 0) {
index = SettingsSorting.LENGTH - 1;
}
gui(SettingsSorting.values()[index]);
}
});
if (settingsSorting == SettingsSorting.INTERACTIONS) onlyInteractionsElements.setEnchanted(true);
swListInv.setItem(47, onlyInteractionsElements);
SWItem onlyWaitElements = new SWItem(Material.CLOCK, BauSystem.MESSAGE.parse("LOADER_GUI_SHOW_WAITS", p), clickType -> {
gui(settingsSorting == SettingsSorting.WAIT ? null : SettingsSorting.WAIT);
});
if (settingsSorting == SettingsSorting.WAIT) onlyWaitElements.setEnchanted(true);
swListInv.setItem(48, onlyWaitElements);
if (settingsSorting == SettingsSorting.WAIT) {
SWItem waitBetweenTNT = new SWItem(Material.TNT, BauSystem.MESSAGE.parse("LOADER_GUI_SHOW_WAITS_SET_BETWEEN_TNT", p), clickType -> {
SWAnvilInv swAnvilInv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("LOADER_GUI_SHOW_WAITS_TITLE", p), "");
swAnvilInv.setCallback(s -> {
try {
long delay = Long.parseLong(s);
if (delay < 0) delay = 0;
for (int i = 1; i < elements.size() - 1; i++) {
if (!(elements.get(i - 1) instanceof LoaderTNT)) continue;
if (!(elements.get(i + 1) instanceof LoaderTNT)) continue;
if (!(elements.get(i) instanceof LoaderWait)) continue;
((LoaderWait) elements.get(i)).setDelay(delay);
}
} catch (NumberFormatException ignored) {
}
gui(settingsSorting);
});
updateRunnable.run();
swAnvilInv.open();
});
swListInv.setItem(50, waitBetweenTNT);
SWItem waitTime = new SWItem(Material.PAPER, BauSystem.MESSAGE.parse("LOADER_GUI_SHOW_WAITS_SET_ALL", p), clickType -> {
SWAnvilInv swAnvilInv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("LOADER_GUI_SHOW_WAITS_TITLE", p), "");
swAnvilInv.setCallback(s -> {
try {
long delay = Long.parseLong(s);
if (delay < 0) delay = 0;
long finalDelay = delay;
elements.stream()
.filter(LoaderWait.class::isInstance)
.map(LoaderWait.class::cast)
.forEach(loaderWait -> loaderWait.setDelay(finalDelay));
} catch (NumberFormatException ignored) {
}
gui(settingsSorting);
});
updateRunnable.run();
swAnvilInv.open();
});
swListInv.setItem(51, waitTime);
} else {
SWItem empty = new SWItem(Material.STRUCTURE_VOID, "§7", clickType -> {});
swListInv.setItem(50, empty);
swListInv.setItem(51, empty);
List<String> strings = new ArrayList<>();
for (SettingsSorting setting : SettingsSorting.values()) {
if (setting == settingsSorting) {
strings.add("§e> §7" + BauSystem.MESSAGE.parse(setting.getName(), p));
} else {
strings.add("§8> §7" + BauSystem.MESSAGE.parse(setting.getName(), p));
}
}
settingItem.setLore(strings);
swListInv.setItem(48, settingItem);
if (allWait.get()) {
SWItem setWait = new SWItem(Material.PAPER, BauSystem.MESSAGE.parse("LOADER_GUI_SHOW_WAITS_SET_ALL", p), clickType -> {
SWAnvilInv swAnvilInv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("LOADER_GUI_SHOW_WAITS_TITLE", p), "");
swAnvilInv.setCallback(s -> {
try {
long delay = Math.max(Long.parseLong(s), 0);
list.forEach(loaderElementSWListEntry -> {
((LoaderWait) loaderElementSWListEntry.getObject()).setDelay(delay);
});
} catch (NumberFormatException ignored) {
}
gui(settingsSorting);
});
swAnvilInv.open();
});
swListInv.setItem(50, setWait);
} else {
swListInv.setItem(50, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§8"));
}
swListInv.open();
}
@ -221,18 +273,104 @@ public class Loader implements Listener {
}
public String getProgress() {
return (currentElement + 1) + "§8/§7" + elements.size();
return Math.max(currentElement, 1) + "§8/§7" + elements.size();
}
public enum SettingsSorting {
WAIT,
INTERACTIONS,
ALL {
@Override
public Material getMaterial() {
return Material.STRUCTURE_VOID;
}
@Override
public String getName() {
return "LOADER_GUI_SHOW_ALL";
}
@Override
public boolean shouldShow(LoaderElement previous, LoaderElement current, LoaderElement next) {
return true;
}
},
WAIT {
@Override
public Material getMaterial() {
return Material.CLOCK;
}
@Override
public String getName() {
return "LOADER_GUI_SHOW_WAITS";
}
@Override
public boolean shouldShow(LoaderElement previous, LoaderElement current, LoaderElement next) {
return current instanceof LoaderWait;
}
},
WAIT_BETWEEN_TNT {
@Override
public Material getMaterial() {
return Material.REDSTONE_BLOCK;
}
@Override
public String getName() {
return "LOADER_GUI_SHOW_WAITS_BETWEEN_TNT";
}
@Override
public boolean shouldShow(LoaderElement previous, LoaderElement current, LoaderElement next) {
return previous instanceof LoaderTNT && current instanceof LoaderWait && next instanceof LoaderTNT;
}
},
INTERACTIONS {
@Override
public Material getMaterial() {
return Material.REPEATER;
}
@Override
public String getName() {
return "LOADER_GUI_SHOW_INTERACTIONS";
}
@Override
public boolean shouldShow(LoaderElement previous, LoaderElement current, LoaderElement next) {
return current instanceof LoaderInteractionElement && !(current instanceof LoaderTNT);
}
},
TNT {
@Override
public Material getMaterial() {
return Material.TNT;
}
@Override
public String getName() {
return "LOADER_GUI_SHOW_TNT";
}
@Override
public boolean shouldShow(LoaderElement previous, LoaderElement current, LoaderElement next) {
return current instanceof LoaderTNT;
}
},
;
public static int LENGTH = SettingsSorting.values().length;
public abstract Material getMaterial();
public abstract String getName();
public abstract boolean shouldShow(LoaderElement previous, LoaderElement current, LoaderElement next);
}
@AllArgsConstructor
public enum Stage implements EnumDisplay {
SETUP("LOADER_SETUP"),
RUNNING("LOADER_RUNNING"),
SINGLE("LOADER_SINGLE"),
PAUSE("LOADER_PAUSE"),
END("LOADER_END");

Datei anzeigen

@ -20,14 +20,15 @@
package de.steamwar.bausystem.features.loader;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeValidator;
import de.steamwar.linkage.Linked;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@Linked
public class LoaderCommand extends SWCommand {
public class LoaderCommand extends SWCommand implements Listener {
public LoaderCommand() {
super("loader");
@ -80,13 +81,42 @@ public class LoaderCommand extends SWCommand {
public void guiLoader(@Validator Player player) {
Loader loader = Loader.getLoader(player);
if (loaderNullCheck(loader, player)) return;
loader.gui(null);
loader.gui(Loader.SettingsSorting.ALL);
}
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> loaderValidator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "LOADER_PERMS");
};
@Register(value = "wait", description = "LOADER_HELP_WAIT")
public void shotDelayLoader(@Validator Player p, @Min(intValue = 1) @ErrorMessage("LOADER_SMALL_TIME") int delay) {
Loader loader = Loader.getLoader(p);
if (loaderNullCheck(loader, p)) return;
if (loader.setTicksBetweenShots(delay)) {
BauSystem.MESSAGE.send("LOADER_NEW_TIME", p, delay);
} else {
BauSystem.MESSAGE.send("LOADER_SMALL_TIME", p);
}
}
@Register(value = "speed", description = "LOADER_HELP_SPEED")
public void speedLoader(@Validator Player p, @Min(intValue = 0) @ErrorMessage("LOADER_SMALL_TIME") int delay) {
Loader loader = Loader.getLoader(p);
if (loaderNullCheck(loader, p)) return;
BauSystem.MESSAGE.send("LOADER_NEW_LOAD_TIME", p, delay);
loader.setTicksBetweenBlocks(delay);
}
@Register(value = "single", description = "LOADER_HELP_SINGLE")
public void singleLoader(@Validator Player p) {
Loader loader = Loader.getLoader(p);
if (loaderNullCheck(loader, p)) return;
loader.single();
BauSystem.MESSAGE.send("LOADER_SINGLE_CMD", p);
}
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getNewSpectator().forEach(player -> {
Loader loader = Loader.getLoader(player);
if (loader == null) return;
loader.stop();
});
}
}

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.loader;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.features.loader.elements.LoaderElement;
import de.steamwar.bausystem.features.loader.elements.LoaderInteractionElement;
import de.steamwar.bausystem.features.loader.elements.impl.*;
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import org.bukkit.Bukkit;
@ -33,6 +34,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
@ -41,6 +43,8 @@ import org.bukkit.inventory.EquipmentSlot;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
public class LoaderRecorder implements Listener {
@ -70,7 +74,7 @@ public class LoaderRecorder implements Listener {
return;
}
long diff = TPSUtils.currentRealTick.get() - lastInteraction;
if (last && diff > 160) diff = 160;
if (last) diff = 120;
lastInteraction = TPSUtils.currentRealTick.get();
loaderElementList.add(new LoaderWait(diff));
}
@ -86,7 +90,34 @@ public class LoaderRecorder implements Listener {
}
@EventHandler
public void onPlayerInteractEntity(PlayerInteractEvent event) {
public void onBlockBreak(BlockBreakEvent event) {
if (event.getPlayer() != player) return;
boolean removedOne = false;
for (int i = 0; i < loaderElementList.size(); i++) {
LoaderElement element = loaderElementList.get(i);
if (!(element instanceof LoaderInteractionElement)) continue;
LoaderInteractionElement interactionElement = (LoaderInteractionElement) element;
if (interactionElement.getLocation().equals(event.getBlock().getLocation())) {
loaderElementList.remove(i);
if (i > 0) {
loaderElementList.remove(i - 1);
}
removedOne = true;
break;
}
}
if (removedOne) {
if (event.getBlock().getType() != Material.TNT) {
event.setCancelled(true);
}
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("LOADER_MESSAGE_UNINTERACT", player));
}
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getPlayer() != player) return;
if (player.isSneaking()) return;
if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.PHYSICAL) return;
@ -95,53 +126,10 @@ public class LoaderRecorder implements Listener {
addWaitTime(false);
Block block = event.getClickedBlock();
Material type = block.getType();
switch (type) {
case COMPARATOR:
loaderElementList.add(new LoaderComparator(block.getLocation()));
message("LOADER_BUTTON_COMPARATOR");
break;
case REPEATER:
loaderElementList.add(new LoaderRepeater(block.getLocation()));
message("LOADER_BUTTON_REPEATER");
break;
case NOTE_BLOCK:
loaderElementList.add(new LoaderNoteBlock(block.getLocation()));
message("LOADER_BUTTON_NOTEBLOCK");
break;
case LEVER:
loaderElementList.add(new LoaderLever(block.getLocation()));
message("LOADER_BUTTON_SWITCH");
break;
case DAYLIGHT_DETECTOR:
loaderElementList.add(new LoaderDaylightDetector(block.getLocation()));
message("LOADER_BUTTON_DAYLIGHT_DETECTOR");
break;
case LECTERN:
loaderElementList.add(new LoaderLectern(block.getLocation()));
message("LOADER_BUTTON_LECTERN");
break;
case IRON_TRAPDOOR:
break;
default:
if (type.name().endsWith("_TRAPDOOR")) {
loaderElementList.add(new LoaderOpenable(block.getLocation(), "LOADER_BUTTON_TRAPDOOR", type));
message("LOADER_BUTTON_TRAPDOOR");
} else if (type.name().endsWith("_DOOR")) {
loaderElementList.add(new LoaderOpenable(block.getLocation(), "LOADER_BUTTON_DOOR", type));
message("LOADER_BUTTON_DOOR");
} else if (type.name().endsWith("FENCE_GATE")) {
loaderElementList.add(new LoaderOpenable(block.getLocation(), "LOADER_BUTTON_FENCEGATE", type));
message("LOADER_BUTTON_FENCEGATE");
} else if (type.name().endsWith("STONE_BUTTON")) {
loaderElementList.add(new LoaderTicks(block.getLocation(), "LOADER_BUTTON_STONE_BUTTON", type, 20));
message("LOADER_BUTTON_STONE_BUTTON");
} else if (type.name().endsWith("BUTTON")) {
loaderElementList.add(new LoaderTicks(block.getLocation(), "LOADER_BUTTON_WOOD_BUTTON", type, 30));
message("LOADER_BUTTON_WOOD_BUTTON");
}
break;
}
getLoaderInteractionElement(block, (loaderInteractionElement, s) -> {
loaderElementList.add(loaderInteractionElement);
message(s);
});
}
private Map<Location, Long> blockSet = new HashMap<>();
@ -197,6 +185,46 @@ public class LoaderRecorder implements Listener {
}
}
public static void getLoaderInteractionElement(Block block, BiConsumer<LoaderInteractionElement<?>, String> consumer) {
Material type = block.getType();
switch (type) {
case COMPARATOR:
consumer.accept(new LoaderComparator(block.getLocation()), "LOADER_BUTTON_COMPARATOR");
break;
case REPEATER:
consumer.accept(new LoaderRepeater(block.getLocation()), "LOADER_BUTTON_REPEATER");
break;
case NOTE_BLOCK:
consumer.accept(new LoaderNoteBlock(block.getLocation()), "LOADER_BUTTON_NOTEBLOCK");
break;
case LEVER:
consumer.accept(new LoaderLever(block.getLocation()), "LOADER_BUTTON_SWITCH");
break;
case DAYLIGHT_DETECTOR:
consumer.accept(new LoaderDaylightDetector(block.getLocation()), "LOADER_BUTTON_DAYLIGHT_DETECTOR");
break;
case LECTERN:
consumer.accept(new LoaderLectern(block.getLocation()), "LOADER_BUTTON_LECTERN");
break;
case IRON_TRAPDOOR:
case IRON_DOOR:
break;
default:
if (type.name().endsWith("_TRAPDOOR")) {
consumer.accept(new LoaderOpenable(block.getLocation(), "LOADER_BUTTON_TRAPDOOR", type), "LOADER_BUTTON_TRAPDOOR");
} else if (type.name().endsWith("_DOOR")) {
consumer.accept(new LoaderOpenable(block.getLocation(), "LOADER_BUTTON_DOOR", type), "LOADER_BUTTON_DOOR");
} else if (type.name().endsWith("FENCE_GATE")) {
consumer.accept(new LoaderOpenable(block.getLocation(), "LOADER_BUTTON_FENCEGATE", type), "LOADER_BUTTON_FENCEGATE");
} else if (type.name().endsWith("STONE_BUTTON")) {
consumer.accept(new LoaderTicks(block.getLocation(), "LOADER_BUTTON_STONE_BUTTON", type, 20), "LOADER_BUTTON_STONE_BUTTON");
} else if (type.name().endsWith("BUTTON")) {
consumer.accept(new LoaderTicks(block.getLocation(), "LOADER_BUTTON_WOOD_BUTTON", type, 30), "LOADER_BUTTON_WOOD_BUTTON");
}
break;
}
}
private void message(String type) {
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("LOADER_MESSAGE_INTERACT", player, BauSystem.MESSAGE.parse(type, player), loaderElementList.size()));
}

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.loader;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.utils.ScoreboardElement;
import de.steamwar.linkage.Linked;
@ -40,6 +41,7 @@ public class LoaderScoreboardElement implements ScoreboardElement {
@Override
public String get(Region region, Player p) {
if(!Permission.BUILD.hasPermission(p)) return null;
Loader loader = Loader.getLoader(p);
if (loader == null) return null;
if (loader.getStage() == Loader.Stage.RUNNING) {

Datei anzeigen

@ -1,39 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.loader.elements;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.inventory.SWItem;
import org.bukkit.entity.Player;
import java.util.function.Consumer;
public interface ElementSettings {
SWItem menu(Player player);
void execute(Consumer<Long> delay);
void click(Player player, Runnable backAction, Runnable deleteAction);
default void playerInteract() {}
void noop();
default String translateItemName(String name, String mode, Player player, Object... args) {
return BauSystem.MESSAGE.parse("LOADER_GUI_ITEM_NAME", player, BauSystem.MESSAGE.parse(name, player), BauSystem.MESSAGE.parse(mode, player, args));
}
}

Datei anzeigen

@ -21,62 +21,93 @@ package de.steamwar.bausystem.features.loader.elements;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import lombok.Getter;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.FaceAttachable;
import org.bukkit.block.data.*;
import org.bukkit.block.data.type.Door;
import org.bukkit.block.data.type.Switch;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
public abstract class LoaderInteractionElement<T extends ElementSettings> implements LoaderElement {
public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSettingsEnum> implements LoaderElement {
@Getter
protected final Location location;
protected int currentShot = 0;
protected T defaultSetting;
protected T newSetting;
protected T[] allSettings;
protected List<T> elements = new ArrayList<>();
protected List<Integer> extraPower = new ArrayList<>();
protected List<Long> extraTicks = new ArrayList<>();
protected int settingsGuiSize = 0;
protected LoaderInteractionElement(Location location) {
protected LoaderInteractionElement(Location location, T defaultSetting, T newSetting, T[] allSettings) {
this.location = location;
T element = createNewElement();
element.playerInteract();
elements.add(element);
this.defaultSetting = defaultSetting;
this.newSetting = newSetting;
this.allSettings = allSettings;
elements.add(defaultSetting);
extraPower.add(0);
extraTicks.add(0L);
for (T element : allSettings) {
settingsGuiSize = Math.max(element.getPos(), settingsGuiSize);
}
while (settingsGuiSize % 9 != 0) settingsGuiSize++;
settingsGuiSize += 9;
}
@Override
public void execute(Consumer<Long> delay) {
if (currentShot >= elements.size()) currentShot = 0;
elements.get(currentShot).execute(delay);
if (checkBlockInWorld()) {
BlockData blockData = location.getBlock().getBlockData();
elements.get(currentShot).execute(location, blockData, this, extraPower.get(currentShot), extraTicks.get(currentShot), delay);
}
currentShot++;
if (currentShot >= elements.size()) currentShot = 0;
}
@Override
public void click(Player player, Runnable backAction) {
List<SWListInv.SWListEntry<T>> entries = new ArrayList<>();
List<SWListInv.SWListEntry<Integer>> entries = new ArrayList<>();
Runnable updateRunnable = () -> {
entries.clear();
for (T element : elements) {
entries.add(new SWListInv.SWListEntry<>(element.menu(player), element));
for (int i = 0; i < elements.size(); i++) {
SWItem swItem = elements.get(i).menu(player, this, extraPower.get(i), extraTicks.get(i));
swItem.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)));
entries.add(new SWListInv.SWListEntry<>(swItem, i));
}
};
updateRunnable.run();
SWListInv<T> listInv = new SWListInv<>(player, "Interaction Settings", false, entries, (clickType, entry) -> {});
SWListInv<Integer> listInv = new SWListInv<>(player, "Interaction Settings", false, entries, (clickType, entry) -> {});
listInv.setCallback((clickType, entry) -> {
entry.click(player, () -> {
openIndividualSettingsMenu(player, entry, () -> {
updateRunnable.run();
listInv.open();
}, () -> {
if (elements.size() == 1) return;
elements.remove(entry);
elements.remove((int) entry);
extraPower.remove((int) entry);
extraTicks.remove((int) entry);
if (elements.isEmpty()) {
elements.add(newSetting);
extraPower.add(0);
extraTicks.add(1L);
}
click(player, backAction);
});
});
@ -84,69 +115,190 @@ public abstract class LoaderInteractionElement<T extends ElementSettings> implem
backAction.run();
}));
listInv.setItem(50, new SWItem(Material.GHAST_SPAWN_EGG, "§7Insert another Setting", clickType -> {
T element = createNewElement();
elements.add(element);
element.click(player, () -> {
elements.add(defaultSetting);
extraPower.add(0);
extraTicks.add(1L);
openIndividualSettingsMenu(player, elements.size() - 1, () -> {
updateRunnable.run();
listInv.open();
}, () -> {
if (elements.size() == 1) return;
elements.remove(element);
elements.remove(elements.size() - 1);
extraPower.remove(extraPower.size() - 1);
extraTicks.remove(extraTicks.size() - 1);
if (elements.isEmpty()) {
elements.add(newSetting);
extraPower.add(0);
extraTicks.add(1L);
}
click(player, backAction);
});
}));
listInv.setItem(51, new SWItem(Material.STRUCTURE_VOID, "§7Insert NOOP's", clickType -> {
SWAnvilInv anvilInv = new SWAnvilInv(player, "§7NOOP Count", "1");
anvilInv.setCallback(s -> {
try {
int count = Integer.parseInt(s);
for (int i = 0; i < count; i++) {
T element = createNewElement();
element.noop();
elements.add(element);
}
updateRunnable.run();
listInv.open();
} catch (NumberFormatException e) {
player.sendMessage("§cInvalid Number");
}
});
anvilInv.open();
}));
listInv.open();
}
private void openIndividualSettingsMenu(Player player, int index, Runnable back, Runnable delete) {
T currentElement = elements.get(index);
int guiSize = settingsGuiSize;
int powerStart = guiSize - 9;
if (currentElement.hasPower(this)) {
guiSize += 18;
}
int ticksStart = guiSize - 9;
if (currentElement.hasTicks(this)) {
guiSize += 9;
}
SWInventory swInventory = new SWInventory(player, guiSize, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
for (int i = guiSize - 9; i < guiSize; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", clickType -> {}));
swInventory.setItem(guiSize - 9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).getItemStack(), clickType -> back.run());
swInventory.setItem(guiSize - 5, new SWItem(Material.WOODEN_AXE, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_COPY", player)).getItemStack(), clickType -> {
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_GUI_COPY_TITLE", player), "1");
swAnvilInv.setCallback(s -> {
try {
int count = Integer.parseInt(s);
if (count < 1) count = 1;
if (count > 65536) count = 65536;
int power = extraPower.get(index);
long ticks = extraTicks.get(index);
for (int i = 0; i < count; i++) {
elements.add(currentElement);
extraPower.add(power);
extraTicks.add(ticks);
}
if (count == 1) {
openIndividualSettingsMenu(player, elements.size() - 1, back, delete);
} else {
back.run();
}
} catch (NumberFormatException e) {
back.run();
}
});
swAnvilInv.open();
});
swInventory.setItem(guiSize - 1, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_DELETE", player)).getItemStack(), clickType -> delete.run());
for (T element : allSettings) {
SWItem item = element.menu(player, this, extraPower.get(index), extraTicks.get(index));
if (element == currentElement) {
item.setEnchanted(true);
}
swInventory.setItem(element.getPos(), item.getItemStack(), clickType -> {
elements.set(index, element);
openIndividualSettingsMenu(player, index, back, delete);
});
}
if (currentElement.hasPower(this)) {
for (int power = 0; power < 16; power++) {
int finalPowerPosition = power;
if (power >= 9) finalPowerPosition++;
SWItem powerItem = new SWItem(Material.REDSTONE, BauSystem.MESSAGE.parse("LOADER_SETTING_POWER", player, power), Arrays.asList(), false, clickType -> {});
powerItem.getItemStack().setAmount(Math.max(power, 1));
if (extraPower.get(index) == power) powerItem.setEnchanted(true);
int finalPower = power;
swInventory.setItem(finalPowerPosition + powerStart, powerItem.getItemStack(), clickType -> {
extraPower.set(index, finalPower);
openIndividualSettingsMenu(player, index, back, delete);
});
}
}
if (currentElement.hasTicks(this)) {
swInventory.setItem(ticksStart + 3, new SWItem(SWItem.getDye(1), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
long ticks = extraTicks.get(index);
ticks -= clickType.isShiftClick() ? 5 : 1;
if (ticks < 1) ticks = 1;
extraTicks.set(index, ticks);
openIndividualSettingsMenu(player, index, back, delete);
});
SWItem ticksItem = new SWItem(Material.CLOCK, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS", player, extraTicks.get(index)), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)), false, clickType -> {});
ticksItem.getItemStack().setAmount((int) Math.min(extraTicks.get(index), 64));
swInventory.setItem(ticksStart + 4, ticksItem.getItemStack(), clickType -> {
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_NAME", player), extraTicks.get(index) + "");
swAnvilInv.setCallback(s -> {
try {
long ticks = Long.parseLong(s);
if (ticks < 1) ticks = 1;
extraTicks.set(index, ticks);
} catch (NumberFormatException ignored) {
}
openIndividualSettingsMenu(player, index, back, delete);
});
swAnvilInv.open();
});
swInventory.setItem(ticksStart + 5, new SWItem(SWItem.getDye(10), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
long ticks = extraTicks.get(index);
ticks += clickType.isShiftClick() ? 5 : 1;
extraTicks.set(index, ticks);
openIndividualSettingsMenu(player, index, back, delete);
});
}
swInventory.open();
}
protected void update(BlockData blockData) {
Material material = blockData.getMaterial();
Block block = location.getBlock();
if (blockData instanceof Switch) {
if (blockData instanceof Door) {
Door door = (Door) blockData;
block.setBlockData(door);
if (door.getHalf() == Bisected.Half.BOTTOM) {
updateBlock(block.getRelative(BlockFace.UP), door.isOpen() ? 15 : 0);
} else {
updateBlock(block.getRelative(BlockFace.DOWN), door.isOpen() ? 15 : 0);
}
} else if (blockData instanceof Switch) {
Switch sw = (Switch) blockData;
updateBlock(block, sw);
FaceAttachable.AttachedFace face = sw.getAttachedFace();
if (face == FaceAttachable.AttachedFace.FLOOR) {
updateBlock(block.getRelative(BlockFace.DOWN));
updateBlock(block.getRelative(BlockFace.DOWN), sw.isPowered() ? 15 : 0);
} else if (face == FaceAttachable.AttachedFace.CEILING) {
updateBlock(block.getRelative(BlockFace.UP));
updateBlock(block.getRelative(BlockFace.UP), sw.isPowered() ? 15 : 0);
} else {
updateBlock(block.getRelative(sw.getFacing().getOppositeFace()));
updateBlock(block.getRelative(sw.getFacing().getOppositeFace()), sw.isPowered() ? 15 : 0);
}
} else if (material == Material.TRIPWIRE) {
} else if (blockData instanceof Powerable) {
updateBlock(block, blockData);
updateBlock(block.getRelative(BlockFace.DOWN), ((Powerable) blockData).isPowered() ? 15 : 0);
} else if (blockData instanceof AnaloguePowerable) {
updateBlock(block, blockData);
updateBlock(block.getRelative(BlockFace.DOWN), ((AnaloguePowerable) blockData).getPower());
} else {
updateBlock(block, blockData);
} else if (material.name().endsWith("_PLATE")) {
updateBlock(block.getRelative(BlockFace.DOWN));
}
}
protected void updateBlock(Block block) {
updateBlock(block, block.getBlockData());
private void updateBlock(Block block, int powered) {
BlockData data = block.getBlockData();
if (data instanceof Door) {
Door door = (Door) data;
door.setOpen(powered > 0);
block.setBlockData(door);
return;
} else if (data instanceof Powerable) {
Powerable powerable = (Powerable) data;
powerable.setPowered(powered > 0);
} else if (data instanceof AnaloguePowerable) {
AnaloguePowerable analoguePowerable = (AnaloguePowerable) data;
analoguePowerable.setPower(powered);
}
updateBlock(block, data);
}
protected void updateBlock(Block block, BlockData data) {
block.setType(Material.BARRIER, true);
block.setBlockData(data, true);
private void updateBlock(Block block, BlockData data) {
block.setType(Material.BARRIER);
block.setBlockData(data);
}
public abstract T createNewElement();
public abstract boolean checkBlockInWorld();
protected final String translateItemName(String name, Player player) {
return BauSystem.MESSAGE.parse("LOADER_SETTING_NAME", player, BauSystem.MESSAGE.parse(name, player));

Datei anzeigen

@ -0,0 +1,44 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.loader.elements;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.inventory.SWItem;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.util.function.Consumer;
public interface LoaderSettingsEnum<T, P extends LoaderInteractionElement<E>, E extends Enum<E> & LoaderSettingsEnum<T, P, E>> {
int getPos();
SWItem menu(Player player, P parent, int power, long ticks);
default boolean hasPower(P parent) {
return false;
}
default boolean hasTicks(P parent) {
return false;
}
void execute(Location location, T blockData, P parent, int power, long ticks, Consumer<Long> delay);
default String translateItemName(String name, String mode, Player player, Object... args) {
return BauSystem.MESSAGE.parse("LOADER_GUI_ITEM_NAME", player, BauSystem.MESSAGE.parse(name, player), BauSystem.MESSAGE.parse(mode, player, args));
}
}

Datei anzeigen

@ -19,10 +19,8 @@
package de.steamwar.bausystem.features.loader.elements.impl;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.loader.elements.ElementSettings;
import de.steamwar.bausystem.features.loader.elements.LoaderInteractionElement;
import de.steamwar.inventory.SWInventory;
import de.steamwar.bausystem.features.loader.elements.LoaderSettingsEnum;
import de.steamwar.inventory.SWItem;
import org.bukkit.Location;
import org.bukkit.Material;
@ -30,101 +28,83 @@ import org.bukkit.block.data.type.Comparator;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.Collections;
import java.util.function.Consumer;
public class LoaderComparator extends LoaderInteractionElement<LoaderComparator.ComparatorSettings> {
public class LoaderComparator extends LoaderInteractionElement<LoaderComparator.ComparatorSettingsEnum> {
public LoaderComparator(Location location) {
super(location);
super(location, ComparatorSettingsEnum.INTERACT, ComparatorSettingsEnum.NOOP, ComparatorSettingsEnum.values());
}
public class ComparatorSettings implements ElementSettings {
private boolean interact = false;
private Comparator.Mode mode = Comparator.Mode.COMPARE;
@Override
public SWItem menu(Player player) {
return menu(player, interact, mode);
}
private SWItem menu(Player player, boolean interact, Comparator.Mode mode) {
SWItem swItem;
if (interact) {
swItem = new SWItem(Material.STICK, "§7Comparator§8: §eInteract");
} else if (mode == null) {
swItem = new SWItem(Material.STRUCTURE_VOID, "§7Comparator§8: §eNOOP");
} else {
swItem = new SWItem(Material.COMPARATOR, "§7Comparator§8: §e" + mode.name());
public enum ComparatorSettingsEnum implements LoaderSettingsEnum<Comparator, LoaderComparator, ComparatorSettingsEnum> {
NOOP {
@Override
public int getPos() {
return 2;
}
swItem.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)));
return swItem;
}
@Override
public void execute(Consumer<Long> delay) {
if (location.getBlock().getType() != Material.COMPARATOR) return;
Comparator comparator = (Comparator) location.getBlock().getBlockData();
if (interact) {
comparator.setMode(comparator.getMode() == Comparator.Mode.COMPARE ? Comparator.Mode.SUBTRACT : Comparator.Mode.COMPARE);
} else if (mode == null) {
return;
} else {
comparator.setMode(mode);
@Override
public SWItem menu(Player player, LoaderComparator parent, int power, long ticks) {
return new SWItem(Material.STRUCTURE_VOID, translateItemName("LOADER_BUTTON_COMPARATOR", "LOADER_INTERACTION_NOOP", player));
}
location.getBlock().setBlockData(comparator, true);
}
@Override
public void click(Player player, Runnable backAction, Runnable deleteAction) {
SWInventory swInventory = new SWInventory(player, 18, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).getItemStack(), clickType -> backAction.run());
swInventory.setItem(17, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_DELETE", player)).getItemStack(), clickType -> deleteAction.run());
swInventory.setItem(2, item(player, false, null).getItemStack(), clickType -> {
interact = false;
mode = null;
click(player, backAction, deleteAction);
});
swInventory.setItem(3, item(player, true, null).getItemStack(), clickType -> {
interact = true;
click(player, backAction, deleteAction);
});
swInventory.setItem(5, item(player, false, Comparator.Mode.COMPARE).getItemStack(), clickType -> {
interact = false;
mode = Comparator.Mode.COMPARE;
click(player, backAction, deleteAction);
});
swInventory.setItem(6, item(player, false, Comparator.Mode.SUBTRACT).getItemStack(), clickType -> {
interact = false;
mode = Comparator.Mode.SUBTRACT;
click(player, backAction, deleteAction);
});
swInventory.open();
}
private SWItem item(Player player, boolean interact, Comparator.Mode mode) {
SWItem swItem = menu(player, interact, mode);
if (swItem.getItemStack().equals(menu(player, this.interact, this.mode).getItemStack())) {
swItem.setEnchanted(true);
@Override
public void execute(Location location, Comparator blockData, LoaderComparator parent, int power, long ticks, Consumer<Long> delay) {
}
swItem.setLore(Collections.emptyList());
return swItem;
}
},
@Override
public void playerInteract() {
interact = true;
mode = null;
}
INTERACT {
@Override
public int getPos() {
return 3;
}
@Override
public void noop() {
interact = false;
mode = null;
@Override
public SWItem menu(Player player, LoaderComparator parent, int power, long ticks) {
return new SWItem(Material.STICK, translateItemName("LOADER_BUTTON_COMPARATOR", "LOADER_INTERACTION_INTERACT", player));
}
@Override
public void execute(Location location, Comparator blockData, LoaderComparator parent, int power, long ticks, Consumer<Long> delay) {
blockData.setMode(blockData.getMode() == Comparator.Mode.COMPARE ? Comparator.Mode.SUBTRACT : Comparator.Mode.COMPARE);
parent.update(blockData);
}
},
COMPARE {
@Override
public int getPos() {
return 5;
}
@Override
public SWItem menu(Player player, LoaderComparator parent, int power, long ticks) {
return new SWItem(Material.COMPARATOR, translateItemName("LOADER_BUTTON_COMPARATOR", "LOADER_INTERACTION_COMPARE", player));
}
@Override
public void execute(Location location, Comparator blockData, LoaderComparator parent, int power, long ticks, Consumer<Long> delay) {
blockData.setMode(Comparator.Mode.COMPARE);
parent.update(blockData);
}
},
SUBTRACT {
@Override
public int getPos() {
return 6;
}
@Override
public SWItem menu(Player player, LoaderComparator parent, int power, long ticks) {
return new SWItem(Material.COMPARATOR, translateItemName("LOADER_BUTTON_COMPARATOR", "LOADER_INTERACTION_SUBTRACT", player));
}
@Override
public void execute(Location location, Comparator blockData, LoaderComparator parent, int power, long ticks, Consumer<Long> delay) {
blockData.setMode(Comparator.Mode.SUBTRACT);
parent.update(blockData);
}
}
}
@ -136,7 +116,7 @@ public class LoaderComparator extends LoaderInteractionElement<LoaderComparator.
}
@Override
public ComparatorSettings createNewElement() {
return new ComparatorSettings();
public boolean checkBlockInWorld() {
return location.getBlock().getType() == Material.COMPARATOR;
}
}

Datei anzeigen

@ -19,137 +19,98 @@
package de.steamwar.bausystem.features.loader.elements.impl;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.loader.elements.ElementSettings;
import de.steamwar.bausystem.features.loader.elements.LoaderInteractionElement;
import de.steamwar.inventory.SWInventory;
import de.steamwar.bausystem.features.loader.elements.LoaderSettingsEnum;
import de.steamwar.inventory.SWItem;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.data.type.DaylightDetector;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.Collections;
import java.util.function.Consumer;
public class LoaderDaylightDetector extends LoaderInteractionElement<LoaderDaylightDetector.DaylightDetectorSettings> {
public class LoaderDaylightDetector extends LoaderInteractionElement<LoaderDaylightDetector.DaylightSettingsEnum> {
public LoaderDaylightDetector(Location location) {
super(location);
super(location, DaylightSettingsEnum.INTERACT, DaylightSettingsEnum.NOOP, DaylightSettingsEnum.values());
}
public class DaylightDetectorSettings implements ElementSettings {
private boolean noop = false;
private boolean interact = false;
private boolean inverted = true;
private int power = 0;
@Override
public SWItem menu(Player player) {
return menu(player, noop, interact, inverted);
}
private SWItem menu(Player player, boolean noop, boolean interact, boolean powered) {
SWItem swItem;
if (noop) {
swItem = new SWItem(Material.STRUCTURE_VOID, translateItemName("LOADER_BUTTON_DAYLIGHT_DETECTOR", "LOADER_INTERACTION_NOOP", player));
} else if (interact) {
swItem = new SWItem(Material.STICK, translateItemName("LOADER_BUTTON_DAYLIGHT_DETECTOR", "LOADER_INTERACTION_INTERACT", player));
} else {
swItem = new SWItem(Material.DAYLIGHT_DETECTOR, translateItemName("LOADER_BUTTON_DAYLIGHT_DETECTOR", powered ? "LOADER_INTERACTION_POWERED": "LOADER_INTERACTION_UNPOWERED", player));
}
swItem.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)));
return swItem;
}
@Override
public void execute(Consumer<Long> delay) {
if (location.getBlock().getType() != Material.DAYLIGHT_DETECTOR) return;
DaylightDetector daylightDetector = (DaylightDetector) location.getBlock().getBlockData();
if (noop) {
return;
} else if (interact) {
daylightDetector.setInverted(!daylightDetector.isInverted());
} else {
daylightDetector.setInverted(inverted);
}
daylightDetector.setPower(daylightDetector.isInverted() ? 15 - power : power);
location.getBlock().setBlockData(daylightDetector);
updateBlock(location.getBlock().getRelative(0, -1, 0));
}
@Override
public void click(Player player, Runnable backAction, Runnable deleteAction) {
SWInventory swInventory = new SWInventory(player, 36, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
for (int i = 27; i < 35; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
swInventory.setItem(27, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).getItemStack(), clickType -> backAction.run());
swInventory.setItem(35, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_DELETE", player)).getItemStack(), clickType -> deleteAction.run());
swInventory.setItem(2, item(player, true, false, false).getItemStack(), clickType -> {
noop = true;
click(player, backAction, deleteAction);
});
swInventory.setItem(3, item(player, false, true, false).getItemStack(), clickType -> {
noop = false;
interact = true;
click(player, backAction, deleteAction);
});
swInventory.setItem(5, item(player, false, false, false).getItemStack(), clickType -> {
noop = false;
interact = false;
inverted = false;
click(player, backAction, deleteAction);
});
swInventory.setItem(6, item(player, false, false, true).getItemStack(), clickType -> {
noop = false;
interact = false;
inverted = true;
click(player, backAction, deleteAction);
});
for (int i = 0; i < 16; i++) {
int finalI = i;
int finalI2 = i;
if (i >= 9) finalI2++;
swInventory.setItem(finalI2 + 9, item(player, finalI).getItemStack(), clickType -> {
power = finalI;
click(player, backAction, deleteAction);
});
public enum DaylightSettingsEnum implements LoaderSettingsEnum<DaylightDetector, LoaderDaylightDetector, DaylightSettingsEnum> {
NOOP {
@Override
public int getPos() {
return 2;
}
swInventory.open();
}
private SWItem item(Player player, boolean noop, boolean interact, boolean inverted) {
SWItem swItem = menu(player, noop, interact, inverted);
if (swItem.getItemStack().equals(menu(player, this.noop, this.interact, this.inverted).getItemStack())) {
swItem.setEnchanted(true);
@Override
public SWItem menu(Player player, LoaderDaylightDetector parent, int power, long ticks) {
return new SWItem(Material.STRUCTURE_VOID, translateItemName("LOADER_BUTTON_DAYLIGHT_DETECTOR", "LOADER_INTERACTION_NOOP", player));
}
swItem.setLore(Collections.emptyList());
return swItem;
}
private SWItem item(Player player, int power) {
SWItem swItem = new SWItem(power == 0 ? Material.GUNPOWDER : Material.REDSTONE, BauSystem.MESSAGE.parse("LOADER_SETTING_POWER", player, power));
swItem.getItemStack().setAmount(power == 0 ? 1 : power);
if (!this.noop && this.power == power) swItem.setEnchanted(true);
return swItem;
}
@Override
public void execute(Location location, DaylightDetector blockData, LoaderDaylightDetector parent, int power, long ticks, Consumer<Long> delay) {
}
},
@Override
public void playerInteract() {
noop = false;
interact = true;
inverted = false;
}
INTERACT {
@Override
public int getPos() {
return 3;
}
@Override
public void noop() {
noop = true;
interact = false;
inverted = false;
@Override
public SWItem menu(Player player, LoaderDaylightDetector parent, int power, long ticks) {
return new SWItem(Material.STICK, translateItemName("LOADER_BUTTON_DAYLIGHT_DETECTOR", "LOADER_INTERACTION_INTERACT", player));
}
@Override
public void execute(Location location, DaylightDetector blockData, LoaderDaylightDetector parent, int power, long ticks, Consumer<Long> delay) {
blockData.setInverted(!blockData.isInverted());
blockData.setPower(15 - blockData.getPower());
parent.update(blockData);
}
},
DAY_MODE {
@Override
public int getPos() {
return 5;
}
@Override
public SWItem menu(Player player, LoaderDaylightDetector parent, int power, long ticks) {
return new SWItem(Material.DAYLIGHT_DETECTOR, translateItemName("LOADER_BUTTON_DAYLIGHT_DETECTOR", "LOADER_INTERACTION_UNPOWERED", player));
}
@Override
public void execute(Location location, DaylightDetector blockData, LoaderDaylightDetector parent, int power, long ticks, Consumer<Long> delay) {
if (blockData.isInverted()) {
blockData.setInverted(false);
blockData.setPower(15 - blockData.getPower());
parent.update(blockData);
}
}
},
NIGHT_MODE {
@Override
public int getPos() {
return 6;
}
@Override
public SWItem menu(Player player, LoaderDaylightDetector parent, int power, long ticks) {
return new SWItem(Material.DAYLIGHT_DETECTOR, translateItemName("LOADER_BUTTON_DAYLIGHT_DETECTOR", "LOADER_INTERACTION_POWERED", player));
}
@Override
public void execute(Location location, DaylightDetector blockData, LoaderDaylightDetector parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.isInverted()) {
blockData.setInverted(true);
blockData.setPower(15 - blockData.getPower());
parent.update(blockData);
}
}
}
}
@ -159,7 +120,7 @@ public class LoaderDaylightDetector extends LoaderInteractionElement<LoaderDayli
}
@Override
public DaylightDetectorSettings createNewElement() {
return new DaylightDetectorSettings();
public boolean checkBlockInWorld() {
return location.getBlock().getType() == Material.DAYLIGHT_DETECTOR;
}
}

Datei anzeigen

@ -19,132 +19,493 @@
package de.steamwar.bausystem.features.loader.elements.impl;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.loader.elements.ElementSettings;
import de.steamwar.bausystem.features.loader.elements.LoaderInteractionElement;
import de.steamwar.inventory.SWInventory;
import de.steamwar.bausystem.features.loader.elements.LoaderSettingsEnum;
import de.steamwar.inventory.SWItem;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Lectern;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
import java.util.Arrays;
import java.util.Collections;
import java.util.function.Consumer;
public class LoaderLectern extends LoaderInteractionElement<LoaderLectern.LecternSettings> {
public class LoaderLectern extends LoaderInteractionElement<LoaderLectern.LecternSettingsEnum> {
public LoaderLectern(Location location) {
super(location);
super(location, LecternSettingsEnum.NEXT_PAGE, LecternSettingsEnum.NOOP, LecternSettingsEnum.values());
}
public class LecternSettings implements ElementSettings {
private boolean noop = true;
private LecternAction action = LecternAction.PAGE_NEXT;
private int page = 0;
@Override
public SWItem menu(Player player) {
return menu(player, noop, action, page);
}
private SWItem menu(Player player, boolean noop, LecternAction action, int page) {
SWItem swItem;
if (noop) {
swItem = new SWItem(Material.STRUCTURE_VOID, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_NOOP", player));
} else if (action == LecternAction.PAGE_PREV) {
swItem = new SWItem(Material.STICK, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE_PREV", player));
} else if (action == LecternAction.PAGE_NEXT) {
swItem = new SWItem(Material.STICK, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE_NEXT", player));
} else {
swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, page));
swItem.getItemStack().setAmount(page);
}
swItem.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)));
return swItem;
}
@Override
public void execute(Consumer<Long> delay) {
if (location.getBlock().getType() != Material.LECTERN) return;
Lectern lectern = (Lectern) location.getBlock().getState();
if (!((org.bukkit.block.data.type.Lectern) lectern.getBlockData()).hasBook()) return;
int pages = ((BookMeta) lectern.getInventory().getItem(0).getItemMeta()).getPages().size();
if (noop) {
return;
} else if (action == LecternAction.PAGE_PREV) {
int page = lectern.getPage();
if (page > 1) lectern.setPage(page - 1);
} else if (action == LecternAction.PAGE_NEXT) {
int page = lectern.getPage();
if (page < pages) lectern.setPage(page + 1);
} else if (action == LecternAction.PAGE_SET) {
if (page <= pages) lectern.setPage(page);
}
lectern.update(false, true);
}
@Override
public void click(Player player, Runnable backAction, Runnable deleteAction) {
SWInventory swInventory = new SWInventory(player, 36, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
for (int i = 27; i < 35; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
swInventory.setItem(27, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).getItemStack(), clickType -> backAction.run());
swInventory.setItem(35, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_DELETE", player)).getItemStack(), clickType -> deleteAction.run());
swInventory.setItem(2, item(player, true, LecternAction.PAGE_SET, 0).getItemStack(), clickType -> {
noop = true;
click(player, backAction, deleteAction);
});
swInventory.setItem(5, item(player, false, LecternAction.PAGE_PREV, 0).getItemStack(), clickType -> {
noop = false;
action = LecternAction.PAGE_PREV;
click(player, backAction, deleteAction);
});
swInventory.setItem(6, item(player, false, LecternAction.PAGE_NEXT, 0).getItemStack(), clickType -> {
noop = false;
action = LecternAction.PAGE_NEXT;
click(player, backAction, deleteAction);
});
for (int i = 0; i < 15; i++) {
int finalI = i;
int finalI2 = i;
if (i >= 9) finalI2++;
if (i >= 12) finalI2++;
swInventory.setItem(finalI2 + 9, item(player, false, LecternAction.PAGE_SET, finalI + 1).getItemStack(), clickType -> {
noop = false;
action = LecternAction.PAGE_SET;
page = finalI + 1;
click(player, backAction, deleteAction);
});
public enum LecternSettingsEnum implements LoaderSettingsEnum<org.bukkit.block.data.type.Lectern, LoaderLectern, LecternSettingsEnum> {
NOOP {
@Override
public int getPos() {
return 2;
}
swInventory.open();
}
private SWItem item(Player player, boolean noop, LecternAction action, int page) {
SWItem swItem = menu(player, noop, action, page);
if (swItem.getItemStack().equals(menu(player, this.noop, this.action, this.page).getItemStack())) {
swItem.setEnchanted(true);
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
return new SWItem(Material.STRUCTURE_VOID, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_NOOP", player));
}
swItem.setLore(Collections.emptyList());
return swItem;
}
@Override
public void noop() {
noop = true;
}
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
}
},
public enum LecternAction {
PAGE_NEXT,
PAGE_PREV,
PAGE_SET
PREVIOUS_PAGE {
@Override
public int getPos() {
return 5;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
return new SWItem(Material.STICK, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE_PREV", player));
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
if (lectern.getPage() > 0) {
lectern.setPage(lectern.getPage() - 1);
parent.update(blockData);
}
}
},
NEXT_PAGE {
@Override
public int getPos() {
return 6;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
return new SWItem(Material.STICK, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE_NEXT", player));
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (lectern.getPage() < pages) {
lectern.setPage(lectern.getPage() + 1);
parent.update(blockData);
}
}
},
PAGE_1 {
@Override
public int getPos() {
return 9;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, 1));
swItem.getItemStack().setAmount(1);
return swItem;
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (1 <= pages) {
lectern.setPage(1);
parent.update(blockData);
}
}
},
PAGE_2 {
@Override
public int getPos() {
return 10;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, 2));
swItem.getItemStack().setAmount(2);
return swItem;
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (2 <= pages) {
lectern.setPage(2);
parent.update(blockData);
}
}
},
PAGE_3 {
@Override
public int getPos() {
return 11;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, 3));
swItem.getItemStack().setAmount(3);
return swItem;
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (3 <= pages) {
lectern.setPage(3);
parent.update(blockData);
}
}
},
PAGE_4 {
@Override
public int getPos() {
return 12;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, 4));
swItem.getItemStack().setAmount(4);
return swItem;
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (4 <= pages) {
lectern.setPage(4);
parent.update(blockData);
}
}
},
PAGE_5 {
@Override
public int getPos() {
return 13;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, 5));
swItem.getItemStack().setAmount(5);
return swItem;
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (5 <= pages) {
lectern.setPage(5);
parent.update(blockData);
}
}
},
PAGE_6 {
@Override
public int getPos() {
return 14;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, 6));
swItem.getItemStack().setAmount(6);
return swItem;
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (6 <= pages) {
lectern.setPage(6);
parent.update(blockData);
}
}
},
PAGE_7 {
@Override
public int getPos() {
return 15;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, 7));
swItem.getItemStack().setAmount(7);
return swItem;
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (7 <= pages) {
lectern.setPage(7);
parent.update(blockData);
}
}
},
PAGE_8 {
@Override
public int getPos() {
return 16;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, 8));
swItem.getItemStack().setAmount(8);
return swItem;
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (8 <= pages) {
lectern.setPage(8);
parent.update(blockData);
}
}
},
PAGE_9 {
@Override
public int getPos() {
return 17;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, 9));
swItem.getItemStack().setAmount(9);
return swItem;
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (9 <= pages) {
lectern.setPage(9);
parent.update(blockData);
}
}
},
PAGE_10 {
@Override
public int getPos() {
return 19;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, 10));
swItem.getItemStack().setAmount(10);
return swItem;
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (10 <= pages) {
lectern.setPage(10);
parent.update(blockData);
}
}
},
PAGE_11 {
@Override
public int getPos() {
return 20;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, 11));
swItem.getItemStack().setAmount(11);
return swItem;
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (11 <= pages) {
lectern.setPage(11);
parent.update(blockData);
}
}
},
PAGE_12 {
@Override
public int getPos() {
return 21;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, 12));
swItem.getItemStack().setAmount(12);
return swItem;
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (12 <= pages) {
lectern.setPage(12);
parent.update(blockData);
}
}
},
PAGE_13 {
@Override
public int getPos() {
return 23;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, 13));
swItem.getItemStack().setAmount(13);
return swItem;
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (13 <= pages) {
lectern.setPage(13);
parent.update(blockData);
}
}
},
PAGE_14 {
@Override
public int getPos() {
return 24;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, 14));
swItem.getItemStack().setAmount(14);
return swItem;
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (14 <= pages) {
lectern.setPage(14);
parent.update(blockData);
}
}
},
PAGE_15 {
@Override
public int getPos() {
return 25;
}
@Override
public SWItem menu(Player player, LoaderLectern parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.LECTERN, translateItemName("LOADER_BUTTON_LECTERN", "LOADER_INTERACTION_PAGE", player, 15));
swItem.getItemStack().setAmount(15);
return swItem;
}
@Override
public void execute(Location location, org.bukkit.block.data.type.Lectern blockData, LoaderLectern parent, int power, long ticks, Consumer<Long> delay) {
if (!blockData.hasBook()) return;
Lectern lectern = (Lectern) location.getBlock().getState();
ItemStack itemStack = lectern.getInventory().getItem(0);
if (itemStack == null) return;
int pages = ((BookMeta) itemStack.getItemMeta()).getPages().size();
if (15 <= pages) {
lectern.setPage(15);
parent.update(blockData);
}
}
}
}
@Override
@ -153,7 +514,7 @@ public class LoaderLectern extends LoaderInteractionElement<LoaderLectern.Lecter
}
@Override
public LecternSettings createNewElement() {
return new LecternSettings();
public boolean checkBlockInWorld() {
return location.getBlock().getType() == Material.LECTERN;
}
}

Datei anzeigen

@ -19,108 +19,91 @@
package de.steamwar.bausystem.features.loader.elements.impl;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.loader.elements.ElementSettings;
import de.steamwar.bausystem.features.loader.elements.LoaderInteractionElement;
import de.steamwar.inventory.SWInventory;
import de.steamwar.bausystem.features.loader.elements.LoaderSettingsEnum;
import de.steamwar.inventory.SWItem;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.data.type.Switch;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.Collections;
import java.util.function.Consumer;
public class LoaderLever extends LoaderInteractionElement<LoaderLever.LeverSettings> {
public class LoaderLever extends LoaderInteractionElement<LoaderLever.LeverSettingsEnum> {
public LoaderLever(Location location) {
super(location);
super(location, LeverSettingsEnum.INTERACT, LeverSettingsEnum.NOOP, LeverSettingsEnum.values());
}
public class LeverSettings implements ElementSettings {
public enum LeverSettingsEnum implements LoaderSettingsEnum<Switch, LoaderLever, LeverSettingsEnum> {
private boolean noop = false;
private boolean interact = true;
private boolean power = false;
@Override
public SWItem menu(Player player) {
return menu(player, noop, interact, power);
}
private SWItem menu(Player player, boolean noop, boolean interact, boolean power) {
SWItem swItem;
if (noop) {
swItem = new SWItem(Material.STRUCTURE_VOID, translateItemName("LOADER_BUTTON_SWITCH", "LOADER_INTERACTION_NOOP", player));
} else if (interact) {
swItem = new SWItem(Material.STICK, translateItemName("LOADER_BUTTON_SWITCH", "LOADER_INTERACTION_INTERACT", player));
} else {
swItem = new SWItem(Material.LEVER, translateItemName("LOADER_BUTTON_SWITCH", power ? "LOADER_INTERACTION_ACTIVE" : "LOADER_INTERACTION_INACTIVE", player));
NOOP {
@Override
public int getPos() {
return 2;
}
swItem.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)));
return swItem;
}
@Override
public void execute(Consumer<Long> delay) {
if (location.getBlock().getType() != Material.LEVER) return;
if (noop) return;
Switch lever = (Switch) location.getBlock().getBlockData();
if (interact) {
lever.setPowered(!lever.isPowered());
} else {
lever.setPowered(power);
@Override
public SWItem menu(Player player, LoaderLever parent, int power, long ticks) {
return new SWItem(Material.STRUCTURE_VOID, translateItemName("LOADER_BUTTON_SWITCH", "LOADER_INTERACTION_NOOP", player));
}
location.getBlock().setBlockData(lever, true);
}
@Override
public void click(Player player, Runnable backAction, Runnable deleteAction) {
SWInventory swInventory = new SWInventory(player, 18, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).getItemStack(), clickType -> backAction.run());
swInventory.setItem(17, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_DELETE", player)).getItemStack(), clickType -> deleteAction.run());
swInventory.setItem(2, item(player, true, false, false).getItemStack(), clickType -> {
noop = true;
click(player, backAction, deleteAction);
});
swInventory.setItem(3, item(player, false, true, false).getItemStack(), clickType -> {
noop = false;
interact = true;
click(player, backAction, deleteAction);
});
swInventory.setItem(5, item(player, false, false, false).getItemStack(), clickType -> {
noop = false;
interact = false;
power = false;
click(player, backAction, deleteAction);
});
swInventory.setItem(6, item(player, false, false, true).getItemStack(), clickType -> {
noop = false;
interact = false;
power = true;
click(player, backAction, deleteAction);
});
swInventory.open();
}
private SWItem item(Player player, boolean noop, boolean interact, boolean power) {
SWItem swItem = menu(player, noop, interact, power);
if (swItem.getItemStack().equals(menu(player, this.noop, this.interact, this.power).getItemStack())) {
swItem.setEnchanted(true);
@Override
public void execute(Location location, Switch blockData, LoaderLever parent, int power, long ticks, Consumer<Long> delay) {
}
swItem.setLore(Collections.emptyList());
return swItem;
}
},
@Override
public void noop() {
noop = true;
INTERACT {
@Override
public int getPos() {
return 3;
}
@Override
public SWItem menu(Player player, LoaderLever parent, int power, long ticks) {
return new SWItem(Material.STICK, translateItemName("LOADER_BUTTON_SWITCH", "LOADER_INTERACTION_INTERACT", player));
}
@Override
public void execute(Location location, Switch blockData, LoaderLever parent, int power, long ticks, Consumer<Long> delay) {
blockData.setPowered(!blockData.isPowered());
parent.update(blockData);
}
},
POWER_OFF {
@Override
public int getPos() {
return 5;
}
@Override
public SWItem menu(Player player, LoaderLever parent, int power, long ticks) {
return new SWItem(Material.LEVER, translateItemName("LOADER_BUTTON_SWITCH", "LOADER_INTERACTION_INACTIVE", player));
}
@Override
public void execute(Location location, Switch blockData, LoaderLever parent, int power, long ticks, Consumer<Long> delay) {
blockData.setPowered(false);
parent.update(blockData);
}
},
POWER_ON {
@Override
public int getPos() {
return 6;
}
@Override
public SWItem menu(Player player, LoaderLever parent, int power, long ticks) {
return new SWItem(Material.LEVER, translateItemName("LOADER_BUTTON_SWITCH", "LOADER_INTERACTION_ACTIVE", player));
}
@Override
public void execute(Location location, Switch blockData, LoaderLever parent, int power, long ticks, Consumer<Long> delay) {
blockData.setPowered(true);
}
}
}
@ -130,7 +113,7 @@ public class LoaderLever extends LoaderInteractionElement<LoaderLever.LeverSetti
}
@Override
public LeverSettings createNewElement() {
return new LeverSettings();
public boolean checkBlockInWorld() {
return location.getBlock().getType() == Material.LEVER;
}
}

Datei anzeigen

@ -20,12 +20,9 @@
package de.steamwar.bausystem.features.loader.elements.impl;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.loader.elements.ElementSettings;
import de.steamwar.bausystem.features.loader.elements.LoaderInteractionElement;
import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWInventory;
import de.steamwar.bausystem.features.loader.elements.LoaderSettingsEnum;
import de.steamwar.inventory.SWItem;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.data.AnaloguePowerable;
@ -33,18 +30,16 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Powerable;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.Collections;
import java.util.function.Consumer;
public class LoaderMovement extends LoaderInteractionElement<LoaderMovement.MovementSettings> {
public class LoaderMovement extends LoaderInteractionElement<LoaderMovement.MovementSettingsEnum> {
private String name;
private Material material;
private boolean analogue;
public LoaderMovement(Location location, String name, Material material) {
super(location);
super(location, MovementSettingsEnum.NO_WAIT_FOR, MovementSettingsEnum.NOOP, MovementSettingsEnum.values());
this.name = name;
this.material = material;
this.analogue = location.getBlock().getBlockData() instanceof AnaloguePowerable;
@ -52,167 +47,108 @@ public class LoaderMovement extends LoaderInteractionElement<LoaderMovement.Move
public void setInitialTicks(long ticks) {
if (ticks < 1) ticks = 1;
elements.get(currentShot).ticks = ticks;
extraTicks.set(currentShot, ticks);
}
public class MovementSettings implements ElementSettings {
public enum MovementSettingsEnum implements LoaderSettingsEnum<BlockData, LoaderMovement, MovementSettingsEnum> {
private boolean noop = false;
private boolean waitFor = false;
private int power = 15;
private long ticks = 1;
@Override
public SWItem menu(Player player) {
return menu(player, noop, waitFor);
}
private SWItem menu(Player player, boolean noop, boolean waitFor) {
SWItem swItem;
if (noop) {
swItem = new SWItem(Material.STRUCTURE_VOID, translateItemName(name, "LOADER_INTERACTION_NOOP", player));
} else if (waitFor) {
swItem = new SWItem(material, translateItemName(name, "LOADER_INTERACTION_WAIT_FOR", player));
swItem.getItemStack().setAmount((int) Math.min(ticks, 64));
} else {
swItem = new SWItem(material, translateItemName(name, "LOADER_INTERACTION_NO_WAIT_FOR", player));
swItem.getItemStack().setAmount((int) Math.min(ticks, 64));
swItem.setEnchanted(true);
}
swItem.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)));
return swItem;
}
@Override
public void execute(Consumer<Long> delay) {
if (!(material == Material.STRING && location.getBlock().getType() == Material.TRIPWIRE) && location.getBlock().getType() != material) return;
if (noop) return;
BlockData blockData = location.getBlock().getBlockData();
if (blockData instanceof AnaloguePowerable) {
AnaloguePowerable analoguePowerable = (AnaloguePowerable) location.getBlock().getBlockData();
analoguePowerable.setPower(power);
location.getBlock().setBlockData(analoguePowerable, true);
update(analoguePowerable);
} else if (blockData instanceof Powerable) {
Powerable powerable = (Powerable) location.getBlock().getBlockData();
if (ticks < 0) {
powerable.setPowered(power > 0);
} else {
powerable.setPowered(true);
}
location.getBlock().setBlockData(powerable, true);
update(powerable);
NOOP {
@Override
public int getPos() {
return 2;
}
if (ticks >= 0) {
if (waitFor) {
delay.accept(ticks);
@Override
public SWItem menu(Player player, LoaderMovement parent, int power, long ticks) {
return new SWItem(Material.STRUCTURE_VOID, translateItemName(parent.name, "LOADER_INTERACTION_NOOP", player));
}
@Override
public void execute(Location location, BlockData blockData, LoaderMovement parent, int power, long ticks, Consumer<Long> delay) {
}
},
NO_WAIT_FOR {
@Override
public int getPos() {
return 5;
}
@Override
public SWItem menu(Player player, LoaderMovement parent, int power, long ticks) {
SWItem swItem = new SWItem(parent.material, translateItemName(parent.name, "LOADER_INTERACTION_WAIT_FOR", player));
swItem.getItemStack().setAmount((int) Math.min(ticks, 64));
return swItem;
}
@Override
public boolean hasPower(LoaderMovement parent) {
return parent.analogue;
}
@Override
public boolean hasTicks(LoaderMovement parent) {
return true;
}
@Override
public void execute(Location location, BlockData blockData, LoaderMovement parent, int power, long ticks, Consumer<Long> delay) {
if (blockData instanceof AnaloguePowerable) {
AnaloguePowerable analoguePowerable = (AnaloguePowerable) location.getBlock().getBlockData();
analoguePowerable.setPower(power);
parent.update(analoguePowerable);
} else if (blockData instanceof Powerable) {
Powerable powerable = (Powerable) location.getBlock().getBlockData();
if (ticks < 0) {
powerable.setPowered(power > 0);
} else {
powerable.setPowered(true);
}
parent.update(powerable);
}
BauSystem.runTaskLater(BauSystem.getInstance(), () -> {
if (blockData instanceof AnaloguePowerable) {
AnaloguePowerable analoguePowerable = (AnaloguePowerable) blockData;
analoguePowerable.setPower(0);
location.getBlock().setBlockData(analoguePowerable, true);
update(analoguePowerable);
parent.update(analoguePowerable);
} else {
Powerable powerable = (Powerable) blockData;
powerable.setPowered(false);
location.getBlock().setBlockData(powerable, true);
update(powerable);
parent.update(powerable);
}
}, ticks);
}
}
},
@Override
public void click(Player player, Runnable backAction, Runnable deleteAction) {
SWInventory swInventory = new SWInventory(player, analogue ? 45 : 27, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
for (int i = analogue ? 36 : 18; i < (analogue ? 44 : 26); i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
swInventory.setItem(analogue ? 36 : 18, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).getItemStack(), clickType -> backAction.run());
swInventory.setItem(analogue ? 44 : 26, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_DELETE", player)).getItemStack(), clickType -> deleteAction.run());
swInventory.setItem(2, item(player, true, false).getItemStack(), clickType -> {
noop = true;
click(player, backAction, deleteAction);
});
if (ticks >= 0) {
swInventory.setItem(5, item(player, false, false).getItemStack(), clickType -> {
noop = false;
waitFor = false;
click(player, backAction, deleteAction);
});
swInventory.setItem(6, item(player, false, true).getItemStack(), clickType -> {
noop = false;
waitFor = true;
click(player, backAction, deleteAction);
});
WAIT_FOR {
@Override
public int getPos() {
return 6;
}
swInventory.setItem(12, new SWItem(SWItem.getDye(1), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
ticks -= clickType.isShiftClick() ? 5 : 1;
if (ticks < 1) ticks = 1;
swInventory.setItem(13, item(player));
});
swInventory.setItem(13, item(player).getItemStack(), clickType -> {
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_NAME", player), ticks + "");
swAnvilInv.setCallback(s -> {
try {
ticks = Long.parseLong(s);
if (ticks < 1) ticks = 1;
} catch (NumberFormatException ignored) {
}
click(player, backAction, deleteAction);
});
swAnvilInv.open();
});
swInventory.setItem(14, new SWItem(SWItem.getDye(10), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_ADD_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
ticks += clickType.isShiftClick() ? 5 : 1;
swInventory.setItem(13, item(player));
});
if (analogue) {
for (int i = 0; i < 16; i++) {
int finalI = i;
int finalI2 = i;
if (i >= 9) finalI2++;
swInventory.setItem(finalI2 + 18, item(player, finalI).getItemStack(), clickType -> {
power = finalI;
click(player, backAction, deleteAction);
});
}
@Override
public SWItem menu(Player player, LoaderMovement parent, int power, long ticks) {
SWItem swItem = new SWItem(parent.material, translateItemName(parent.name, "LOADER_INTERACTION_NO_WAIT_FOR", player));
swItem.getItemStack().setAmount((int) Math.min(ticks, 64));
return swItem;
}
swInventory.open();
}
private SWItem item(Player player, boolean noop, boolean waitFor) {
SWItem swItem = menu(player, noop, waitFor);
if (swItem.getItemStack().equals(menu(player, this.noop, this.waitFor).getItemStack())) {
swItem.setEnchanted(true);
@Override
public boolean hasPower(LoaderMovement parent) {
return parent.analogue;
}
swItem.setLore(Collections.emptyList());
return swItem;
}
private SWItem item(Player player, int power) {
SWItem swItem = new SWItem(power == 0 ? Material.GUNPOWDER : Material.REDSTONE, BauSystem.MESSAGE.parse("LOADER_SETTING_POWER", player, power));
swItem.getItemStack().setAmount(power == 0 ? 1 : power);
if (!this.noop && this.power == power) swItem.setEnchanted(true);
return swItem;
}
@Override
public boolean hasTicks(LoaderMovement parent) {
return true;
}
private SWItem item(Player player) {
SWItem swItem = new SWItem(Material.CLOCK, BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS", player, ticks));
swItem.getItemStack().setAmount((int) Math.min(ticks, 64));
swItem.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)));
return swItem;
}
@Override
public void noop() {
noop = true;
waitFor = false;
@Override
public void execute(Location location, BlockData blockData, LoaderMovement parent, int power, long ticks, Consumer<Long> delay) {
NO_WAIT_FOR.execute(location, blockData, parent, power, ticks, delay);
delay.accept(ticks);
}
}
}
@ -222,7 +158,8 @@ public class LoaderMovement extends LoaderInteractionElement<LoaderMovement.Move
}
@Override
public MovementSettings createNewElement() {
return new MovementSettings();
public boolean checkBlockInWorld() {
if (material == Material.STRING && location.getBlock().getType() == Material.TRIPWIRE) return true;
return location.getBlock().getType() == material;
}
}

Datei anzeigen

@ -19,10 +19,8 @@
package de.steamwar.bausystem.features.loader.elements.impl;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.loader.elements.ElementSettings;
import de.steamwar.bausystem.features.loader.elements.LoaderInteractionElement;
import de.steamwar.inventory.SWInventory;
import de.steamwar.bausystem.features.loader.elements.LoaderSettingsEnum;
import de.steamwar.inventory.SWItem;
import org.bukkit.Instrument;
import org.bukkit.Location;
@ -30,80 +28,50 @@ import org.bukkit.Material;
import org.bukkit.block.data.type.NoteBlock;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.Collections;
import java.util.function.Consumer;
public class LoaderNoteBlock extends LoaderInteractionElement<LoaderNoteBlock.NoteBlockSettings> {
public class LoaderNoteBlock extends LoaderInteractionElement<LoaderNoteBlock.NoteBlockSettingsEnum> {
public LoaderNoteBlock(Location location) {
super(location);
super(location, NoteBlockSettingsEnum.INTERACT, NoteBlockSettingsEnum.NOOP, NoteBlockSettingsEnum.values());
}
public class NoteBlockSettings implements ElementSettings {
public enum NoteBlockSettingsEnum implements LoaderSettingsEnum<NoteBlock, LoaderNoteBlock, NoteBlockSettingsEnum> {
private boolean interact = true;
@Override
public SWItem menu(Player player) {
return menu(player, interact);
}
private SWItem menu(Player player, boolean interact) {
SWItem swItem;
if (interact) {
swItem = new SWItem(Material.NOTE_BLOCK, translateItemName("LOADER_BUTTON_NOTEBLOCK", "LOADER_INTERACTION_INTERACT", player));
} else {
swItem = new SWItem(Material.STRUCTURE_VOID, translateItemName("LOADER_BUTTON_NOTEBLOCK", "LOADER_INTERACTION_NOOP", player));
NOOP {
@Override
public int getPos() {
return 2;
}
swItem.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)));
return swItem;
}
@Override
public void execute(Consumer<Long> delay) {
if (location.getBlock().getType() != Material.NOTE_BLOCK) return;
NoteBlock noteBlock = (NoteBlock) location.getBlock().getBlockData();
if (interact) {
if (noteBlock.getInstrument() == Instrument.BANJO) noteBlock.setInstrument(Instrument.BIT);
else noteBlock.setInstrument(Instrument.BANJO);
} else {
return;
@Override
public SWItem menu(Player player, LoaderNoteBlock parent, int power, long ticks) {
return new SWItem(Material.STRUCTURE_VOID, translateItemName("LOADER_BUTTON_NOTEBLOCK", "LOADER_INTERACTION_NOOP", player));
}
location.getBlock().setBlockData(noteBlock);
}
@Override
public void click(Player player, Runnable backAction, Runnable deleteAction) {
SWInventory swInventory = new SWInventory(player, 18, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).getItemStack(), clickType -> backAction.run());
swInventory.setItem(17, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_DELETE", player)).getItemStack(), clickType -> deleteAction.run());
@Override
public void execute(Location location, NoteBlock blockData, LoaderNoteBlock parent, int power, long ticks, Consumer<Long> delay) {
swInventory.setItem(2, item(player, false).getItemStack(), clickType -> {
interact = false;
click(player, backAction, deleteAction);
});
swInventory.setItem(3, item(player, true).getItemStack(), clickType -> {
interact = true;
click(player, backAction, deleteAction);
});
swInventory.open();
}
private SWItem item(Player player, boolean interact) {
SWItem swItem = menu(player, interact);
if (swItem.getItemStack().equals(menu(player, this.interact).getItemStack())) {
swItem.setEnchanted(true);
}
swItem.setLore(Collections.emptyList());
return swItem;
}
},
@Override
public void noop() {
interact = false;
INTERACT {
@Override
public int getPos() {
return 3;
}
@Override
public SWItem menu(Player player, LoaderNoteBlock parent, int power, long ticks) {
return new SWItem(Material.NOTE_BLOCK, translateItemName("LOADER_BUTTON_NOTEBLOCK", "LOADER_INTERACTION_INTERACT", player));
}
@Override
public void execute(Location location, NoteBlock blockData, LoaderNoteBlock parent, int power, long ticks, Consumer<Long> delay) {
if (blockData.getInstrument() == Instrument.BANJO) blockData.setInstrument(Instrument.BIT);
else blockData.setInstrument(Instrument.BANJO);
parent.update(blockData);
}
}
}
@ -113,7 +81,7 @@ public class LoaderNoteBlock extends LoaderInteractionElement<LoaderNoteBlock.No
}
@Override
public NoteBlockSettings createNewElement() {
return new NoteBlockSettings();
public boolean checkBlockInWorld() {
return location.getBlock().getType() == Material.NOTE_BLOCK;
}
}

Datei anzeigen

@ -19,113 +19,97 @@
package de.steamwar.bausystem.features.loader.elements.impl;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.loader.elements.ElementSettings;
import de.steamwar.bausystem.features.loader.elements.LoaderInteractionElement;
import de.steamwar.inventory.SWInventory;
import de.steamwar.bausystem.features.loader.elements.LoaderSettingsEnum;
import de.steamwar.inventory.SWItem;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.data.Openable;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.Collections;
import java.util.function.Consumer;
public class LoaderOpenable extends LoaderInteractionElement<LoaderOpenable.TrapdoorSettings> {
public class LoaderOpenable extends LoaderInteractionElement<LoaderOpenable.OpenableSettingsEnum> {
private String name;
private Material material;
public LoaderOpenable(Location location, String name, Material material) {
super(location);
super(location, OpenableSettingsEnum.INTERACT, OpenableSettingsEnum.NOOP, OpenableSettingsEnum.values());
this.name = name;
this.material = material;
}
public class TrapdoorSettings implements ElementSettings {
public enum OpenableSettingsEnum implements LoaderSettingsEnum<Openable, LoaderOpenable, OpenableSettingsEnum> {
private boolean noop = false;
private boolean interact = true;
private boolean open = false;
@Override
public SWItem menu(Player player) {
return menu(player, noop, interact, open);
}
private SWItem menu(Player player, boolean noop, boolean interact, boolean powered) {
SWItem swItem;
if (noop) {
swItem = new SWItem(Material.STRUCTURE_VOID, translateItemName(name, "LOADER_INTERACTION_NOOP", player));
} else if (interact) {
swItem = new SWItem(Material.STICK, translateItemName(name, "LOADER_INTERACTION_INTERACT", player));
} else {
swItem = new SWItem(material, translateItemName(name, open ? "LOADER_INTERACTION_OPEN" : "LOADER_INTERACTION_CLOSED", player));
NOOP {
@Override
public int getPos() {
return 2;
}
swItem.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)));
return swItem;
}
@Override
public void execute(Consumer<Long> delay) {
if (location.getBlock().getType() != material) return;
Openable openable = (Openable) location.getBlock().getBlockData();
if (noop) {
return;
} else if (interact) {
openable.setOpen(!openable.isOpen());
} else {
openable.setOpen(open);
@Override
public SWItem menu(Player player, LoaderOpenable parent, int power, long ticks) {
return new SWItem(Material.STRUCTURE_VOID, translateItemName(parent.name, "LOADER_INTERACTION_NOOP", player));
}
location.getBlock().setBlockData(openable);
}
@Override
public void click(Player player, Runnable backAction, Runnable deleteAction) {
SWInventory swInventory = new SWInventory(player, 18, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).getItemStack(), clickType -> backAction.run());
swInventory.setItem(17, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_DELETE", player)).getItemStack(), clickType -> deleteAction.run());
swInventory.setItem(2, item(player, true, false, false).getItemStack(), clickType -> {
noop = true;
click(player, backAction, deleteAction);
});
swInventory.setItem(3, item(player, false, true, false).getItemStack(), clickType -> {
noop = false;
interact = true;
click(player, backAction, deleteAction);
});
swInventory.setItem(5, item(player, false, false, false).getItemStack(), clickType -> {
noop = false;
interact = false;
open = false;
click(player, backAction, deleteAction);
});
swInventory.setItem(6, item(player, false, false, true).getItemStack(), clickType -> {
noop = false;
interact = false;
open = true;
click(player, backAction, deleteAction);
});
swInventory.open();
}
private SWItem item(Player player, boolean noop, boolean interact, boolean open) {
SWItem swItem = menu(player, noop, interact, open);
if (swItem.getItemStack().equals(menu(player, this.noop, this.interact, this.open).getItemStack())) {
swItem.setEnchanted(true);
@Override
public void execute(Location location, Openable blockData, LoaderOpenable parent, int power, long ticks, Consumer<Long> delay) {
}
swItem.setLore(Collections.emptyList());
return swItem;
}
},
@Override
public void noop() {
noop = true;
INTERACT {
@Override
public int getPos() {
return 3;
}
@Override
public SWItem menu(Player player, LoaderOpenable parent, int power, long ticks) {
return new SWItem(Material.STICK, translateItemName(parent.name, "LOADER_INTERACTION_INTERACT", player));
}
@Override
public void execute(Location location, Openable blockData, LoaderOpenable parent, int power, long ticks, Consumer<Long> delay) {
blockData.setOpen(!blockData.isOpen());
parent.update(blockData);
}
},
CLOSED {
@Override
public int getPos() {
return 5;
}
@Override
public SWItem menu(Player player, LoaderOpenable parent, int power, long ticks) {
return new SWItem(parent.material, translateItemName(parent.name, "LOADER_INTERACTION_CLOSED", player));
}
@Override
public void execute(Location location, Openable blockData, LoaderOpenable parent, int power, long ticks, Consumer<Long> delay) {
blockData.setOpen(false);
parent.update(blockData);
}
},
OPEN {
@Override
public int getPos() {
return 6;
}
@Override
public SWItem menu(Player player, LoaderOpenable parent, int power, long ticks) {
return new SWItem(parent.material, translateItemName(parent.name, "LOADER_INTERACTION_OPEN", player));
}
@Override
public void execute(Location location, Openable blockData, LoaderOpenable parent, int power, long ticks, Consumer<Long> delay) {
blockData.setOpen(true);
parent.update(blockData);
}
}
}
@ -135,7 +119,7 @@ public class LoaderOpenable extends LoaderInteractionElement<LoaderOpenable.Trap
}
@Override
public TrapdoorSettings createNewElement() {
return new TrapdoorSettings();
public boolean checkBlockInWorld() {
return location.getBlock().getType() == material;
}
}

Datei anzeigen

@ -20,125 +20,140 @@
package de.steamwar.bausystem.features.loader.elements.impl;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.loader.elements.ElementSettings;
import de.steamwar.bausystem.features.loader.elements.LoaderInteractionElement;
import de.steamwar.inventory.SWInventory;
import de.steamwar.bausystem.features.loader.elements.LoaderSettingsEnum;
import de.steamwar.inventory.SWItem;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.data.type.Repeater;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.Collections;
import java.util.function.Consumer;
public class LoaderRepeater extends LoaderInteractionElement<LoaderRepeater.RepeaterSettings> {
public class LoaderRepeater extends LoaderInteractionElement<LoaderRepeater.RepeaterSettingsEnum> {
public LoaderRepeater(Location location) {
super(location);
super(location, RepeaterSettingsEnum.INTERACT, RepeaterSettingsEnum.NOOP, RepeaterSettingsEnum.values());
}
public class RepeaterSettings implements ElementSettings {
public enum RepeaterSettingsEnum implements LoaderSettingsEnum<Repeater, LoaderRepeater, RepeaterSettingsEnum> {
private boolean interact = false;
private int delay = 1;
@Override
public SWItem menu(Player player) {
return menu(player, interact, delay);
}
private SWItem menu(Player player, boolean interact, int delay) {
SWItem swItem;
if (interact) {
swItem = new SWItem(Material.STICK, translateItemName("LOADER_BUTTON_REPEATER", "LOADER_INTERACTION_INTERACT", player));
} else if (delay == 0) {
swItem = new SWItem(Material.STRUCTURE_VOID, translateItemName("LOADER_BUTTON_REPEATER", "LOADER_INTERACTION_NOOP", player));
} else {
swItem = new SWItem(Material.REPEATER, BauSystem.MESSAGE.parse("LOADER_SETTING_REPEATER", player, delay));
swItem.getItemStack().setAmount(delay);
NOOP {
@Override
public int getPos() {
return 1;
}
swItem.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)));
return swItem;
}
@Override
public void execute(Consumer<Long> __) {
if (location.getBlock().getType() != Material.REPEATER) return;
Repeater repeater = (Repeater) location.getBlock().getBlockData();
if (interact) {
int delay = repeater.getDelay();
delay++;
if (delay > 4) delay = 1;
repeater.setDelay(delay);
} else if (delay == 0) {
return;
} else {
repeater.setDelay(delay);
@Override
public SWItem menu(Player player, LoaderRepeater parent, int power, long ticks) {
return new SWItem(Material.STRUCTURE_VOID, translateItemName("LOADER_BUTTON_REPEATER", "LOADER_INTERACTION_NOOP", player));
}
location.getBlock().setBlockData(repeater, true);
}
@Override
public void click(Player player, Runnable backAction, Runnable deleteAction) {
SWInventory swInventory = new SWInventory(player, 18, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).getItemStack(), clickType -> backAction.run());
swInventory.setItem(17, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_DELETE", player)).getItemStack(), clickType -> deleteAction.run());
@Override
public void execute(Location location, Repeater blockData, LoaderRepeater parent, int power, long ticks, Consumer<Long> delay) {
swInventory.setItem(1, item(player, false, 0).getItemStack(), clickType -> {
interact = false;
delay = 0;
click(player, backAction, deleteAction);
});
swInventory.setItem(2, item(player, true, -1).getItemStack(), clickType -> {
interact = true;
click(player, backAction, deleteAction);
});
swInventory.setItem(4, item(player, false, 1).getItemStack(), clickType -> {
interact = false;
delay = 1;
click(player, backAction, deleteAction);
});
swInventory.setItem(5, item(player, false, 2).getItemStack(), clickType -> {
interact = false;
delay = 2;
click(player, backAction, deleteAction);
});
swInventory.setItem(6, item(player, false, 3).getItemStack(), clickType -> {
interact = false;
delay = 3;
click(player, backAction, deleteAction);
});
swInventory.setItem(7, item(player, false, 4).getItemStack(), clickType -> {
interact = false;
delay = 4;
click(player, backAction, deleteAction);
});
swInventory.open();
}
private SWItem item(Player player, boolean interact, int delay) {
SWItem swItem = menu(player, interact, delay);
if (swItem.getItemStack().equals(menu(player, this.interact, this.delay).getItemStack())) {
swItem.setEnchanted(true);
}
swItem.setLore(Collections.emptyList());
return swItem;
}
},
@Override
public void playerInteract() {
interact = true;
delay = 0;
}
INTERACT {
@Override
public int getPos() {
return 2;
}
@Override
public void noop() {
interact = false;
delay = 0;
@Override
public SWItem menu(Player player, LoaderRepeater parent, int power, long ticks) {
return new SWItem(Material.STICK, translateItemName("LOADER_BUTTON_REPEATER", "LOADER_INTERACTION_INTERACT", player));
}
@Override
public void execute(Location location, Repeater blockData, LoaderRepeater parent, int power, long ticks, Consumer<Long> delay) {
int repeaterDelay = blockData.getDelay();
repeaterDelay++;
if (repeaterDelay > 4) repeaterDelay = 1;
blockData.setDelay(repeaterDelay);
parent.update(blockData);
}
},
DELAY_1 {
@Override
public int getPos() {
return 4;
}
@Override
public SWItem menu(Player player, LoaderRepeater parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.REPEATER, BauSystem.MESSAGE.parse("LOADER_SETTING_REPEATER", player, 1));
swItem.getItemStack().setAmount(1);
return swItem;
}
@Override
public void execute(Location location, Repeater blockData, LoaderRepeater parent, int power, long ticks, Consumer<Long> delay) {
blockData.setDelay(1);
parent.update(blockData);
}
},
DELAY_2 {
@Override
public int getPos() {
return 5;
}
@Override
public SWItem menu(Player player, LoaderRepeater parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.REPEATER, BauSystem.MESSAGE.parse("LOADER_SETTING_REPEATER", player, 2));
swItem.getItemStack().setAmount(2);
return swItem;
}
@Override
public void execute(Location location, Repeater blockData, LoaderRepeater parent, int power, long ticks, Consumer<Long> delay) {
blockData.setDelay(2);
parent.update(blockData);
}
},
DELAY_3 {
@Override
public int getPos() {
return 6;
}
@Override
public SWItem menu(Player player, LoaderRepeater parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.REPEATER, BauSystem.MESSAGE.parse("LOADER_SETTING_REPEATER", player, 3));
swItem.getItemStack().setAmount(3);
return swItem;
}
@Override
public void execute(Location location, Repeater blockData, LoaderRepeater parent, int power, long ticks, Consumer<Long> delay) {
blockData.setDelay(3);
parent.update(blockData);
}
},
DELAY_4 {
@Override
public int getPos() {
return 7;
}
@Override
public SWItem menu(Player player, LoaderRepeater parent, int power, long ticks) {
SWItem swItem = new SWItem(Material.REPEATER, BauSystem.MESSAGE.parse("LOADER_SETTING_REPEATER", player, 4));
swItem.getItemStack().setAmount(4);
return swItem;
}
@Override
public void execute(Location location, Repeater blockData, LoaderRepeater parent, int power, long ticks, Consumer<Long> delay) {
blockData.setDelay(4);
parent.update(blockData);
}
}
}
@ -148,7 +163,7 @@ public class LoaderRepeater extends LoaderInteractionElement<LoaderRepeater.Repe
}
@Override
public RepeaterSettings createNewElement() {
return new RepeaterSettings();
public boolean checkBlockInWorld() {
return location.getBlock().getType() == Material.REPEATER;
}
}

Datei anzeigen

@ -20,23 +20,57 @@
package de.steamwar.bausystem.features.loader.elements.impl;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.loader.elements.LoaderElement;
import de.steamwar.bausystem.features.loader.elements.LoaderInteractionElement;
import de.steamwar.bausystem.features.loader.elements.LoaderSettingsEnum;
import de.steamwar.inventory.SWItem;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.function.Consumer;
public class LoaderTNT implements LoaderElement {
private Location location;
public class LoaderTNT extends LoaderInteractionElement<LoaderTNT.TNTSettingsEnum> {
public LoaderTNT(Location location) {
this.location = location;
super(location, TNTSettingsEnum.PLACE, TNTSettingsEnum.NOOP, TNTSettingsEnum.values());
}
public enum TNTSettingsEnum implements LoaderSettingsEnum<BlockData, LoaderTNT, TNTSettingsEnum> {
NOOP {
@Override
public int getPos() {
return 2;
}
@Override
public SWItem menu(Player player, LoaderTNT parent, int power, long ticks) {
return new SWItem(Material.STRUCTURE_VOID, translateItemName("LOADER_BUTTON_TNT", "LOADER_INTERACTION_NOOP", player));
}
@Override
public void execute(Location location, BlockData blockData, LoaderTNT parent, int power, long ticks, Consumer<Long> delay) {
}
},
PLACE {
@Override
public int getPos() {
return 3;
}
@Override
public SWItem menu(Player player, LoaderTNT parent, int power, long ticks) {
return new SWItem(Material.TNT, translateItemName("LOADER_BUTTON_TNT", "LOADER_INTERACTION_PLACE", player));
}
@Override
public void execute(Location location, BlockData blockData, LoaderTNT parent, int power, long ticks, Consumer<Long> delay) {
location.getBlock().setType(Material.TNT);
}
}
}
@Override
@ -54,10 +88,11 @@ public class LoaderTNT implements LoaderElement {
return;
}
block.setType(Material.TNT, true);
super.execute(delay);
}
@Override
public void click(Player player, Runnable backAction) {
public boolean checkBlockInWorld() {
return true;
}
}

Datei anzeigen

@ -20,120 +20,87 @@
package de.steamwar.bausystem.features.loader.elements.impl;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.loader.elements.ElementSettings;
import de.steamwar.bausystem.features.loader.elements.LoaderInteractionElement;
import de.steamwar.inventory.SWInventory;
import de.steamwar.bausystem.features.loader.elements.LoaderSettingsEnum;
import de.steamwar.inventory.SWItem;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.data.Powerable;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.Collections;
import java.util.function.Consumer;
public class LoaderTicks extends LoaderInteractionElement<LoaderTicks.TicksSettings> {
public class LoaderTicks extends LoaderInteractionElement<LoaderTicks.TicksSettingsEnum> {
private String name;
private Material material;
private int ticks;
public LoaderTicks(Location location, String name, Material material, int ticks) {
super(location);
super(location, TicksSettingsEnum.NO_WAIT_FOR, TicksSettingsEnum.NOOP, TicksSettingsEnum.values());
this.name = name;
this.material = material;
this.ticks = ticks;
}
public class TicksSettings implements ElementSettings {
public enum TicksSettingsEnum implements LoaderSettingsEnum<Powerable, LoaderTicks, TicksSettingsEnum> {
private boolean noop = false;
private boolean waitFor = false;
@Override
public SWItem menu(Player player) {
return menu(player, noop, waitFor);
}
private SWItem menu(Player player, boolean noop, boolean waitFor) {
SWItem swItem;
if (noop) {
swItem = new SWItem(Material.STRUCTURE_VOID, translateItemName(name, "LOADER_INTERACTION_NOOP", player));
} else if (waitFor) {
swItem = new SWItem(material, translateItemName(name, "LOADER_INTERACTION_WAIT_FOR", player, ticks));
} else {
swItem = new SWItem(material, translateItemName(name, "LOADER_INTERACTION_NO_WAIT_FOR", player, ticks));
swItem.setEnchanted(true);
}
swItem.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", player)));
return swItem;
}
@Override
public void execute(Consumer<Long> delay) {
if (location.getBlock().getType() != material) {
return;
}
if (noop) {
return;
NOOP {
@Override
public int getPos() {
return 2;
}
Powerable powerable = (Powerable) location.getBlock().getBlockData();
powerable.setPowered(true);
location.getBlock().setBlockData(powerable, true);
update(powerable);
if (waitFor) {
delay.accept((long) ticks);
}
BauSystem.runTaskLater(BauSystem.getInstance(), () -> {
powerable.setPowered(false);
location.getBlock().setBlockData(powerable, true);
update(powerable);
}, ticks);
}
@Override
public void click(Player player, Runnable backAction, Runnable deleteAction) {
SWInventory swInventory = new SWInventory(player, 18, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).getItemStack(), clickType -> backAction.run());
swInventory.setItem(17, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_DELETE", player)).getItemStack(), clickType -> deleteAction.run());
swInventory.setItem(2, item(player, true, false).getItemStack(), clickType -> {
noop = true;
click(player, backAction, deleteAction);
});
if (ticks >= 0) {
swInventory.setItem(5, item(player, false, false).getItemStack(), clickType -> {
noop = false;
waitFor = false;
click(player, backAction, deleteAction);
});
swInventory.setItem(6, item(player, false, true).getItemStack(), clickType -> {
noop = false;
waitFor = true;
click(player, backAction, deleteAction);
});
@Override
public SWItem menu(Player player, LoaderTicks parent, int power, long ticks) {
return new SWItem(Material.STRUCTURE_VOID, translateItemName(parent.name, "LOADER_INTERACTION_NOOP", player));
}
swInventory.open();
}
private SWItem item(Player player, boolean noop, boolean waitFor) {
SWItem swItem = menu(player, noop, waitFor);
if (swItem.getItemStack().equals(menu(player, this.noop, this.waitFor).getItemStack())) {
swItem.setEnchanted(true);
@Override
public void execute(Location location, Powerable blockData, LoaderTicks parent, int power, long ticks, Consumer<Long> delay) {
}
swItem.setLore(Collections.emptyList());
return swItem;
}
},
@Override
public void noop() {
noop = true;
NO_WAIT_FOR {
@Override
public int getPos() {
return 5;
}
@Override
public SWItem menu(Player player, LoaderTicks parent, int power, long ticks) {
return new SWItem(parent.material, translateItemName(parent.name, "LOADER_INTERACTION_NO_WAIT_FOR", player, ticks));
}
@Override
public void execute(Location location, Powerable blockData, LoaderTicks parent, int power, long ticks, Consumer<Long> delay) {
Powerable powerable = (Powerable) location.getBlock().getBlockData();
powerable.setPowered(true);
parent.update(powerable);
BauSystem.runTaskLater(BauSystem.getInstance(), () -> {
powerable.setPowered(false);
parent.update(powerable);
}, parent.ticks);
}
},
WAIT_FOR {
@Override
public int getPos() {
return 6;
}
@Override
public SWItem menu(Player player, LoaderTicks parent, int power, long ticks) {
return new SWItem(parent.material, translateItemName(parent.name, "LOADER_INTERACTION_WAIT_FOR", player, ticks));
}
@Override
public void execute(Location location, Powerable blockData, LoaderTicks parent, int power, long ticks, Consumer<Long> delay) {
NO_WAIT_FOR.execute(location, blockData, parent, power, ticks, delay);
delay.accept((long) parent.ticks);
}
}
}
@ -143,7 +110,7 @@ public class LoaderTicks extends LoaderInteractionElement<LoaderTicks.TicksSetti
}
@Override
public TicksSettings createNewElement() {
return new TicksSettings();
public boolean checkBlockInWorld() {
return location.getBlock().getType() == material;
}
}

Datei anzeigen

@ -32,12 +32,12 @@ public class LoadtimerCommand extends SWCommand {
}
@Register(value = "start", description = "LOADTIMER_HELP_START_1")
public void start(Player p) {
public void start(@Validator Player p) {
start(p, TimerMode.HALF);
}
@Register(value = "start", description = {"LOADTIMER_HELP_START_2", "LOADTIMER_HELP_START_3"})
public void start(Player p, TimerMode mode) {
public void start(@Validator Player p, TimerMode mode) {
Region r = Region.getRegion(p.getLocation());
if (r.isGlobal()) return;
if (!Loadtimer.hasTimer(r))
@ -45,7 +45,7 @@ public class LoadtimerCommand extends SWCommand {
}
@Register(value = "stop", description = "LOADTIMER_HELP_STOP")
public void stop(Player p) {
public void stop(@Validator Player p) {
Region r = Region.getRegion(p.getLocation());
if (r.isGlobal()) return;
if (Loadtimer.hasTimer(r))

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.observer;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import org.bukkit.entity.Player;
@ -46,13 +47,13 @@ public class ObserverTracerCommand extends SWCommand {
}
@Register(value = "delete", description = "OBSERVER_HELP_DELETE")
public void delete(Player p) {
public void delete(@Validator Player p) {
ObserverTracerListener.observerTracerMap.remove(p);
BauSystem.MESSAGE.send("OBSERVER_DELETE", p);
}
@Register(value = "retrace", description = "OBSERVER_HELP_RETRACE")
public void retrace(Player p) {
public void retrace(@Validator Player p) {
if (ObserverTracerListener.observerTracerMap.containsKey(p)) {
BauSystem.MESSAGE.send("OBSERVER_RETRACE_NO_TRACE", p);
return;

Datei anzeigen

@ -20,6 +20,8 @@
package de.steamwar.bausystem.features.observer;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
@ -55,6 +57,7 @@ public class ObserverTracerListener implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
if (!enabled.contains(event.getPlayer())) {
return;
}
@ -87,6 +90,11 @@ public class ObserverTracerListener implements Listener {
}
}
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getNewSpectator().forEach(observerTracerMap::remove);
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
enabled.add(event.getPlayer());

Datei anzeigen

@ -1,62 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.redstonetester;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.inventory.SWItem;
import de.steamwar.linkage.Linked;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
@Linked
public class RedstoneTesterGuiItem extends BauGuiItem {
public RedstoneTesterGuiItem() {
super(23);
}
@Override
public ItemStack getItem(Player player) {
return new SWItem(Material.REPEATER,
BauSystem.MESSAGE.parse("RT_ITEM_NAME", player),
Arrays.asList(BauSystem.MESSAGE.parse("RT_ITEM_LORE_1", player),
BauSystem.MESSAGE.parse("RT_ITEM_LORE_2", player),
BauSystem.MESSAGE.parse("RT_ITEM_LORE_3", player))
, false, null).getItemStack();
}
@Override
public boolean click(ClickType click, Player p) {
p.closeInventory();
p.performCommand("redstonetester");
return false;
}
@Override
public Permission permission() {
return Permission.MEMBER;
}
}

Datei anzeigen

@ -1,40 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.redstonetester;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import org.bukkit.entity.Player;
@Linked
public class RedstonetesterCommand extends SWCommand {
public RedstonetesterCommand() {
super("redstonetester", "rt");
}
@Register(description = "RT_HELP")
public void genericCommand(Player p) {
BauSystem.MESSAGE.send("RT_GIVEN", p);
SWUtils.giveItemToPlayer(p, RedstonetesterUtils.getWand(p));
}
}

Datei anzeigen

@ -1,108 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.redstonetester;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.bausystem.utils.ItemUtils;
import de.steamwar.inventory.SWItem;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.UtilityClass;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Powerable;
import org.bukkit.block.data.type.Piston;
import org.bukkit.block.data.type.RedstoneWire;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@UtilityClass
public class RedstonetesterUtils {
public static ItemStack getWand(Player player) {
ItemStack i = new SWItem(Material.BLAZE_ROD,
BauSystem.MESSAGE.parse("RT_ITEM_NAME", player),
Arrays.asList(BauSystem.MESSAGE.parse("RT_ITEM_LORE_1", player),
BauSystem.MESSAGE.parse("RT_ITEM_LORE_2", player),
BauSystem.MESSAGE.parse("RT_ITEM_LORE_3", player)),
false, null).getItemStack();
ItemUtils.setItem(i, "redstonetester");
return i;
}
@Getter
private final Map<Player, RedstoneTester> playerMap = new HashMap<>();
public void sendLocation(Player player, String prefix, Location location) {
BauSystem.MESSAGE.send("RT_LOC", player, location.getBlockX(), location.getBlockY(), location.getBlockZ());
}
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public boolean validBlock(Player player, BlockData block) {
if (block instanceof Powerable) return true;
if (block instanceof Piston) return true;
if (block instanceof RedstoneWire) return true;
BauSystem.MESSAGE.send("RT_INVALID_LOC", player);
return false;
}
@Getter
@Setter
public static class RedstoneTester {
private final Player player;
private Location loc1 = null;
private Location loc2 = null;
private long lastTick = 0;
private Long tick = null;
public RedstoneTester(Player player) {
this.player = player;
}
public void activate(Location location) {
if (loc1 == null || loc2 == null) {
tick = null;
return;
}
if (TPSUtils.currentRealTick.get() - lastTick > 100) {
tick = null;
}
if (loc1.equals(location)) {
lastTick = TPSUtils.currentRealTick.get();
if (tick == null) {
tick = TPSUtils.currentRealTick.get();
}
return;
}
if (tick != null && loc2.equals(location)) {
BauSystem.MESSAGE.send("RT_RESULT", player, (TPSUtils.currentRealTick.get() - tick), ((TPSUtils.currentRealTick.get() - tick) / 2.0));
}
}
}
}

Datei anzeigen

@ -1,94 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.redstonetester;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.utils.ItemUtils;
import de.steamwar.linkage.Linked;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.Objects;
@Linked
public class RestonetesterListener implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (!ItemUtils.isItem(event.getItem(), "redstonetester")) return;
Player player = event.getPlayer();
Block block = event.getClickedBlock();
event.setCancelled(true);
switch (event.getAction()) {
case RIGHT_CLICK_AIR:
if (player.isSneaking()) {
RedstonetesterUtils.getPlayerMap().remove(event.getPlayer());
BauSystem.MESSAGE.send("RT_ACTIVATE", player);
}
break;
case LEFT_CLICK_BLOCK:
if (!RedstonetesterUtils.validBlock(event.getPlayer(), Objects.requireNonNull(block).getBlockData())) return;
RedstonetesterUtils.getPlayerMap().computeIfAbsent(event.getPlayer(), RedstonetesterUtils.RedstoneTester::new).setLoc1(block.getLocation());
RedstonetesterUtils.sendLocation(event.getPlayer(), "POS1", block.getLocation());
break;
case RIGHT_CLICK_BLOCK:
if (!RedstonetesterUtils.validBlock(event.getPlayer(), Objects.requireNonNull(block).getBlockData())) return;
RedstonetesterUtils.getPlayerMap().computeIfAbsent(event.getPlayer(), RedstonetesterUtils.RedstoneTester::new).setLoc2(block.getLocation());
RedstonetesterUtils.sendLocation(event.getPlayer(), "POS2", block.getLocation());
break;
default:
break;
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
RedstonetesterUtils.getPlayerMap().remove(event.getPlayer());
}
@EventHandler
public void onPistonExtend(BlockPistonExtendEvent e) {
RedstonetesterUtils.getPlayerMap().forEach((player, redstoneTester) -> redstoneTester.activate(e.getBlock().getLocation()));
}
@EventHandler
public void onPistonRetract(BlockPistonRetractEvent e) {
RedstonetesterUtils.getPlayerMap().forEach((player, redstoneTester) -> redstoneTester.activate(e.getBlock().getLocation()));
}
@EventHandler
public void onRedstoneEvent(BlockRedstoneEvent e) {
RedstonetesterUtils.getPlayerMap().forEach((player, redstoneTester) -> redstoneTester.activate(e.getBlock().getLocation()));
}
@EventHandler
public void onBlockDispense(BlockDispenseEvent e) {
RedstonetesterUtils.getPlayerMap().forEach((player, redstoneTester) -> redstoneTester.activate(e.getBlock().getLocation()));
}
}

Datei anzeigen

@ -85,7 +85,7 @@ public class ColorCommand extends SWCommand {
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> validator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!bauServer.getOwner().equals(player.getUniqueId()), "REGION_COLOR_NO_PERMS");
return !messageSender.send(!bauServer.getOwner().equals(player.getUniqueId()), "NO_PERMISSION");
};
}

Datei anzeigen

@ -46,10 +46,6 @@ public class FireCommand extends SWCommand {
}
}
private String getNoPermMessage() {
return "REGION_FIRE_NO_PERMS";
}
private String getEnableMessage() {
return "REGION_FIRE_ENABLED";
}
@ -69,11 +65,4 @@ public class FireCommand extends SWCommand {
return false;
}
}
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> validator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), getNoPermMessage());
};
}
}

Datei anzeigen

@ -46,10 +46,6 @@ public class FreezeCommand extends SWCommand {
}
}
private String getNoPermMessage() {
return "REGION_FREEZE_NO_PERMS";
}
private String getEnableMessage(){
return "REGION_FREEZE_ENABLED";
}
@ -69,11 +65,4 @@ public class FreezeCommand extends SWCommand {
return true;
}
}
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> validator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), getNoPermMessage());
};
}
}

Datei anzeigen

@ -49,10 +49,6 @@ public class ItemsCommand extends SWCommand {
}
}
private String getNoPermMessage() {
return "REGION_ITEMS_NO_PERMS";
}
private String getEnableMessage(){
return "REGION_ITEMS_ENABLED";
}
@ -72,11 +68,4 @@ public class ItemsCommand extends SWCommand {
return true;
}
}
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> validator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), getNoPermMessage());
};
}
}

Datei anzeigen

@ -0,0 +1,66 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.region;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.NoGravityMode;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import org.bukkit.entity.Player;
@Linked
public class NoGravityCommand extends SWCommand {
public NoGravityCommand() {
super("nogravity");
}
@Register(description = "REGION_NO_GRAVITY_HELP")
public void toggleCommand(@Validator Player p) {
Region region = Region.getRegion(p.getLocation());
if (toggle(region)) {
RegionUtils.actionBar(region, getEnableMessage());
} else {
RegionUtils.actionBar(region, getDisableMessage());
}
}
private String getEnableMessage() {
return "REGION_NO_GRAVITY_ENABLED";
}
private String getDisableMessage() {
return "REGION_NO_GRAVITY_DISABLED";
}
private boolean toggle(Region region) {
switch (region.getPlain(Flag.NO_GRAVITY, NoGravityMode.class)) {
case ACTIVE:
region.set(Flag.NO_GRAVITY, NoGravityMode.INACTIVE);
return false;
default:
case INACTIVE:
region.set(Flag.NO_GRAVITY, NoGravityMode.ACTIVE);
return true;
}
}
}

Datei anzeigen

@ -0,0 +1,64 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.region;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.NoGravityMode;
import de.steamwar.bausystem.utils.ScoreboardElement;
import de.steamwar.linkage.Linked;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntitySpawnEvent;
@Linked
public class NoGravityListener implements Listener, ScoreboardElement {
private static NoGravityMode getMode(Region region) {
return region.getPlain(Flag.NO_GRAVITY, NoGravityMode.class);
}
@EventHandler
public void onEntitySpawn(EntitySpawnEvent event) {
if (event.getEntityType() == EntityType.PLAYER) return;
if (getMode(Region.getRegion(event.getLocation())) == NoGravityMode.ACTIVE) {
event.getEntity().setGravity(false);
}
}
@Override
public ScoreboardGroup getGroup() {
return ScoreboardGroup.REGION;
}
@Override
public int order() {
return 4;
}
@Override
public String get(Region region, Player p) {
if (region.get(Flag.NO_GRAVITY) == Flag.NO_GRAVITY.getDefaultValue()) return null;
return "§e" + BauSystem.MESSAGE.parse(Flag.NO_GRAVITY.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.NO_GRAVITY).getChatValue(), p);
}
}

Datei anzeigen

@ -54,13 +54,6 @@ public class ProtectCommand extends SWCommand {
}
}
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> validator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "REGION_PROTECT_NO_PERMS");
};
}
private Region regionCheck(Player player) {
Region region = Region.getRegion(player.getLocation());
if (region.getFloorLevel() == 0) {

Datei anzeigen

@ -19,31 +19,39 @@
package de.steamwar.bausystem.features.region;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.session.ClipboardHolder;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.util.SelectCommand;
import de.steamwar.bausystem.region.Prototype;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.bausystem.utils.PasteBuilder;
import de.steamwar.bausystem.utils.WorldEditUtils;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper;
import de.steamwar.command.TypeValidator;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import de.steamwar.sql.SchematicNode;
import net.md_5.bungee.api.chat.ClickEvent;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
@ -71,7 +79,7 @@ public class RegionCommand extends SWCommand {
}
@Register(value = "undo", description = "REGION_REGION_HELP_UNDO")
public void undoCommand(@Validator("WORLD_EDIT") Player p) {
public void undoCommand(@Validator Player p) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) return;
@ -83,7 +91,7 @@ public class RegionCommand extends SWCommand {
}
@Register(value = "redo", description = "REGION_REGION_HELP_REDO")
public void redoCommand(@Validator("WORLD_EDIT") Player p) {
public void redoCommand(@Validator Player p) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) {
return;
@ -97,7 +105,7 @@ public class RegionCommand extends SWCommand {
}
@Register(value = "restore", description = "REGION_REGION_HELP_RESTORE")
public void genericRestoreCommand(@Validator("WORLD_EDIT") Player p) {
public void genericRestoreCommand(@Validator Player p) {
Region region = Region.getRegion(p.getLocation());
if(checkGlobalRegion(region, p)) return;
@ -114,7 +122,7 @@ public class RegionCommand extends SWCommand {
}
@Register(value = "restore", description = "REGION_REGION_HELP_RESTORE_SCHEMATIC")
public void schematicRestoreCommand(@Validator("WORLD_EDIT") Player p, SchematicNode node) {
public void schematicRestoreCommand(@Validator Player p, SchematicNode node) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) return;
@ -164,36 +172,6 @@ public class RegionCommand extends SWCommand {
BauSystem.MESSAGE.send("REGION_REGION_TP_TEST_BLOCK", p);
}
@Register(value = "changetype", description = "REGION_REGION_HELP_CHANGETYPE_INFO")
@Register("type")
public void changeTypeCommand(Player p) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) {
return;
}
BauSystem.MESSAGE.send("REGION_REGION_CHANGETYPE_INFO", p, region.getPrototype().getDisplayName());
}
@Register(value = "changetype", description = "REGION_REGION_HELP_CHANGETYPE")
@Register("type")
public void changeTypeCommand(@Validator("WORLD") Player p, @Mapper("regionTypeMapper") String s) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) {
return;
}
Prototype prototype = Prototype.getByDisplayName(s);
if (prototype == null) {
BauSystem.MESSAGE.send("REGION_REGION_CHANGETYPE_UNKNOWN", p);
} else {
if (region.setPrototype(prototype)) {
BauSystem.MESSAGE.send("REGION_REGION_CHANGETYPE_CHANGE", p, s);
BauSystem.MESSAGE.send("REGION_REGION_CHANGETYPE_CHANGE_UPDATE", p, BauSystem.MESSAGE.parse("REGION_REGION_CHANGETYPE_CHANGE_UPDATE_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/reset"));
} else {
BauSystem.MESSAGE.send("REGION_REGION_CHANGETYPE_INVALID", p);
}
}
}
@Register(value = "changeskin", description = "REGION_REGION_HELP_CHANGESKIN_INFO")
@Register("skin")
public void changeSkinCommand(Player p) {
@ -210,7 +188,7 @@ public class RegionCommand extends SWCommand {
@Register(value = "changeskin", description = "REGION_REGION_HELP_CHANGESKIN")
@Register("skin")
public void changeSkinCommand(@Validator("WORLD") Player p, @Mapper("skinTypeMapper") String s) {
public void changeSkinCommand(@Validator Player p, @Mapper("skinTypeMapper") String s) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) {
return;
@ -227,26 +205,106 @@ public class RegionCommand extends SWCommand {
}
}
@Mapper(value = "regionTypeMapper", local = true)
private TypeMapper<String> regionTypeMapper() {
return new TypeMapper<String>() {
@Override
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
Player p = (Player) commandSender;
Region region = Region.getRegion(p.getLocation());
if (region.isGlobal()) {
return Collections.emptyList();
}
return region.getPrototypes().stream().map(Prototype::getByName).map(Prototype::getDisplayName).map(c -> c.replace(' ', '_')).collect(Collectors.toList());
}
@Register(value = "copy", description = "REGION_REGION_HELP_COPY")
public void copyCommand(@Validator Player p, @OptionalValue("") @StaticValue(value = {"", "-e", "-s"}, allowISE = true) int option) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) {
return;
}
if (!region.hasType(RegionType.BUILD)) {
BauSystem.MESSAGE.send("REGION_REGION_NO_BUILD", p);
return;
}
if (region.getCopyPoint() == null) {
BauSystem.MESSAGE.send("REGION_REGION_TP_UNKNOWN", p);
return;
}
@Override
public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
return s.replace('_', ' ');
}
};
Point minPoint = region.getMinPoint(RegionType.BUILD, RegionExtensionType.NORMAL);
Point maxPoint = region.getMaxPoint(RegionType.BUILD, RegionExtensionType.NORMAL);
switch (option) {
case 0:
break;
case 1:
minPoint = region.getMinPoint(RegionType.BUILD, RegionExtensionType.EXTENSION);
maxPoint = region.getMaxPoint(RegionType.BUILD, RegionExtensionType.EXTENSION);
break;
case 2:
Pair<Location, Location> selection = WorldEditUtils.getSelection(p);
minPoint = Point.fromLocation(selection.getKey());
maxPoint = Point.fromLocation(selection.getValue());
break;
default:
break;
}
Clipboard clipboard = FlatteningWrapper.impl.copy(minPoint, maxPoint, region.getCopyPoint());
WorldEdit.getInstance()
.getSessionManager()
.get(BukkitAdapter.adapt(p))
.setClipboard(new ClipboardHolder(clipboard));
BauSystem.MESSAGE.send("REGION_REGION_COPY_DONE", p);
}
@Register(value = "paste", description = "REGION_REGION_HELP_PASTE")
public void pasteCommand(@Validator Player p, @OptionalValue("") @StaticValue(value = {"", "-a", "-s", "-as", "-sa"}, allowISE = true) int options) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) {
return;
}
if (!region.hasType(RegionType.BUILD)) {
BauSystem.MESSAGE.send("REGION_REGION_NO_BUILD", p);
return;
}
if (region.getCopyPoint() == null) {
BauSystem.MESSAGE.send("REGION_REGION_TP_UNKNOWN", p);
return;
}
ClipboardHolder clipboardHolder = WorldEdit.getInstance()
.getSessionManager()
.get(BukkitAdapter.adapt(p))
.getClipboard();
boolean selectPasted = false;
boolean ignoreAir = false;
switch (options) {
case 0:
break;
case 1:
ignoreAir = true;
break;
case 2:
selectPasted = true;
break;
case 3:
case 4:
selectPasted = true;
ignoreAir = true;
break;
default:
break;
}
try (EditSession e = WorldEditUtils.getEditSession(p)) {
Operations.completeBlindly(clipboardHolder.createPaste(e).ignoreAirBlocks(ignoreAir).to(toBlockVector3(region.getCopyPoint())).build());
WorldEditUtils.addToPlayer(p, e);
if (selectPasted) {
Clipboard clipboard = clipboardHolder.getClipboards().get(0);
BlockVector3 minPointSelection = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin()).add(toBlockVector3(region.getCopyPoint()));
BlockVector3 maxPointSelection = clipboard.getRegion().getMaximumPoint().subtract(clipboard.getOrigin()).add(toBlockVector3(region.getCopyPoint()));
FlatteningWrapper.impl.setSelection(p, Point.fromBlockVector3(minPointSelection), Point.fromBlockVector3(maxPointSelection));
}
BauSystem.MESSAGE.send("REGION_REGION_PASTE_DONE", p);
}
}
private BlockVector3 toBlockVector3(Point point) {
return BlockVector3.at(point.getX(), point.getY(), point.getZ());
}
@Mapper(value = "skinTypeMapper", local = true)
private TypeMapper<String> skinTypeMapper() {
return new TypeMapper<String>() {
@ -266,18 +324,4 @@ public class RegionCommand extends SWCommand {
}
};
}
@Validator(value = "WORLD", local = true)
public TypeValidator<Player> worldValidator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "REGION_REGION_NO_PERMS");
};
}
@Validator(value = "WORLD_EDIT", local = true)
public TypeValidator<Player> worldEditValidator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "REGION_REGION_NO_PERMS");
};
}
}

Datei anzeigen

@ -97,13 +97,6 @@ public class ResetCommand extends SWCommand {
}
}
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> validator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "REGION_RESET_NO_PERMS");
};
}
private Region regionCheck(Player player) {
Region region = Region.getRegion(player.getLocation());
if (region == GlobalRegion.getInstance()) {

Datei anzeigen

@ -74,6 +74,9 @@ public class TNTCommand extends SWCommand {
case ONLY_TB:
requestedMessage = getTestblockEnableMessage();
break;
case ONLY_BUILD:
requestedMessage = getBuildEnableMessage();
break;
}
tntToggle(region, tntMode, requestedMessage);
}
@ -89,6 +92,7 @@ public class TNTCommand extends SWCommand {
Map<String, TNTMode> tntModeMap = new HashMap<>(tntModeMapReduced);
tntModeMap.put("testblock", TNTMode.ONLY_TB);
tntModeMap.put("tb", TNTMode.ONLY_TB);
tntModeMap.put("build", TNTMode.ONLY_BUILD);
return new TypeMapper<TNTMode>() {
@Override
@ -125,6 +129,10 @@ public class TNTCommand extends SWCommand {
return "REGION_TNT_TB";
}
private String getBuildEnableMessage() {
return "REGION_TNT_BUILD";
}
private void tntToggle(Region region, TNTMode requestedMode, String requestedMessage) {
if (requestedMode != null && region.hasType(RegionType.TESTBLOCK) && region.hasType(RegionType.BUILD)) {
region.set(Flag.TNT, requestedMode);
@ -134,6 +142,7 @@ public class TNTCommand extends SWCommand {
switch (region.getPlain(Flag.TNT, TNTMode.class)) {
case ALLOW:
case ONLY_TB:
case ONLY_BUILD:
region.set(Flag.TNT, TNTMode.DENY);
RegionUtils.actionBar(region, getDisableMessage());
break;
@ -148,11 +157,4 @@ public class TNTCommand extends SWCommand {
break;
}
}
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> validator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "REGION_TNT_NO_PERMS");
};
}
}

Datei anzeigen

@ -28,12 +28,8 @@ import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.utils.ScoreboardElement;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
@ -47,22 +43,29 @@ import java.util.concurrent.atomic.AtomicBoolean;
public class TNTListener implements Listener, ScoreboardElement {
private void explode(List<Block> blockList) {
AtomicBoolean inBuild = new AtomicBoolean();
blockList.removeIf(block -> {
Region region = Region.getRegion(block.getLocation());
TNTMode value = region.getPlain(Flag.TNT);
if (value == TNTMode.ALLOW) {
return false;
}
if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.NORMAL)) {
RegionUtils.actionBar(region, "REGION_TNT_BUILD");
inBuild.set(true);
return true;
}
if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) {
RegionUtils.actionBar(region, "REGION_TNT_BUILD");
inBuild.set(true);
return true;
} else if (value == TNTMode.ONLY_TB) {
if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.NORMAL)) {
RegionUtils.actionBar(region, "REGION_TNT_BUILD_DESTROY");
return true;
}
if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) {
RegionUtils.actionBar(region, "REGION_TNT_BUILD_DESTROY");
return true;
}
} else if (value == TNTMode.ONLY_BUILD) {
if (region.hasType(RegionType.TESTBLOCK) && region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.NORMAL)) {
RegionUtils.actionBar(region, "REGION_TNT_TB_DESTROY");
return true;
}
if (region.hasType(RegionType.TESTBLOCK) && region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) {
RegionUtils.actionBar(region, "REGION_TNT_TB_DESTROY");
return true;
}
}
return value == TNTMode.DENY;
});

Datei anzeigen

@ -157,11 +157,6 @@ public class TestblockCommand extends SWCommand {
};
}
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> validator() {
return (commandSender, player, messageSender) -> !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "REGION_TB_NO_PERMS");
}
private Region regionCheck(Player player) {
Region region = Region.getRegion(player.getLocation());
if (!region.hasType(RegionType.TESTBLOCK)) {
@ -192,44 +187,12 @@ public class TestblockCommand extends SWCommand {
};
}
public static class TestblockParameter {
private boolean water = false;
private boolean tnt = false;
private boolean extension = false;
private boolean onlyColor = false;
private boolean ignoreAir = false;
public void enableWater() {
this.water = true;
}
public void enableTNT() {
this.tnt = true;
}
public void enableExtension() {
this.extension = true;
}
public void enableOnlyColor() {
this.onlyColor = true;
}
public void enableIgnoreAir() {
this.ignoreAir = true;
}
}
public enum TestblockParameterType {
EXTENSION(TestblockParameter::enableExtension, Arrays.asList("-e", "-extension")),
TNT(TestblockParameter::enableTNT, Arrays.asList("-t", "-tnt")),
WATER(TestblockParameter::enableWater, Arrays.asList("-w", "-water")),
IGNORE_AIR(TestblockParameter::enableIgnoreAir, Arrays.asList("-ig", "-ignore_air")),
ONLY_COLOR(TestblockParameter::enableOnlyColor, Arrays.asList("-o", "-color", "-only_color"));
@Getter
private final Consumer<TestblockParameter> testblockParameterConsumer;
EXTENSION(Arrays.asList("-e", "-extension")),
TNT(Arrays.asList("-t", "-tnt")),
WATER(Arrays.asList("-w", "-water")),
IGNORE_AIR(Arrays.asList("-ig", "-ignore_air")),
ONLY_COLOR(Arrays.asList("-o", "-color", "-only_color"));
@Getter
private List<String> tabCompletes;
@ -238,8 +201,7 @@ public class TestblockCommand extends SWCommand {
private final Supplier<TestblockParameterType[]> removed;
private AtomicReference<TestblockParameterType[]> cached = new AtomicReference<>();
TestblockParameterType(Consumer<TestblockParameter> testblockParameterConsumer, List<String> tabCompletes, String... removed) {
this.testblockParameterConsumer = testblockParameterConsumer;
TestblockParameterType(List<String> tabCompletes, String... removed) {
this.tabCompletes = tabCompletes;
this.removed = () -> {
if (cached.get() == null) {

Datei anzeigen

@ -57,6 +57,6 @@ public class FireBauGuiItem extends BauGuiItem {
@Override
public Permission permission() {
return Permission.WORLD;
return Permission.BUILD;
}
}

Datei anzeigen

@ -57,6 +57,6 @@ public class FreezeBauGuiItem extends BauGuiItem {
@Override
public Permission permission() {
return Permission.WORLD;
return Permission.BUILD;
}
}

Datei anzeigen

@ -58,6 +58,6 @@ public class ProtectBauGuiItem extends BauGuiItem {
@Override
public Permission permission() {
return Permission.WORLDEDIT;
return Permission.BUILD;
}
}

Datei anzeigen

@ -65,6 +65,6 @@ public class ResetBauGuiItem extends BauGuiItem {
@Override
public Permission permission() {
return Permission.WORLDEDIT;
return Permission.BUILD;
}
}

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen