SteamWar/BauSystem2.0
Archiviert
12
0

Commits vergleichen

..

372 Commits
QOL ... master

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
237 geänderte Dateien mit 10900 neuen und 7062 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

@ -0,0 +1,23 @@
/*
* 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;
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

@ -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

@ -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

@ -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

@ -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-Diff unterdrückt, da er zu groß ist Diff laden

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

Datei anzeigen

@ -21,16 +21,20 @@ package de.steamwar.bausystem;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.configplayer.Config;
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.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;
@ -48,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();
@ -72,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
@ -135,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();
@ -153,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) {

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

@ -1,93 +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.autodust;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.bausystem.region.Color;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import java.util.regex.Pattern;
@Linked
public class AutoDustCommand extends SWCommand implements Listener {
private static final Pattern COLORED_BLOCK_REGEX = Pattern.compile(
"^(\\w+?)_(wool|stained_glass|concrete_powder|concrete|glazed_terracotta|terracotta)$"
);
public AutoDustCommand() {
super("autodust", "dust");
}
@Register
public void genericCommand(Player p) {
boolean autoDust = Config.getInstance().get(p).getPlainValueOrDefault("autodust", false);
Config.getInstance().get(p).put("autodust", !autoDust);
if(!autoDust) {
BauSystem.MESSAGE.send("AUTODUST_ENABLE",p);
SWUtils.sendToActionbar(p, BauSystem.MESSAGE.parse("AUTODUST_ENABLE", p));
}else {
BauSystem.MESSAGE.send("AUTODUST_DISABLE",p);
SWUtils.sendToActionbar(p, BauSystem.MESSAGE.parse("AUTODUST_DISABLE", p));
}
}
@EventHandler
public void onPlayerInteract(BlockPlaceEvent event) {
Player p = event.getPlayer();
if(!Config.getInstance().get(p).getPlainValueOrDefault("autodust", false)) return;
Block placed = event.getBlockPlaced();
if (!placed.getType().isBlock() || !placed.getType().isSolid()) {
return;
}
String type = placed.getType().name();
boolean isColored = false;
for (Color color : Color.values()) {
if (type.startsWith(color.name() + "_")) {
isColored = true;
break;
}
}
if (!isColored) {
return;
}
Block above = placed.getRelative(BlockFace.UP);
if (!above.isEmpty()) {
return;
}
above.setType(Material.REDSTONE_WIRE);
}
}

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,8 +30,11 @@ 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;
@ -39,11 +43,9 @@ 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 {
@ -66,6 +68,7 @@ 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;
}
@ -75,6 +78,12 @@ public class AutostartListener implements Listener {
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());
}
@ -83,6 +92,7 @@ public class AutostartListener implements Listener {
if (!(event.getPlayer() instanceof Player)) {
return;
}
if(!Permission.BUILD.hasPermission((Player) event.getPlayer())) return;
if (!ItemUtils.isItem(event.getPlayer().getInventory().getItemInMainHand(), "autostart")) {
return;
}
@ -117,15 +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);
long preFightDurationInSeconds = getPreFightDurationInSeconds(region);
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT1", tickDiff);
RegionUtils.message(region, "AUTOSTART_MESSAGE_RESULT2", 30, (600 - 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;
@ -130,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();
}
@ -140,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,6 +1,7 @@
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.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
@ -12,7 +13,7 @@ import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.entity.Player;
import java.util.List;
import java.util.*;
@Linked
public class InfoCommand extends SWCommand {
@ -24,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()) {
@ -47,18 +39,28 @@ 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, members.size()));
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));
@ -69,4 +71,16 @@ public class InfoCommand extends SWCommand {
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

@ -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,6 +54,17 @@ 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);
});
}
public void calc() {
@ -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,12 +124,10 @@ 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.sendPrefixless("DESIGN_ENDSTONE_DISABLE", player, ChatMessageType.ACTION_BAR);
} else {
players.add(player);
entityServer.addPlayer(player);
calc();
BauSystem.MESSAGE.sendPrefixless("DESIGN_ENDSTONE_ENABLE", player, ChatMessageType.ACTION_BAR);
@ -108,7 +135,7 @@ public class DesignEndStone {
}
public boolean removePlayer(Player player) {
players.remove(player);
return players.isEmpty();
entityServer.removePlayer(player);
return entityServer.getPlayers().isEmpty();
}
}

Datei anzeigen

@ -22,6 +22,7 @@ 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;
@ -33,6 +34,7 @@ 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
@ -45,7 +47,7 @@ public class DesignEndStoneCommand extends SWCommand implements Listener {
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);
@ -56,14 +58,20 @@ public class DesignEndStoneCommand extends SWCommand implements Listener {
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Region region = Region.getRegion(event.getPlayer().getLocation());
DesignEndStone designEndStone = designEndStoneMap.get(region);
if (designEndStone == null) {
return;
}
if (designEndStone.removePlayer(event.getPlayer())) {
designEndStoneMap.remove(region);
}
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

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,7 +43,22 @@ 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.5;
@ -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;
@ -38,7 +39,10 @@ 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 {
@ -70,12 +74,17 @@ 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()) {
@ -90,6 +99,20 @@ public class Loader implements Listener {
}, 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;
@ -347,6 +370,7 @@ public class Loader implements Listener {
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");
@ -102,10 +103,20 @@ public class LoaderCommand extends SWCommand {
loader.setTicksBetweenBlocks(delay);
}
@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 = "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

@ -43,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 {
@ -124,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<>();
@ -226,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

@ -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

@ -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

@ -157,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

@ -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.WORLDEDIT), "REGION_TB_NO_PERMS");
}
private Region regionCheck(Player player) {
Region region = Region.getRegion(player.getLocation());
if (!region.hasType(RegionType.TESTBLOCK)) {

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;
}
}

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -31,7 +31,7 @@ public class ScriptCommand extends SWCommand {
}
@Register
public void genericCommand(Player player) {
public void genericCommand(@Validator Player player) {
ScriptGUI.open(player);
}
}

Datei anzeigen

@ -19,6 +19,8 @@
package de.steamwar.bausystem.features.script;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.linkage.Linked;
import org.bukkit.entity.Player;
@ -42,6 +44,8 @@ public class ScriptListener implements Listener {
@EventHandler(priority = EventPriority.HIGH)
public void onLeftClick(PlayerInteractEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
ItemStack item = event.getItem();
if (item == null || FlatteningWrapper.impl.isNoBook(item) || item.getItemMeta() == null) {
return;
@ -68,6 +72,13 @@ public class ScriptListener implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
ScriptRunner.updateGlobalScript(event.getPlayer());
}
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getNewSpectator().forEach(ScriptRunner::remove);
event.getNewBuilder().forEach(ScriptRunner::updateGlobalScript);
}
}

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bausystem.features.script.event;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.script.ScriptRunner;
import de.steamwar.linkage.Linked;
import org.bukkit.entity.Player;
@ -41,6 +42,7 @@ public class CommandListener implements Listener {
@EventHandler
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
String[] split = event.getMessage().split(" ");
if (calledCommands.getOrDefault(event.getPlayer(), new HashSet<>()).contains(split[0])) {
return;

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.script.event;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.script.ScriptRunner;
import de.steamwar.bausystem.features.script.lua.SteamWarGlobalLuaPlugin;
import de.steamwar.bausystem.features.script.lua.libs.StorageLib;
@ -64,17 +65,20 @@ public class EventListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.SelfJoin, LuaValue.NIL, event);
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerQuit(PlayerQuitEvent event) {
StorageLib.removePlayer(event.getPlayer());
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.SelfLeave, LuaValue.NIL, event);
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerSwapHandItems(PlayerSwapHandItemsEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
if (LAST_FS.containsKey(event.getPlayer())) {
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.DoubleSwap, LuaValue.NIL, event);
@ -86,6 +90,7 @@ public class EventListener implements Listener {
@EventHandler(priority = EventPriority.HIGH)
public void onBlockPlace(BlockPlaceEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
LuaTable table = new LuaTable();
table.set("x", event.getBlock().getX());
table.set("y", event.getBlock().getY());
@ -96,6 +101,7 @@ public class EventListener implements Listener {
@EventHandler(priority = EventPriority.HIGH)
public void onBlockBreak(BlockBreakEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
LuaTable table = new LuaTable();
table.set("x", event.getBlock().getX());
table.set("y", event.getBlock().getY());
@ -108,6 +114,7 @@ public class EventListener implements Listener {
@EventHandler(priority = EventPriority.LOW)
public void onPlayerInteract(PlayerInteractEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
if (ignore.remove(event.getPlayer())) {
return;
}
@ -125,6 +132,7 @@ public class EventListener implements Listener {
table.set("blockY", event.getClickedBlock().getY());
table.set("blockZ", event.getClickedBlock().getZ());
table.set("blockFace", event.getBlockFace().name());
table.set("blockType", event.getClickedBlock().getType().name());
} else {
table.set("hasBlock", LuaValue.valueOf(false));
}
@ -144,6 +152,7 @@ public class EventListener implements Listener {
Region tntRegion = Region.getRegion(event.getLocation());
for (Player player : Bukkit.getOnlinePlayers()) {
if(!Permission.BUILD.hasPermission(player)) continue;
if (tntRegion.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.TNTSpawn, LuaValue.NIL, event);
}
@ -165,6 +174,7 @@ public class EventListener implements Listener {
boolean inBuild = event.blockList().stream().anyMatch(block -> tntRegion.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION));
for (Player player : Bukkit.getOnlinePlayers()) {
if(!Permission.BUILD.hasPermission(player)) continue;
if (tntRegion.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.TNTExplode, table, event);
if (inBuild) {
@ -176,6 +186,7 @@ public class EventListener implements Listener {
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerDropItem(PlayerDropItemEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
ignore.add(event.getPlayer());
LuaTable table = new LuaTable();
table.set("type", event.getItemDrop().getItemStack().getType().name());
@ -185,6 +196,7 @@ public class EventListener implements Listener {
@EventHandler(priority = EventPriority.HIGH)
public void onEntityDeath(EntityDeathEvent event) {
for (Player player : Bukkit.getOnlinePlayers()) {
if(!Permission.BUILD.hasPermission(player)) continue;
LuaTable table = new LuaTable();
table.set("type", event.getEntityType().name());
ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.EntityDeath, table, event);

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.script.event;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.script.ScriptRunner;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.api.Plain;
@ -36,6 +37,7 @@ public class HotkeyListener implements PluginMessageListener, Plain {
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
if(!Permission.BUILD.hasPermission(player)) return;
if (!channel.equals("sw:hotkeys")) return;
if (message.length < 5) return;
int action = message[4] & 0xFF;

Datei anzeigen

@ -22,15 +22,21 @@ package de.steamwar.bausystem.features.script.lua;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitPlayer;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.event.platform.CommandEvent;
import com.sk89q.worldedit.extension.platform.Actor;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.bausystem.features.script.ScriptRunner;
import de.steamwar.bausystem.features.script.lua.libs.LuaLib;
import de.steamwar.bausystem.features.world.WorldEditListener;
import de.steamwar.bausystem.utils.WorldEditUtils;
import de.steamwar.inventory.SWAnvilInv;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -39,11 +45,10 @@ import org.luaj.vm2.LuaFunction;
import org.luaj.vm2.LuaTable;
import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Varargs;
import org.luaj.vm2.lib.OneArgFunction;
import org.luaj.vm2.lib.ThreeArgFunction;
import org.luaj.vm2.lib.TwoArgFunction;
import org.luaj.vm2.lib.VarArgFunction;
import org.luaj.vm2.lib.*;
import java.lang.reflect.Proxy;
import java.net.InetSocketAddress;
import java.util.*;
import java.util.logging.Level;
@ -102,14 +107,7 @@ public class SteamWarLuaPlugin extends TwoArgFunction {
double x = arg1.checkdouble();
double y = arg2.checkdouble();
double z = arg3.checkdouble();
Location loc = new Location(player.getWorld(), x, y, z);
return tableOf(new LuaValue[] {
valueOf("x"), valueOf(loc.getBlockX()),
valueOf("y"), valueOf(loc.getBlockY()),
valueOf("z"), valueOf(loc.getBlockZ())
});
return pos(x, y, z);
}
});
env.set("exec", new VarArgFunction() {
@ -122,6 +120,7 @@ public class SteamWarLuaPlugin extends TwoArgFunction {
return LuaValue.NIL;
}
command = preprocessEvent.getMessage().substring(1);
Bukkit.getLogger().log(Level.INFO, player.getName() + " dispatched command: " + command);
String[] commandSplit = command.split(" ");
if (!commandSplit[0].equals("select") && hasFAWE && WorldEditListener.isWorldEditCommand("/" + commandSplit[0])) {
@ -166,11 +165,86 @@ public class SteamWarLuaPlugin extends TwoArgFunction {
env.set("rawget", NIL);
env.set("rawlen", NIL);
env.set("rawset", NIL);
env.set("setmetatable", NIL);
env.set("xpcall", NIL);
return null;
}
public static LuaTable pos(double x, double y, double z) {
LuaTable position = new LuaTable();
position.set("x", x);
position.set("y", y);
position.set("z", z);
position.set("add", new OneArgFunction() {
@Override
public LuaValue call(LuaValue luaValue) {
LuaTable table = luaValue.checktable();
double dx = table.get("x").checkdouble();
double dy = table.get("y").checkdouble();
double dz = table.get("z").checkdouble();
return pos(x + dx, y + dy, z + dz);
}
});
position.set("subtract", new OneArgFunction() {
@Override
public LuaValue call(LuaValue luaValue) {
LuaTable table = luaValue.checktable();
double dx = table.get("x").checkdouble();
double dy = table.get("y").checkdouble();
double dz = table.get("z").checkdouble();
return pos(x - dx, y - dy, z - dz);
}
});
position.set("addX", new OneArgFunction() {
@Override
public LuaValue call(LuaValue luaValue) {
return pos(x + luaValue.checkdouble(), y, z);
}
});
position.set("subtractX", new OneArgFunction() {
@Override
public LuaValue call(LuaValue luaValue) {
return pos(x - luaValue.checkdouble(), y, z);
}
});
position.set("addY", new OneArgFunction() {
@Override
public LuaValue call(LuaValue luaValue) {
return pos(x, y + luaValue.checkdouble(), z);
}
});
position.set("subtractY", new OneArgFunction() {
@Override
public LuaValue call(LuaValue luaValue) {
return pos(x, y - luaValue.checkdouble(), z);
}
});
position.set("addZ", new OneArgFunction() {
@Override
public LuaValue call(LuaValue luaValue) {
return pos(x, y, z + luaValue.checkdouble());
}
});
position.set("subtractZ", new OneArgFunction() {
@Override
public LuaValue call(LuaValue luaValue) {
return pos(x, y, z - luaValue.checkdouble());
}
});
position.set("blockPos", new ZeroArgFunction() {
@Override
public LuaValue call() {
Location location = new Location(Bukkit.getWorlds().get(0), x, y, z);
return pos(location.getBlockX(), location.getBlockY(), location.getBlockZ());
}
});
return position;
}
public static String varArgsToString(Varargs args) {
StringBuilder builder = new StringBuilder();
for (int i = 1; i <= args.narg(); i++) {
@ -192,7 +266,7 @@ public class SteamWarLuaPlugin extends TwoArgFunction {
class Print extends VarArgFunction {
@Override
public Varargs invoke(Varargs args) {
player.sendMessage(varArgsToString(args));
player.sendMessage(ChatColor.translateAlternateColorCodes('&', varArgsToString(args)));
return LuaValue.NIL;
}
}

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bausystem.features.script.lua.libs;
import de.steamwar.bausystem.region.Point;
import lombok.AllArgsConstructor;
import org.bukkit.entity.Player;
import org.luaj.vm2.*;
@ -69,6 +70,15 @@ public interface LuaLib {
return de.steamwar.bausystem.features.script.lua.SteamWarLuaPlugin.varArgsToString(varargs);
}
default LuaTable toPos(Point point) {
if (point == null) return LuaTable.tableOf();
return LuaValue.tableOf(new LuaValue[] {
LuaValue.valueOf("x"), LuaValue.valueOf(point.getX()),
LuaValue.valueOf("y"), LuaValue.valueOf(point.getY()),
LuaValue.valueOf("z"), LuaValue.valueOf(point.getZ())
});
}
default Class<? extends LuaLib> parent() {
return null;
}

Datei anzeigen

@ -19,9 +19,11 @@
package de.steamwar.bausystem.features.script.lua.libs;
import de.steamwar.bausystem.features.script.lua.SteamWarLuaPlugin;
import de.steamwar.linkage.Linked;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.luaj.vm2.LuaTable;
@ -43,6 +45,12 @@ public class PlayerLib implements LuaLib {
table.set("chat", new Print(player));
table.set("actionbar", new SendActionbar(player));
table.set("pos", getter(() -> {
return SteamWarLuaPlugin.pos(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ());
}));
table.set("blockPos", getter(() -> {
return SteamWarLuaPlugin.pos(player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ());
}));
table.set("x", getterAndSetter("x", () -> player.getLocation().getX(), x -> {
Location location = player.getLocation();
location.setX(x);
@ -93,7 +101,7 @@ public class PlayerLib implements LuaLib {
@Override
public Varargs invoke(Varargs args) {
player.sendMessage(varArgsToString(args));
player.sendMessage(ChatColor.translateAlternateColorCodes('&', varArgsToString(args)));
return LuaValue.NIL;
}
}
@ -107,7 +115,7 @@ public class PlayerLib implements LuaLib {
@Override
public Varargs invoke(Varargs args) {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(varArgsToString(args)));
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', varArgsToString(args))));
return LuaValue.NIL;
}
}

Datei anzeigen

@ -20,9 +20,6 @@
package de.steamwar.bausystem.features.script.lua.libs;
import de.steamwar.bausystem.features.loader.Loader;
import de.steamwar.bausystem.features.tracer.record.ActiveTracer;
import de.steamwar.bausystem.features.tracer.record.AutoTraceRecorder;
import de.steamwar.bausystem.features.tracer.record.Recorder;
import de.steamwar.bausystem.region.GlobalRegion;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
@ -71,16 +68,27 @@ public class RegionLib implements LuaLib {
table.set("freeze", getter(() -> region.get().getPlain(Flag.FREEZE, FreezeMode.class) == FreezeMode.ACTIVE));
table.set("protect", getter(() -> region.get().getPlain(Flag.PROTECT, ProtectMode.class) == ProtectMode.ACTIVE));
LuaValue traceLib = LuaValue.tableOf();
traceLib.set("active", getter(() -> !region.get().isGlobal() && Recorder.INSTANCE.get(region.get()) instanceof ActiveTracer));
traceLib.set("auto", getter(() -> !region.get().isGlobal() && Recorder.INSTANCE.get(region.get()) instanceof AutoTraceRecorder));
traceLib.set("status", getter(() -> Recorder.INSTANCE.get(region.get()).scriptState()));
traceLib.set("time", getter(() -> Recorder.INSTANCE.get(region.get()).scriptTime()));
//LuaValue traceLib = LuaValue.tableOf();
//traceLib.set("active", getter(() -> !region.get().isGlobal() && Recorder.INSTANCE.get(region.get()) instanceof ActiveTracer));
//traceLib.set("auto", getter(() -> !region.get().isGlobal() && Recorder.INSTANCE.get(region.get()) instanceof AutoTraceRecorder));
//traceLib.set("status", getter(() -> Recorder.INSTANCE.get(region.get()).scriptState()));
//traceLib.set("time", getter(() -> Recorder.INSTANCE.get(region.get()).scriptTime()));
table.set("trace", traceLib);
//table.set("trace", traceLib);
Loader loader = Loader.getLoader(player);
table.set("loader", getter(() -> loader == null ? "OFF" : loader.getStage().name()));
table.set("copyPoint", getter(() -> toPos(region.get().getCopyPoint())));
table.set("minPointBuild", getter(() -> toPos(region.get().getMinPointBuild())));
table.set("maxPointBuild", getter(() -> toPos(region.get().getMaxPointBuild())));
table.set("minPointBuildExtension", getter(() -> toPos(region.get().getMinPointBuildExtension())));
table.set("maxPointBuildExtension", getter(() -> toPos(region.get().getMaxPointBuildExtension())));
table.set("testblockPoint", getter(() -> toPos(region.get().getTestBlockPoint())));
table.set("minPointTestblock", getter(() -> toPos(region.get().getMinPointTestblock())));
table.set("maxPointTestblock", getter(() -> toPos(region.get().getMaxPointTestblock())));
table.set("minPointTestblockExtension", getter(() -> toPos(region.get().getMinPointTestblockExtension())));
table.set("maxPointTestblockExtension", getter(() -> toPos(region.get().getMaxPointTestblockExtension())));
return table;
}

Datei anzeigen

@ -0,0 +1,75 @@
/*
* 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.script.lua.libs;
import de.steamwar.bausystem.features.world.BauScoreboard;
import de.steamwar.bausystem.utils.ScoreboardElement;
import de.steamwar.linkage.Linked;
import org.bukkit.entity.Player;
import org.luaj.vm2.LuaTable;
import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Varargs;
import org.luaj.vm2.lib.TwoArgFunction;
import org.luaj.vm2.lib.VarArgFunction;
@Linked
public class ScoreboardLib implements LuaLib {
@Override
public String name() {
return "scoreboard";
}
@Override
public LuaTable get(Player player) {
LuaTable luaTable = new LuaTable();
LuaTable groups = new LuaTable();
for (ScoreboardElement.ScoreboardGroup group : ScoreboardElement.ScoreboardGroup.values()) {
groups.set(group.name(), group.ordinal());
}
luaTable.set("group", groups);
luaTable.set("element", new VarArgFunction() {
@Override
public Varargs invoke(Varargs varargs) {
if (varargs.narg() < 2) {
return NIL;
}
String elementKey = varargs.arg(1).checkjstring();
ScoreboardElement.ScoreboardGroup elementGroup = ScoreboardElement.ScoreboardGroup.values()[varargs.arg(2).checkint()];
int priority = varargs.narg() > 2 ? varargs.arg(2).checkint() : Integer.MAX_VALUE;
return new VarArgFunction() {
@Override
public Varargs invoke(Varargs args) {
if (args.narg() == 0) {
BauScoreboard.setAdditionalElement(player, elementKey, elementGroup, priority, null);
} else {
BauScoreboard.setAdditionalElement(player, elementKey, elementGroup, priority, args.arg1().checkjstring());
}
return NIL;
}
};
}
});
return luaTable;
}
}

Datei anzeigen

@ -20,11 +20,15 @@
package de.steamwar.bausystem.features.script.lua.libs;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.loader.Loader;
import de.steamwar.bausystem.features.loader.LoaderRecorder;
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.core.TPSWatcher;
import de.steamwar.inventory.SWItem;
import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.luaj.vm2.LuaString;
import org.luaj.vm2.LuaTable;
@ -46,10 +50,14 @@ public class ServerLib implements LuaLib {
public LuaTable get(Player player) {
LuaTable serverLib = LuaValue.tableOf();
serverLib.set("time", getter(() -> new SimpleDateFormat(BauSystem.MESSAGE.parse("TIME", player)).format(Calendar.getInstance().getTime())));
serverLib.set("onlinePlayerCount", getter(Bukkit.getOnlinePlayers()::size));
serverLib.set("ticks", getter(TPSUtils.currentTick));
serverLib.set("getBlockAt", new OneArgFunction() {
@Override
public LuaValue call(LuaValue arg1) {
if (!Permission.SUPERVISOR.hasPermission(player)) {
return LuaValue.NIL;
}
LuaTable pos = arg1.checktable();
return valueOf(player.getWorld().getBlockAt(pos.get("x").checkint(), pos.get("y").checkint(), pos.get("z").checkint()).getType().name());
}
@ -57,6 +65,9 @@ public class ServerLib implements LuaLib {
serverLib.set("setBlockAt", new TwoArgFunction() {
@Override
public LuaValue call(LuaValue arg1, LuaValue arg2) {
if (!Permission.SUPERVISOR.hasPermission(player)) {
return LuaValue.NIL;
}
LuaTable pos = arg1.checktable();
LuaString material = arg2.checkstring();
Material mat = SWItem.getMaterial(material.tojstring());
@ -67,17 +78,19 @@ public class ServerLib implements LuaLib {
return NIL;
}
});
LuaValue tpsLib = LuaValue.tableOf();
tpsLib.set("oneSecond", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_SECOND)));
tpsLib.set("tenSecond", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_SECONDS)));
tpsLib.set("oneMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_MINUTE)));
tpsLib.set("fiveMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES)));
tpsLib.set("tenMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES)));
tpsLib.set("current", getter(TPSWatcher::getTPS));
// tpsLib.set("limit", getter(TPSLimitUtils::getCurrentTPSLimit));
serverLib.set("tps", tpsLib);
serverLib.set("interactAt", new OneArgFunction() {
@Override
public LuaValue call(LuaValue arg1) {
LuaTable pos = arg1.checktable();
Block block = player.getWorld().getBlockAt(pos.get("x").checkint(), pos.get("y").checkint(), pos.get("z").checkint());
LoaderRecorder.getLoaderInteractionElement(block, (loaderInteractionElement, s) -> {
loaderInteractionElement.execute(aLong -> {
// Ignore
});
});
return NIL;
}
});
return serverLib;
}
}

Datei anzeigen

@ -19,8 +19,14 @@
package de.steamwar.bausystem.features.script.lua.libs;
import com.google.gson.*;
import de.steamwar.bausystem.region.Region;
import de.steamwar.core.Core;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.api.Disable;
import de.steamwar.linkage.api.Enable;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.luaj.vm2.LuaTable;
import org.luaj.vm2.LuaValue;
@ -29,15 +35,173 @@ import org.luaj.vm2.lib.OneArgFunction;
import org.luaj.vm2.lib.TwoArgFunction;
import org.luaj.vm2.lib.VarArgFunction;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@Linked
public class StorageLib implements LuaLib {
public class StorageLib implements LuaLib, Enable, Disable {
private final Gson gson = new Gson();
private final File storageDirectory = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "script_storage");
private static final HashMap<String, LuaValue> GLOBAL_STORAGE = new HashMap<>();
private static final HashMap<Player, HashMap<String, LuaValue>> PLAYER_STORAGE = new HashMap<>();
private static final HashMap<UUID, HashMap<String, LuaValue>> PLAYER_STORAGE = new HashMap<>();
private static final HashMap<Region, HashMap<String, LuaValue>> REGION_STORAGE = new HashMap<>();
@Override
public void enable() {
if (Core.getVersion() <= 15) return;
if (!storageDirectory.exists()) storageDirectory.mkdirs();
try {
JsonObject jsonObject = JsonParser.parseReader(new FileReader(new File(storageDirectory, "global.json"))).getAsJsonObject();
jsonObject.keySet().forEach(key -> {
GLOBAL_STORAGE.put(key, fromJson(jsonObject.get(key)));
});
} catch (Exception e) {}
File regionStorageDirectory = new File(storageDirectory, "region");
regionStorageDirectory.mkdirs();
for (File regionStorage : regionStorageDirectory.listFiles()) {
try {
JsonObject jsonObject = JsonParser.parseReader(new FileReader(regionStorage)).getAsJsonObject();
HashMap<String, LuaValue> map = new HashMap<>();
jsonObject.keySet().forEach(key -> {
map.put(key, fromJson(jsonObject.get(key)));
});
Region region = Region.getREGION_MAP().get(regionStorage.getName().substring(0, regionStorage.getName().length() - ".json".length()));
REGION_STORAGE.put(region, map);
} catch (Exception e) {}
}
File playerStorageDirectory = new File(storageDirectory, "player");
playerStorageDirectory.mkdirs();
for (File playerStorage : playerStorageDirectory.listFiles()) {
try {
JsonObject jsonObject = JsonParser.parseReader(new FileReader(playerStorage)).getAsJsonObject();
HashMap<String, LuaValue> map = new HashMap<>();
jsonObject.keySet().forEach(key -> {
map.put(key, fromJson(jsonObject.get(key)));
});
SteamwarUser steamwarUser = SteamwarUser.get(Integer.parseInt(playerStorage.getName().substring(0, playerStorage.getName().length() - ".json".length())));
PLAYER_STORAGE.put(steamwarUser.getUUID(), map);
} catch (Exception e) {}
}
}
private LuaValue fromJson(JsonElement jsonElement) {
if (jsonElement.isJsonNull()) {
return LuaValue.NIL;
}
if (jsonElement.isJsonPrimitive()) {
JsonPrimitive jsonPrimitive = jsonElement.getAsJsonPrimitive();
if (jsonPrimitive.isBoolean()) {
return LuaValue.valueOf(jsonPrimitive.getAsBoolean());
}
if (jsonPrimitive.isNumber()) {
try {
return LuaValue.valueOf(jsonPrimitive.getAsInt());
} catch (NumberFormatException e) {}
try {
return LuaValue.valueOf(jsonPrimitive.getAsDouble());
} catch (NumberFormatException e) {}
}
if (jsonPrimitive.isString()) {
return LuaValue.valueOf(jsonPrimitive.getAsString());
}
return null;
}
if (jsonElement.isJsonObject()) {
JsonObject jsonObject = jsonElement.getAsJsonObject();
LuaTable luaTable = new LuaTable();
jsonObject.keySet().forEach(string -> {
LuaValue value = fromJson(jsonObject.get(string));
if (value == null) return;
luaTable.set(string, value);
});
return luaTable;
}
return null;
}
@Override
public void disable() {
if (Core.getVersion() <= 15) return;
if (!storageDirectory.exists()) storageDirectory.mkdirs();
try {
FileWriter fileWriter = new FileWriter(new File(storageDirectory, "global.json"));
gson.toJson(toJson(GLOBAL_STORAGE), fileWriter);
fileWriter.close();
} catch (IOException e) {}
File regionStorageDirectory = new File(storageDirectory, "region");
regionStorageDirectory.mkdirs();
for (Map.Entry<Region, HashMap<String, LuaValue>> entry : REGION_STORAGE.entrySet()) {
try {
FileWriter fileWriter = new FileWriter(new File(regionStorageDirectory, entry.getKey().getName() + ".json"));
gson.toJson(toJson(entry.getValue()), fileWriter);
fileWriter.close();
} catch (IOException e) {}
}
File playerStorageDirectory = new File(storageDirectory, "player");
playerStorageDirectory.mkdirs();
for (Map.Entry<UUID, HashMap<String, LuaValue>> entry : PLAYER_STORAGE.entrySet()) {
try {
FileWriter fileWriter = new FileWriter(new File(playerStorageDirectory, SteamwarUser.get(entry.getKey()).getId() + ".json"));
gson.toJson(toJson(entry.getValue()), fileWriter);
fileWriter.close();
} catch (IOException e) {}
}
}
private JsonObject toJson(HashMap<String, LuaValue> valueMap) {
JsonObject jsonObject = new JsonObject();
valueMap.forEach((string, luaValue) -> {
JsonElement value = toJson(luaValue);
if (value == null) return;
jsonObject.add(string, value);
});
return jsonObject;
}
private JsonElement toJson(LuaValue luaValue) {
if (luaValue.isnil()) {
return JsonNull.INSTANCE;
}
try {
return new JsonPrimitive(luaValue.checkboolean());
} catch (Exception e) {}
try {
return new JsonPrimitive(luaValue.checkint());
} catch (Exception e) {}
try {
return new JsonPrimitive(luaValue.checkdouble());
} catch (Exception e) {}
if (luaValue.isstring()) {
return new JsonPrimitive(luaValue.tojstring());
}
if (luaValue.istable()) {
LuaTable luaTable = luaValue.checktable();
JsonObject jsonObject = new JsonObject();
for (LuaValue key : luaTable.keys()) {
JsonElement value = toJson(luaTable.get(key));
if (value == null) continue;
try {
jsonObject.add(key.checkjstring(), value);
} catch (Exception e) {}
}
return jsonObject;
}
return null;
}
@Override
public String name() {
return "storage";
@ -92,7 +256,7 @@ public class StorageLib implements LuaLib {
storageLib.set("global", global);
LuaTable playerStorage = new LuaTable();
HashMap<String, LuaValue> playerStorageMap = PLAYER_STORAGE.computeIfAbsent(player, k -> new HashMap<>());
HashMap<String, LuaValue> playerStorageMap = PLAYER_STORAGE.computeIfAbsent(player.getUniqueId(), k -> new HashMap<>());
playerStorage.set("get", new OneArgFunction() {
@Override
public LuaValue call(LuaValue arg) {
@ -137,34 +301,38 @@ public class StorageLib implements LuaLib {
storageLib.set("player", playerStorage);
LuaTable regionStorage = new LuaTable();
HashMap<String, LuaValue> regionStorageMap = REGION_STORAGE.computeIfAbsent(Region.getRegion(player.getLocation()), k -> new HashMap<>());
regionStorage.set("get", new OneArgFunction() {
@Override
public LuaValue call(LuaValue arg) {
HashMap<String, LuaValue> regionStorageMap = REGION_STORAGE.computeIfAbsent(Region.getRegion(player.getLocation()), k -> new HashMap<>());
return regionStorageMap.getOrDefault(arg.checkjstring(), NIL);
}
});
regionStorage.set("set", new TwoArgFunction() {
@Override
public LuaValue call(LuaValue arg1, LuaValue arg2) {
HashMap<String, LuaValue> regionStorageMap = REGION_STORAGE.computeIfAbsent(Region.getRegion(player.getLocation()), k -> new HashMap<>());
return regionStorageMap.put(arg1.checkjstring(), arg2);
}
});
regionStorage.set("has", new OneArgFunction() {
@Override
public LuaValue call(LuaValue arg) {
HashMap<String, LuaValue> regionStorageMap = REGION_STORAGE.computeIfAbsent(Region.getRegion(player.getLocation()), k -> new HashMap<>());
return valueOf(regionStorageMap.containsKey(arg.checkjstring()));
}
});
regionStorage.set("remove", new OneArgFunction() {
@Override
public LuaValue call(LuaValue arg) {
HashMap<String, LuaValue> regionStorageMap = REGION_STORAGE.computeIfAbsent(Region.getRegion(player.getLocation()), k -> new HashMap<>());
return regionStorageMap.remove(arg.checkjstring());
}
});
regionStorage.set("accessor", new OneArgFunction() {
@Override
public LuaValue call(LuaValue arg) {
HashMap<String, LuaValue> regionStorageMap = REGION_STORAGE.computeIfAbsent(Region.getRegion(player.getLocation()), k -> new HashMap<>());
String key = arg.checkjstring();
return new VarArgFunction() {
@Override

Datei anzeigen

@ -0,0 +1,57 @@
/*
* 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.script.lua.libs;
import de.steamwar.bausystem.features.tpslimit.TPSSystem;
import de.steamwar.core.TPSWatcher;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import org.bukkit.entity.Player;
import org.luaj.vm2.LuaTable;
@Linked
public class TpsLib implements LuaLib {
@LinkedInstance
public TPSSystem tpsSystem;
@Override
public Class<? extends LuaLib> parent() {
return ServerLib.class;
}
@Override
public String name() {
return "tps";
}
@Override
public LuaTable get(Player player) {
LuaTable tpsLib = new LuaTable();
tpsLib.set("oneSecond", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_SECOND)));
tpsLib.set("tenSecond", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_SECONDS)));
tpsLib.set("oneMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_MINUTE)));
tpsLib.set("fiveMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES)));
tpsLib.set("tenMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES)));
tpsLib.set("current", getter(TPSWatcher::getTPS));
tpsLib.set("limit", getter(tpsSystem::getCurrentTPSLimit));
return tpsLib;
}
}

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.shieldprinting;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.shieldprinting.impl.*;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
import de.steamwar.bausystem.utils.bossbar.BossBarService;
import de.steamwar.inventory.SWItem;
@ -47,7 +48,6 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.util.Vector;
@ -259,18 +259,14 @@ public class ShieldPrinting implements Listener {
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getClickedBlock() == null) return;
if (event.getItem() == null) return;
if (Region.getRegion(event.getClickedBlock().getLocation()) != region) return;
Vector vector = event.getClickedBlock().getLocation().toVector();
if (!shieldMap.containsKey(vector)) return;
event.getClickedBlock().setType(Material.AIR);
public void onPlayerJoin(PlayerJoinEvent event) {
updateBossbar(event.getPlayer());
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
updateBossbar(event.getPlayer());
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getNewSpectator().forEach(player -> BossBarService.instance.remove(player, region, "shieldprinting"));
event.getNewBuilder().forEach(this::updateBossbar);
}
private void updateBossbars() {

Datei anzeigen

@ -26,9 +26,7 @@ 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;
import org.bukkit.event.player.PlayerInteractEvent;
import java.util.HashMap;
import java.util.Map;
@ -108,8 +106,8 @@ public class ShieldPrintingCommand extends SWCommand implements Listener {
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> validator() {
return (commandSender, player, messageSender) -> {
if (!Permission.hasPermission(player, Permission.WORLD)) {
messageSender.send("SHIELD_PRINTING_DISALLOWED", player);
if (!Permission.BUILD.hasPermission(player)) {
messageSender.send("NO_PERMISSION", player);
return false;
}
Region region = Region.getRegion(player.getLocation());
@ -120,20 +118,4 @@ public class ShieldPrintingCommand extends SWCommand implements Listener {
return true;
};
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getClickedBlock() == null) {
return;
}
Region region = Region.getRegion(event.getClickedBlock().getLocation());
if (region.isGlobal()) {
return;
}
ShieldPrinting shieldPrinting = SHIELD_PRINTING_MAP.get(region);
if (shieldPrinting == null) {
return;
}
shieldPrinting.onPlayerInteract(event);
}
}

Datei anzeigen

@ -1,92 +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.simulator;
import de.steamwar.bausystem.BauSystem;
import lombok.experimental.UtilityClass;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@UtilityClass
public class OrderUtils {
private final List<Material> activationOrder = new ArrayList<>();
private final Map<Material, String> nameMap = new HashMap<>();
static {
add(Material.REPEATER, "SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_REPEATER");
add(Material.OBSERVER, "SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_OBSERVER");
add(Material.COMPARATOR, "SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_COMPARATOR");
}
public Material next(Material material) {
int index = activationOrder.indexOf(material);
if (index == -1) {
return activationOrder.get(0);
}
if (index + 1 >= activationOrder.size()) {
return activationOrder.get(0);
}
return activationOrder.get(index + 1);
}
public Material previous(Material material) {
int index = activationOrder.indexOf(material);
if (index == -1) {
return activationOrder.get(0);
}
if (index - 1 < 0) {
return activationOrder.get(activationOrder.size() - 1);
}
return activationOrder.get(index - 1);
}
public List<String> orderList(Material material, Player player) {
List<String> lore = new ArrayList<>();
for (Material m : activationOrder) {
String element = BauSystem.MESSAGE.parse(name(m), player);
if (m == material) {
lore.add(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ACTIVE", player, element));
} else {
lore.add(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_INACTIVE", player, element));
}
}
return lore;
}
public int order(Material material) {
return activationOrder.indexOf(material);
}
public String name(Material material) {
return nameMap.getOrDefault(material, "SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_UNKNOWN");
}
private void add(Material material, String name) {
activationOrder.add(material);
nameMap.put(material, name);
}
}

Datei anzeigen

@ -1,20 +1,20 @@
/*
* This file is a part of the SteamWar software.
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
* 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 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.
* 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/>.
* 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;
@ -55,6 +55,6 @@ public class SimulatorBauGuiItem extends BauGuiItem {
@Override
public Permission permission() {
return Permission.WORLD;
return Permission.BUILD;
}
}

Datei anzeigen

@ -1,20 +1,20 @@
/*
* This file is a part of the SteamWar software.
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
* 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 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.
* 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/>.
* 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;
@ -22,105 +22,78 @@ package de.steamwar.bausystem.features.simulator;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.features.simulator.gui.SimulatorSelectionGUI;
import de.steamwar.bausystem.utils.ItemUtils;
import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.execute.SimulatorExecutor;
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.linkage.MinVersion;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.Collection;
@Linked
@MinVersion(19)
public class SimulatorCommand extends SWCommand {
@LinkedInstance
public SimulatorCursor simulatorCursor;
public SimulatorCommand() {
super("simulator", "sim");
super("sim", "simulator");
}
@Register(description = "SIMULATOR_HELP")
public void genericCommand(@Validator Player p) {
SimulatorCursor.hide(p, null);
SWUtils.giveItemToPlayer(p, SimulatorStorage.getWand(p));
simulatorCursor.calcCursor(p);
}
@Register(value = "change", description = "SIMULATOR_CHANGE_HELP")
public void change(@Validator Player p) {
ItemStack itemStack = p.getInventory().getItemInMainHand();
if (!ItemUtils.isItem(itemStack, "simulator")) {
if (!SimulatorCursor.isSimulatorItem(p.getInventory().getItemInMainHand()) && !SimulatorCursor.isSimulatorItem(p.getInventory().getItemInOffHand())) {
BauSystem.MESSAGE.send("SIMULATOR_NO_SIM_IN_HAND", p);
return;
}
SimulatorSelectionGUI.open(p, itemStack);
}
@Register(value = "create", description = "SIMULATOR_CREATE_HELP")
public void create(@Validator Player p, String name) {
createSimulator(p, name);
}
public static boolean createSimulator(Player p, String name) {
if (SimulatorStorage.getSimulatorNames().contains(name)) {
BauSystem.MESSAGE.send("SIMULATOR_NAME_ALREADY_EXISTS", p);
return false;
}
if (!name.matches("[a-zA-Z_0-9-]+")) {
BauSystem.MESSAGE.send("SIMULATOR_NAME_INVALID", p);
return false;
}
SimulatorStorage.createNewSimulator(name);
BauSystem.MESSAGE.send("SIMULATOR_CREATE", p);
return true;
}
@Register(value = "delete", description = "SIMULATOR_DELETE_HELP")
public void delete(@Validator Player p, @Mapper("simulators") String name) {
if (!SimulatorStorage.getSimulatorNames().contains(name)) {
BauSystem.MESSAGE.send("SIMULATOR_NOT_EXISTS", p);
return;
}
SimulatorStorage.delete(name);
BauSystem.MESSAGE.send("SIMULATOR_DELETED", p);
}
@Register(value = "start", description = "SIMULATOR_START_HELP")
public void start(@Validator Player p, @Mapper("simulators") String name) {
TNTSimulator tntSimulator = SimulatorStorage.getSimulator(name);
if (tntSimulator == null) {
BauSystem.MESSAGE.send("SIMULATOR_NOT_EXISTS", p);
return;
}
tntSimulator.start(p);
SimulatorStorage.openSimulatorSelector(p);
}
@Register(value = "copy", description = "SIMULATOR_COPY_HELP")
public void copy(@Validator Player p, @Mapper("simulators") String toCopy, String name) {
TNTSimulator tntSimulator = SimulatorStorage.getSimulator(toCopy);
if (tntSimulator == null) {
BauSystem.MESSAGE.send("SIMULATOR_NOT_EXISTS", p);
return;
}
public void copy(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator, String name) {
if (SimulatorStorage.getSimulator(name) != null) {
BauSystem.MESSAGE.send("SIMULATOR_NAME_ALREADY_EXISTS", p);
return;
}
SimulatorStorage.copySimulator(tntSimulator, name);
if (!name.matches("[a-zA-Z_0-9-]+")) {
BauSystem.MESSAGE.send("SIMULATOR_NAME_INVALID", p);
return;
}
if (!SimulatorStorage.copy(simulator, name)) {
BauSystem.MESSAGE.send("SIMULATOR_ERROR_COPY", p);
}
}
@Mapper("simulators")
public TypeMapper<String> allSimulators() {
return new TypeMapper<String>() {
@Register(value = "delete", description = "SIMULATOR_DELETE_HELP")
public void delete(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator) {
SimulatorStorage.delete(simulator);
BauSystem.MESSAGE.send("SIMULATOR_DELETED", p);
}
@Register(value = "start", description = "SIMULATOR_START_HELP")
public void start(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator) {
SimulatorExecutor.run(simulator);
}
@ClassMapper(value = Simulator.class, local = true)
public TypeMapper<Simulator> allSimulators() {
return new TypeMapper<>() {
@Override
public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
if (SimulatorStorage.getSimulatorNames().contains(s)) {
return s;
} else {
return null;
}
public Simulator map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
return SimulatorStorage.getSimulator(s);
}
@Override
@ -129,11 +102,4 @@ public class SimulatorCommand extends SWCommand {
}
};
}
@ClassValidator(value = Player.class, local = true)
public TypeValidator<Player> validator() {
return (commandSender, player, messageSender) -> {
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "SIMULATOR_NO_PERMS");
};
}
}

Datei anzeigen

@ -1,107 +1,248 @@
/*
* This file is a part of the SteamWar software.
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
* 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 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.
* 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/>.
* 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;
import com.comphenix.tinyprotocol.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.simulator.tnt.SimulatorElement;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.data.SimulatorElement;
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
import de.steamwar.bausystem.features.simulator.data.observer.ObserverElement;
import de.steamwar.bausystem.features.simulator.data.observer.ObserverPhase;
import de.steamwar.bausystem.features.simulator.data.redstone.RedstoneElement;
import de.steamwar.bausystem.features.simulator.data.redstone.RedstonePhase;
import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
import de.steamwar.bausystem.features.simulator.data.tnt.TNTPhase;
import de.steamwar.bausystem.features.simulator.execute.SimulatorExecutor;
import de.steamwar.bausystem.features.simulator.gui.SimulatorGroupGui;
import de.steamwar.bausystem.features.simulator.gui.SimulatorGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.bausystem.utils.ItemUtils;
import de.steamwar.bausystem.utils.RayTraceUtils;
import de.steamwar.entity.REntity;
import de.steamwar.entity.REntityServer;
import de.steamwar.entity.RFallingBlockEntity;
import lombok.experimental.UtilityClass;
import net.md_5.bungee.api.ChatMessageType;
import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.MinVersion;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.*;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.stream.Collectors;
@UtilityClass
public class SimulatorCursor {
@Linked
@MinVersion(19)
public class SimulatorCursor implements Listener {
private static final World WORLD = Bukkit.getWorlds().get(0);
private Map<Player, REntityServer> rEntityServerMap = new HashMap<>();
private final World WORLD = Bukkit.getWorlds().get(0);
private Class<?> position = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPosition");
private Class<?> look = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInLook");
private Class<?> positionLook = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPositionLook");
public void show(Player player, TNTSimulator tntSimulator, RayTraceUtils.RRayTraceResult result) {
REntityServer cursor = rEntityServerMap.get(player);
private Map<Player, CursorType> cursorType = Collections.synchronizedMap(new HashMap<>());
private Map<Player, REntityServer> cursors = Collections.synchronizedMap(new HashMap<>());
private final Set<Player> calculating = new HashSet<>();
if (cursor != null)
cursor.close();
tntSimulator.show(player);
if (result == null)
return;
if (result.getHitEntity() != null) {
List<SimulatorElement> elements = tntSimulator.getEntity(result.getHitEntity());
cursor = new REntityServer();
RFallingBlockEntity entity = new RFallingBlockEntity(cursor, (elements.isEmpty() ? getPos(player, result) : elements.get(0).getPosition()).toLocation(WORLD), Material.TNT);
entity.setNoGravity(true);
entity.setGlowing(true);
cursor.addPlayer(player);
rEntityServerMap.put(player, cursor);
BauSystem.MESSAGE.sendPrefixless("SIMULATOR_POSITION_EDIT", player, ChatMessageType.ACTION_BAR);
return;
}
if (SimulatorStorage.getSimulator(player.getInventory().getItemInOffHand()) != null && result.getHitPosition().distanceSquared(player.getLocation().toVector()) < 25) {
return;
}
cursor = new REntityServer();
RFallingBlockEntity entity = new RFallingBlockEntity(cursor, getPos(player, result).toLocation(WORLD), Material.TNT);
entity.setNoGravity(true);
cursor.addPlayer(player);
rEntityServerMap.put(player, cursor);
BauSystem.MESSAGE.sendPrefixless("SIMULATOR_POSITION_ADD", player, ChatMessageType.ACTION_BAR);
public static boolean isSimulatorItem(ItemStack itemStack) {
return ItemUtils.isItem(itemStack, "simulator");
}
public void hide(Player player) {
REntityServer cursor = rEntityServerMap.get(player);
if (cursor == null) return;
public SimulatorCursor() {
BiFunction<Player, Object, Object> function = (player, object) -> {
calcCursor(player);
return object;
};
TinyProtocol.instance.addFilter(position, function);
TinyProtocol.instance.addFilter(look, function);
TinyProtocol.instance.addFilter(positionLook, function);
}
cursor.close();
SimulatorStorage.getSimulatorNames().forEach(s -> {
SimulatorStorage.getSimulator(s).hide(player);
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
calcCursor(event.getPlayer());
}, 0);
}
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event) {
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
calcCursor(event.getPlayer());
}
@EventHandler
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
calcCursor(event.getPlayer());
}, 1);
}
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getChanged().forEach(this::calcCursor);
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
cursorType.remove(event.getPlayer());
cursors.remove(event.getPlayer());
synchronized (calculating) {
calculating.remove(event.getPlayer());
}
}
private static final Map<Player, Long> LAST_SNEAKS = new HashMap<>();
static {
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {
long millis = System.currentTimeMillis();
LAST_SNEAKS.entrySet().removeIf(entry -> millis - entry.getValue() > 200);
}, 1, 1);
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
if (!event.isSneaking()) return;
Player player = event.getPlayer();
if (!isSimulatorItem(player.getInventory().getItemInMainHand()) && !isSimulatorItem(player.getInventory().getItemInOffHand())) {
return;
}
if (LAST_SNEAKS.containsKey(player)) {
cursorType.put(player, cursorType.getOrDefault(player, CursorType.TNT).switchType());
calcCursor(player);
} else {
LAST_SNEAKS.put(player, System.currentTimeMillis());
}
}
public void calcCursor(Player player) {
synchronized (calculating) {
if (calculating.contains(player)) return;
calculating.add(player);
}
if (!Permission.BUILD.hasPermission(player) || (!isSimulatorItem(player.getInventory().getItemInMainHand()) && !isSimulatorItem(player.getInventory().getItemInOffHand()))) {
if (removeCursor(player) || SimulatorWatcher.show(null, player)) {
SWUtils.sendToActionbar(player, "");
}
synchronized (calculating) {
calculating.remove(player);
}
return;
}
Simulator simulator = SimulatorStorage.getSimulator(player);
SimulatorWatcher.show(simulator, player);
List<REntity> entities = SimulatorWatcher.getEntitiesOfSimulator(simulator);
RayTraceUtils.RRayTraceResult rayTraceResult = RayTraceUtils.traceREntity(player, player.getLocation(), entities);
if (rayTraceResult == null) {
removeCursor(player);
if (simulator == null) {
SWUtils.sendToActionbar(player, "§eSelect Simulator");
} else {
SWUtils.sendToActionbar(player, "§eOpen Simulator");
}
synchronized (calculating) {
calculating.remove(player);
}
return;
}
showCursor(player, rayTraceResult, simulator != null);
synchronized (calculating) {
calculating.remove(player);
}
}
private synchronized boolean removeCursor(Player player) {
REntityServer entityServer = cursors.get(player);
boolean hadCursor = entityServer != null && !entityServer.getEntities().isEmpty();
if (entityServer != null) {
entityServer.getEntities().forEach(REntity::die);
}
return hadCursor;
}
private synchronized void showCursor(Player player, RayTraceUtils.RRayTraceResult rayTraceResult, boolean hasSimulatorSelected) {
REntityServer entityServer = cursors.computeIfAbsent(player, __ -> {
REntityServer rEntityServer = new REntityServer();
rEntityServer.addPlayer(player);
return rEntityServer;
});
}
public void hide(Player player, TNTSimulator tntSimulator) {
REntityServer cursor = rEntityServerMap.get(player);
CursorType type = cursorType.getOrDefault(player, CursorType.TNT);
REntity hitEntity = rayTraceResult.getHitEntity();
Location location = hitEntity != null ? new Vector(hitEntity.getX(), hitEntity.getY(), hitEntity.getZ()).toLocation(WORLD) :
type.position.apply(player, rayTraceResult).toLocation(WORLD);
if (cursor != null)
cursor.close();
if (tntSimulator != null) {
tntSimulator.hide(player);
Material material = hitEntity != null ? Material.GLASS : type.getMaterial();
List<RFallingBlockEntity> entities = entityServer.getEntitiesByType(RFallingBlockEntity.class);
entities.removeIf(rFallingBlockEntity -> {
if (rFallingBlockEntity.getMaterial() != material) {
rFallingBlockEntity.die();
return true;
}
rFallingBlockEntity.move(location);
return false;
});
if (entities.isEmpty()) {
RFallingBlockEntity rFallingBlockEntity = new RFallingBlockEntity(entityServer, location, material);
rFallingBlockEntity.setNoGravity(true);
if (material == Material.GLASS) {
rFallingBlockEntity.setGlowing(true);
}
}
if (hasSimulatorSelected) {
if (hitEntity != null) {
SWUtils.sendToActionbar(player, "§eEdit Position");
} else {
SWUtils.sendToActionbar(player, "§eAdd new " + type.name);
}
} else {
SWUtils.sendToActionbar(player, "§eCreate new Simulator");
}
rEntityServerMap.remove(player);
}
public static Vector getPos(Player player, RayTraceUtils.RRayTraceResult result) {
public static Vector getPosFree(Player player, RayTraceUtils.RRayTraceResult result) {
Vector pos = result.getHitPosition();
BlockFace face = result.getHitBlockFace();
@ -140,4 +281,177 @@ public class SimulatorCursor {
return pos;
}
private static Vector getPosBlockAligned(Player player, RayTraceUtils.RRayTraceResult result) {
Vector pos = result.getHitPosition();
BlockFace face = result.getHitBlockFace();
if (face != null) {
switch (face) {
case DOWN:
pos.setY(pos.getY() - 0.98);
break;
case EAST:
pos.setX(pos.getX() + 0.49);
break;
case WEST:
pos.setX(pos.getX() - 0.49);
break;
case NORTH:
pos.setZ(pos.getZ() - 0.49);
break;
case SOUTH:
pos.setZ(pos.getZ() + 0.49);
break;
default:
break;
}
}
pos.setX(pos.getBlockX() + 0.5);
if (pos.getY() - pos.getBlockY() != 0 && face == BlockFace.UP) {
pos.setY(pos.getBlockY() + 1.0);
} else {
pos.setY(pos.getBlockY());
}
pos.setZ(pos.getBlockZ() + 0.5);
return pos;
}
@Getter
@AllArgsConstructor
public enum CursorType {
TNT(Material.TNT, SimulatorCursor::getPosFree, "TNT", vector -> new TNTElement(vector).add(new TNTPhase())),
REDSTONE_BLOCK(Material.REDSTONE_BLOCK, SimulatorCursor::getPosBlockAligned, "Redstone Block", vector -> new RedstoneElement(vector).add(new RedstonePhase())),
OBSERVER(Material.OBSERVER, SimulatorCursor::getPosBlockAligned, "Observer", vector -> new ObserverElement(vector).add(new ObserverPhase())),
;
private Material material;
private BiFunction<Player, RayTraceUtils.RRayTraceResult, Vector> position;
private String name;
private Function<Vector, SimulatorElement<?>> elementFunction;
public CursorType switchType() {
if (this == TNT) {
return REDSTONE_BLOCK;
}
if (this == REDSTONE_BLOCK) {
return OBSERVER;
}
return TNT;
}
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
if (!ItemUtils.isItem(event.getItem(), "simulator")) {
return;
}
event.setCancelled(true);
Player player = event.getPlayer();
Simulator simulator = SimulatorStorage.getSimulator(player);
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_AIR) {
if (simulator == null) {
return;
}
SimulatorExecutor.run(simulator);
return;
}
if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_AIR) {
return;
}
RayTraceUtils.RRayTraceResult rayTraceResult = RayTraceUtils.traceREntity(player, player.getLocation(), SimulatorWatcher.getEntitiesOfSimulator(simulator));
if (simulator == null) {
if (rayTraceResult == null) {
SimulatorStorage.openSimulatorSelector(player);
} else {
SWAnvilInv anvilInv = new SWAnvilInv(player, "Name");
anvilInv.setCallback(s -> {
Simulator sim = SimulatorStorage.getSimulator(s);
if (sim != null) {
BauSystem.MESSAGE.send("SIMULATOR_NAME_ALREADY_EXISTS", player);
return;
}
if (!s.matches("[a-zA-Z_0-9-]+")) {
BauSystem.MESSAGE.send("SIMULATOR_NAME_INVALID", player);
return;
}
sim = new Simulator(s);
SimulatorStorage.addSimulator(s, sim);
createElement(player, rayTraceResult, sim);
SimulatorStorage.setSimulator(player, sim);
});
anvilInv.open();
}
return;
}
if (rayTraceResult == null) {
new SimulatorGui(player, simulator).open();
return;
}
if (rayTraceResult.getHitEntity() != null) {
REntity hitEntity = rayTraceResult.getHitEntity();
Vector vector = new Vector(hitEntity.getX(), hitEntity.getY(), hitEntity.getZ());
List<SimulatorElement<?>> elements = simulator.getGroups().stream().map(SimulatorGroup::getElements).flatMap(List::stream).filter(element -> {
return element.getWorldPos().distanceSquared(vector) < (1 / 16.0) * (1 / 16.0);
}).collect(Collectors.toList());
switch (elements.size()) {
case 0:
return;
case 1:
// Open single element present in Simulator
SimulatorElement<?> element = elements.get(0);
SimulatorGroup group1 = element.getGroup(simulator);
SimulatorBaseGui back = new SimulatorGui(player, simulator);
if (group1.getElements().size() > 1) {
back = new SimulatorGroupGui(player, simulator, group1, back);
}
element.open(player, simulator, group1, back);
break;
default:
List<SimulatorGroup> parents = elements.stream().map(e -> e.getGroup(simulator)).distinct().collect(Collectors.toList());
if (parents.size() == 1) {
// Open multi element present in Simulator in existing group
SimulatorGui simulatorGui = new SimulatorGui(player, simulator);
new SimulatorGroupGui(player, simulator, parents.get(0), simulatorGui).open();
} else {
// Open multi element present in Simulator in implicit group
SimulatorGroup group2 = new SimulatorGroup();
group2.setMaterial(null);
group2.getElements().addAll(elements);
SimulatorGui simulatorGui = new SimulatorGui(player, simulator);
new SimulatorGroupGui(player, simulator, group2, simulatorGui).open();
}
break;
}
return;
}
// Add new Element to current simulator
createElement(player, rayTraceResult, simulator);
}
private void createElement(Player player, RayTraceUtils.RRayTraceResult rayTraceResult, Simulator simulator) {
CursorType type = cursorType.getOrDefault(player, CursorType.TNT);
Vector vector = type.position.apply(player, rayTraceResult);
if (type == CursorType.REDSTONE_BLOCK) {
vector.subtract(new Vector(0.5, 0, 0.5));
}
SimulatorElement<?> element = type.elementFunction.apply(vector);
SimulatorGroup group = new SimulatorGroup().add(element);
simulator.getGroups().add(group);
SimulatorGui simulatorGui = new SimulatorGui(player, simulator);
element.open(player, simulator, group, simulatorGui);
SimulatorWatcher.update(simulator);
calcCursor(player);
}
}

Datei anzeigen

@ -1,124 +1,172 @@
/*
* This file is a part of the SteamWar software.
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
* 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 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.
* 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/>.
* 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;
import com.google.common.io.Files;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.features.simulator.tnt.TNTElement;
import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui;
import de.steamwar.bausystem.features.simulator.storage.SimFormatSimulatorLoader;
import de.steamwar.bausystem.features.simulator.storage.SimulatorFormatSimulatorLoader;
import de.steamwar.bausystem.features.simulator.storage.SimulatorSaver;
import de.steamwar.bausystem.features.simulator.storage.YAPIONFormatSimulatorLoader;
import de.steamwar.bausystem.utils.ItemUtils;
import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWItem;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.api.Disable;
import de.steamwar.linkage.MinVersion;
import de.steamwar.linkage.api.Enable;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import yapion.exceptions.YAPIONException;
import yapion.hierarchy.types.YAPIONArray;
import yapion.hierarchy.types.YAPIONObject;
import yapion.parser.YAPIONParser;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.*;
@Linked
public class SimulatorStorage implements Enable, Disable {
public static final World WORLD = Bukkit.getWorlds().get(0);
private static final File simulatorsDir = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "simulators");
@MinVersion(19)
public class SimulatorStorage implements Enable {
public static final File simulatorsDir = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "simulators");
private static Map<String, Simulator> simulatorMap = new HashMap<>();
private static NamespacedKey simulatorSelection = SWUtils.getNamespaceKey("simulator_selection");
private static Map<String, TNTSimulator> tntSimulators = new HashMap<>();
public static void createNewSimulator(String name) {
tntSimulators.put(name, new TNTSimulator());
}
public static Set<String> getSimulatorNames() {
return tntSimulators.keySet();
}
public static TNTSimulator getSimulator(String name) {
return tntSimulators.get(name);
}
public static TNTSimulator getSimulator(Player player) {
TNTSimulator current = getSimulator(player.getInventory().getItemInMainHand());
if (current != null) return current;
public static Simulator getSimulator(Player player) {
Simulator simulator = getSimulator(player.getInventory().getItemInMainHand());
if (simulator != null) return simulator;
return getSimulator(player.getInventory().getItemInOffHand());
}
public static TNTSimulator getSimulator(ItemStack itemStack) {
if (itemStack == null) {
return null;
}
if (!ItemUtils.isItem(itemStack, "simulator")) {
public static Simulator getSimulator(ItemStack itemStack) {
if (!SimulatorCursor.isSimulatorItem(itemStack)) {
return null;
}
String selection = ItemUtils.getTag(itemStack, simulatorSelection);
if (selection == null) {
return null;
}
return tntSimulators.get(selection);
return simulatorMap.get(selection);
}
public static void setSimulator(Player player, ItemStack itemStack, TNTSimulator simulator) {
for (Map.Entry<String, TNTSimulator> entry : tntSimulators.entrySet()) {
if (entry.getValue() == simulator) {
ItemUtils.setTag(itemStack, simulatorSelection, entry.getKey());
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName(BauSystem.MESSAGE.parse("SIMULATOR_WAND_NAME_SELECTED", player, entry.getKey()));
itemStack.setItemMeta(itemMeta);
return;
public static Simulator getSimulator(String name) {
return simulatorMap.get(name);
}
public static void addSimulator(String name, Simulator simulator) {
simulatorMap.putIfAbsent(name, simulator);
}
@Override
public void enable() {
SimFormatSimulatorLoader simFormatSimulatorLoader = new SimFormatSimulatorLoader();
SimulatorFormatSimulatorLoader simulatorFormatSimulatorLoader = new SimulatorFormatSimulatorLoader();
YAPIONFormatSimulatorLoader yapionFormatSimulatorLoader = new YAPIONFormatSimulatorLoader();
File[] files = simulatorsDir.listFiles();
if (files == null) return;
for (File file : files) {
try {
List<Simulator> simulators = simFormatSimulatorLoader.load(file)
.orElse(null);
if (simulators != null) {
simulators.forEach(simulator -> {
simulatorMap.put(simulator.getName(), simulator);
});
continue;
}
} catch (Exception e) {
// Ignore
}
try {
List<Simulator> simulators = simulatorFormatSimulatorLoader.load(file)
.orElse(null);
if (simulators != null) {
simulators.forEach(simulator -> {
simulatorMap.put(simulator.getName(), simulator);
SimulatorSaver.saveSimulator(simulatorsDir, simulator);
});
continue;
}
} catch (Exception e) {
// Ignore
}
try {
List<Simulator> simulators = yapionFormatSimulatorLoader.load(file)
.orElse(null);
if (simulators != null) {
simulators.forEach(simulator -> {
simulatorMap.put(simulator.getName(), simulator);
SimulatorSaver.saveSimulator(simulatorsDir, simulator);
});
}
} catch (Exception e) {
// Ignore
}
}
}
public static void delete(String name) {
TNTSimulator tntSimulator = tntSimulators.remove(name);
if (tntSimulator != null) {
tntSimulator.close();
}
new File(simulatorsDir, name + ".simulator").delete();
}
public static void openSimulatorSelector(Player player) {
SimulatorPageGui<Simulator> simulatorPageGui = new SimulatorPageGui<Simulator>(player, null, 6 * 9, new ArrayList<>(simulatorMap.values())) {
@Override
public String baseTitle() {
return "Simulators";
}
public static void copySimulator(TNTSimulator tntSimulator, String name) {
tntSimulators.put(name, new TNTSimulator(tntSimulator.toYAPION()));
}
@Override
public void headerAndFooter() {
inventory.setItem(49, new SWItem(Material.NAME_TAG, "§eCreate", clickType -> {
SWAnvilInv anvilInv = new SWAnvilInv(player, "Name");
anvilInv.setCallback(s -> {
Simulator sim = SimulatorStorage.getSimulator(s);
if (sim != null) {
BauSystem.MESSAGE.send("SIMULATOR_NAME_ALREADY_EXISTS", player);
return;
}
if (!s.matches("[a-zA-Z_0-9-]+")) {
BauSystem.MESSAGE.send("SIMULATOR_NAME_INVALID", player);
return;
}
sim = new Simulator(s);
SimulatorStorage.addSimulator(s, sim);
SimulatorStorage.setSimulator(player, sim);
});
anvilInv.open();
}));
}
public static void removeSimulator(ItemStack itemStack) {
if (!ItemUtils.isItem(itemStack, "simulator")) {
return;
}
ItemUtils.setTag(itemStack, simulatorSelection, null);
@Override
public SWItem convert(Simulator simulator) {
return simulator.toItem(player, clickType -> {
setSimulator(player, simulator);
player.closeInventory();
});
}
};
simulatorPageGui.open();
}
public static ItemStack getWand(Player p) {
@ -130,68 +178,48 @@ public class SimulatorStorage implements Enable, Disable {
return itemStack;
}
@Override
public void enable() {
if (!simulatorsDir.exists()) {
simulatorsDir.mkdir();
public static void setSimulator(Player player, Simulator simulator) {
ItemStack mainHand = player.getInventory().getItemInMainHand();
ItemStack offHand = player.getInventory().getItemInOffHand();
ItemStack itemStack;
if (SimulatorCursor.isSimulatorItem(mainHand)) {
itemStack = mainHand;
} else if (SimulatorCursor.isSimulatorItem(offHand)) {
itemStack = offHand;
} else {
itemStack = null;
}
File[] files = simulatorsDir.listFiles();
if (files == null) return;
for (File file : files) {
YAPIONObject yapionObject;
try {
yapionObject = YAPIONParser.parse(file);
} catch (YAPIONException | IOException e) {
continue;
}
if (file.getName().endsWith(".yapion")) {
String name = file.getName().substring(0, file.getName().length() - 7);
try {
SteamwarUser steamwarUser = SteamwarUser.get(Integer.parseInt(name));
convert(file, steamwarUser);
} catch (Exception e) {
file.delete();
}
} else {
String name = file.getName().substring(0, file.getName().length() - ".simulator".length());
tntSimulators.put(name, new TNTSimulator(yapionObject));
}
}
}
private static void convert(File file, SteamwarUser steamwarUser) {
YAPIONObject yapionObject;
try {
yapionObject = YAPIONParser.parse(file);
} catch (YAPIONException | IOException e) {
if (itemStack == null) {
return;
}
try {
file.delete();
} catch (Exception e) {
e.printStackTrace();
}
for (String s : yapionObject.getKeys()) {
String newName = steamwarUser.getUserName() + (s.isEmpty() ? "" : "_" + s);
YAPIONArray content = yapionObject.getArray(s);
if (content.isEmpty()) continue;
TNTSimulator tntSimulator = new TNTSimulator();
for (YAPIONObject element : content.streamObject().collect(Collectors.toList())) {
tntSimulator.getTntElementList().add(new TNTElement(element, null, tntSimulator.getEntityServer()));
}
tntSimulators.put(newName, tntSimulator);
}
ItemUtils.setTag(itemStack, simulatorSelection, simulator.getName());
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName(BauSystem.MESSAGE.parse("SIMULATOR_WAND_NAME_SELECTED", player, simulator.getName()));
itemStack.setItemMeta(itemMeta);
}
@Override
public void disable() {
for (Map.Entry<String, TNTSimulator> entry : tntSimulators.entrySet()) {
try {
entry.getValue().toYAPION().toFile(new File(simulatorsDir, entry.getKey() + ".simulator"));
} catch (Exception e) {
e.printStackTrace();
}
public static List<String> getSimulatorNames() {
return new ArrayList<>(simulatorMap.keySet());
}
public static void delete(Simulator simulator) {
simulatorMap.remove(simulator.getName());
new File(simulatorsDir, simulator.getName() + ".sim").delete();
}
public static boolean copy(Simulator simulator, String name) {
try {
File file = new File(simulatorsDir, name + ".sim");
Files.copy(new File(simulatorsDir, simulator.getName() + ".sim"), file);
new SimFormatSimulatorLoader().load(file).ifPresent(simulators -> {
simulators.forEach(sim -> {
simulatorMap.put(sim.getName(), sim);
});
});
return true;
} catch (IOException e) {
return false;
}
}
}

Datei anzeigen

@ -0,0 +1,129 @@
/*
* 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;
import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.data.SimulatorElement;
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
import de.steamwar.bausystem.features.simulator.storage.SimulatorSaver;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.entity.REntity;
import de.steamwar.entity.REntityServer;
import de.steamwar.entity.RFallingBlockEntity;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.MinVersion;
import lombok.experimental.UtilityClass;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.util.Vector;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
@UtilityClass
public class SimulatorWatcher {
private final World WORLD = Bukkit.getWorlds().get(0);
private Map<Simulator, REntityServer> entityServers = new HashMap<>();
private Map<Player, Pair<Simulator, Runnable>> watchers = new HashMap<>();
public void watch(Player player, Simulator simulator, Runnable watcher) {
if (simulator == null || watcher == null) {
watchers.remove(player);
} else {
watchers.put(player, new Pair<>(simulator, watcher));
}
}
public synchronized void update(Simulator simulator) {
REntityServer rEntityServer = entityServers.get(simulator);
if (rEntityServer != null) {
rEntityServer.getEntities().forEach(REntity::die);
createSim(rEntityServer, simulator);
}
new ArrayList<>(watchers.values()).forEach(simulatorRunnablePair -> {
if (simulatorRunnablePair.getKey() == simulator) {
simulatorRunnablePair.getValue().run();
}
});
SimulatorSaver.saveSimulator(SimulatorStorage.simulatorsDir, simulator);
}
@Linked
@MinVersion(19)
public static class QuitListener implements Listener {
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
watchers.remove(event.getPlayer());
show(null, event.getPlayer());
}
}
private REntityServer createSim(REntityServer server, Simulator simulator) {
if (simulator == null) {
return null;
}
Map<Vector, Set<Class<?>>> positionCache = new HashMap<>();
simulator.getGroups().stream().map(group -> group.getElements().stream().map(element -> new Pair<>(group, element)).collect(Collectors.toList())).flatMap(List::stream).forEach(pair -> {
SimulatorGroup group = pair.getKey();
SimulatorElement<?> element = pair.getValue();
boolean wasNotPresent = positionCache.computeIfAbsent(element.getPosition(), __ -> new HashSet<>())
.add(element.getClass());
if (!wasNotPresent) return;
Material material = group.isDisabled() || element.isDisabled() ? element.getWorldDisabledMaterial() : element.getWorldMaterial();
Location location = element.getWorldPos().toLocation(WORLD);
RFallingBlockEntity rFallingBlockEntity = new RFallingBlockEntity(server, location, material);
rFallingBlockEntity.setNoGravity(true);
});
return server;
}
public synchronized boolean show(Simulator sim, Player player) {
AtomicBoolean removed = new AtomicBoolean();
entityServers.forEach((simulator, rEntityServer) -> {
if (rEntityServer == null) return;
if (rEntityServer.getPlayers().contains(player) && sim != simulator) {
rEntityServer.removePlayer(player);
removed.set(true);
}
});
if (sim == null) return removed.get();
entityServers.computeIfAbsent(sim, __ -> createSim(new REntityServer(), sim)).addPlayer(player);
return removed.get();
}
synchronized List<REntity> getEntitiesOfSimulator(Simulator simulator) {
REntityServer entityServer = entityServers.get(simulator);
if (entityServer == null) {
return Collections.emptyList();
}
return entityServer.getEntities();
}
}

Datei anzeigen

@ -1,270 +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.simulator;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.bausystem.features.simulator.gui.TNTElementGUI;
import de.steamwar.bausystem.features.simulator.gui.TNTSimulatorGui;
import de.steamwar.bausystem.features.simulator.tnt.SimulatorElement;
import de.steamwar.bausystem.features.simulator.tnt.TNTElement;
import de.steamwar.bausystem.features.simulator.tnt.TNTGroup;
import de.steamwar.bausystem.features.tracer.record.Recorder;
import de.steamwar.bausystem.features.tracer.record.SingleTraceRecorder;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.bausystem.utils.RayTraceUtils;
import de.steamwar.entity.REntity;
import de.steamwar.entity.REntityServer;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import yapion.hierarchy.types.YAPIONArray;
import yapion.hierarchy.types.YAPIONObject;
import yapion.hierarchy.types.YAPIONType;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@Getter
public class TNTSimulator {
private Set<Player> players = new HashSet<>();
private REntityServer entityServer = new REntityServer();
private Material material = Material.TNT;
private List<SimulatorElement> tntElementList = new ArrayList<>();
public TNTSimulator() {
}
public TNTSimulator(YAPIONObject yapionObject) {
material = Material.valueOf(yapionObject.getStringOrDefault("material", Material.TNT.name()));
YAPIONArray yapionArray = yapionObject.getArrayOrDefault("tntElements", new YAPIONArray());
for (YAPIONObject element : yapionArray.streamObject().collect(Collectors.toList())) {
if (element.containsKey("elements", YAPIONType.ARRAY)) {
tntElementList.add(new TNTGroup(element, entityServer));
} else {
tntElementList.add(new TNTElement(element, null, entityServer));
}
}
}
public YAPIONObject toYAPION() {
YAPIONObject yapionObject = new YAPIONObject();
yapionObject.add("material", material.name());
YAPIONArray yapionArray = new YAPIONArray();
for (SimulatorElement element : tntElementList) {
yapionArray.add(element.toYAPION());
}
yapionObject.add("tntElements", yapionArray);
return yapionObject;
}
public void close() {
entityServer.close();
}
public void show(Player player) {
if (!players.contains(player)) {
entityServer.addPlayer(player);
players.add(player);
}
}
public void hide(Player player) {
if (players.contains(player)) {
entityServer.removePlayer(player);
players.remove(player);
}
}
void _hide(Player player) {
players.remove(player);
}
public List<REntity> getEntities() {
return tntElementList.stream().flatMap(element -> element.getEntities().stream()).collect(Collectors.toList());
}
public List<SimulatorElement> getEntity(REntity entity) {
List<SimulatorElement> tntSpawns = new ArrayList<>();
for (SimulatorElement spawn : tntElementList) {
spawn.getEntity(tntSpawns, entity);
}
return tntSpawns;
}
public void clear() {
new ArrayList<>(tntElementList).forEach(this::remove);
}
public void remove(SimulatorElement element) {
if (element instanceof TNTElement) {
TNTElement tntElement = (TNTElement) element;
if (tntElement.hasParent()) {
tntElement.getParent().remove(tntElement);
if (tntElement.getParent().getElements().isEmpty()) {
remove(tntElement.getParent());
}
} else {
element.remove(tntElement);
}
} else if (element instanceof TNTGroup) {
TNTGroup tntGroup = (TNTGroup) element;
tntGroup.getElements().forEach(tntElement -> {
tntElement.remove(tntElement);
});
tntGroup.getElements().clear();
}
element.close();
tntElementList.remove(element);
}
public void change() {
tntElementList.forEach(simulatorElement -> {
simulatorElement.change();
if (simulatorElement instanceof TNTGroup) {
((TNTGroup) simulatorElement).getElements().forEach(SimulatorElement::change);
}
});
}
public void edit(Player player, RayTraceUtils.RRayTraceResult result) {
if (result == null) {
TNTSimulatorGui.open(player, this, null, this::getTntElementList, null);
return;
}
SimulatorCursor.show(player, this, result);
if (result.getHitEntity() != null) {
List<SimulatorElement> elements = getEntity(result.getHitEntity());
if (elements.isEmpty()) return;
if (elements.size() == 1) {
TNTElementGUI.open(player, (TNTElement) elements.get(0), null);
} else {
List<TNTGroup> tntGroups = tntElementList.stream().filter(TNTGroup.class::isInstance).map(TNTGroup.class::cast).collect(Collectors.toList());
List<SimulatorElement> newElementList = new ArrayList<>();
for (TNTGroup tntGroup : tntGroups) {
if (new HashSet<>(elements).containsAll(tntGroup.getElements())) {
newElementList.add(tntGroup);
elements.removeAll(tntGroup.getElements());
}
}
newElementList.addAll(elements);
if (newElementList.size() == 1) {
SimulatorElement element = newElementList.get(0);
if (element instanceof TNTGroup) {
TNTGroup tntGroup = (TNTGroup) element;
TNTSimulatorGui.open(player, null, tntGroup, () -> {
List<SimulatorElement> elementList = new ArrayList<>();
elementList.addAll(tntGroup.getElements());
return elementList;
}, null);
} else {
TNTElementGUI.open(player, (TNTElement) elements.get(0), null);
}
} else {
TNTSimulatorGui.open(player, null, null, () -> newElementList, null);
}
}
return;
}
if (SimulatorStorage.getSimulator(player.getInventory().getItemInOffHand()) != null && result.getHitPosition().distanceSquared(player.getLocation().toVector()) < 25) {
return;
}
TNTElement tntElement = new TNTElement(SimulatorCursor.getPos(player, result), null, entityServer);
tntElementList.add(tntElement);
TNTElementGUI.open(player, tntElement, null);
}
public void start(Player p) {
Region region = Region.getRegion(p.getLocation());
Map<Integer, Map<Integer, Set<Pair<Runnable, Integer>>>> result = new HashMap<>();
boolean regionFrozen = false;
for (SimulatorElement element : tntElementList) {
regionFrozen |= element.locations(result, region, p.getLocation());
}
if (regionFrozen) {
BauSystem.MESSAGE.send("SIMULATOR_REGION_FROZEN", p);
return;
}
AtomicBoolean needsAutoTrace = new AtomicBoolean();
players.forEach(player -> {
boolean simulatorAutoTrace = Config.getInstance().get(player).getPlainValueOrDefault("simulatorAutoTrace", false);
if (simulatorAutoTrace) {
needsAutoTrace.set(true);
player.performCommand("trace show");
}
});
if (needsAutoTrace.get()) {
Recorder.INSTANCE.set(region, new SingleTraceRecorder(region));
}
AtomicInteger maxTick = new AtomicInteger(0);
Map<Integer, List<List<Pair<Runnable, Integer>>>> toSpawn = new HashMap<>();
result.forEach((integer, integerSetMap) -> {
List<Pair<Integer, Set<Pair<Runnable, Integer>>>> internal = new ArrayList<>();
integerSetMap.forEach((integer1, pairs) -> {
internal.add(new Pair<>(integer1, pairs));
});
internal.sort(Comparator.comparingInt(Pair::getKey));
toSpawn.put(integer, internal.stream().map(Pair::getValue).map(ArrayList::new).peek(Collections::shuffle).collect(Collectors.toList()));
if (maxTick.get() < integer) {
maxTick.set(integer);
}
});
AtomicInteger currentTick = new AtomicInteger(0);
BauSystem.runTaskTimer(BauSystem.getInstance(), bukkitTask -> {
int tick = currentTick.get();
if (tick > maxTick.get()) bukkitTask.cancel();
currentTick.incrementAndGet();
List<List<Pair<Runnable, Integer>>> toSpawnInTick = toSpawn.get(tick);
if (toSpawnInTick == null) return;
toSpawnInTick.forEach(pairs -> {
AtomicBoolean hasSomeLeft = new AtomicBoolean(true);
while(hasSomeLeft.get()) {
hasSomeLeft.set(false);
pairs.forEach(pair -> {
if (pair.getValue() > 0) {
hasSomeLeft.set(true);
pair.getKey().run();
pair.setValue(pair.getValue() - 1);
}
});
}
});
}, 1, 1);
}
}

Datei anzeigen

@ -1,130 +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.simulator;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.simulator.gui.SimulatorSelectionGUI;
import de.steamwar.bausystem.utils.ItemUtils;
import de.steamwar.bausystem.utils.RayTraceUtils;
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.player.*;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import java.util.function.Function;
@Linked
public class TNTSimulatorListener implements Listener {
private boolean permissionCheck(Player player) {
if (!Permission.hasPermission(player, Permission.WORLD)) {
BauSystem.MESSAGE.send("SIMULATOR_NO_PERMS", player);
return false;
}
return true;
}
static RayTraceUtils.RRayTraceResult trace(Player player, Location to, TNTSimulator simulator) {
return RayTraceUtils.traceREntity(player, to, simulator.getEntities());
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent e) {
if (ItemUtils.isItem(e.getPlayer().getInventory().getItemInMainHand(), "simulator")) {
simulatorShowHide(e.getPlayer(), i -> null, PlayerInventory::getItemInMainHand, e.getTo());
} else {
SimulatorCursor.hide(e.getPlayer());
}
}
@EventHandler
public void onPlayerItemHeld(PlayerItemHeldEvent e) {
simulatorShowHide(e.getPlayer(), i -> i.getItem(e.getPreviousSlot()), i -> i.getItem(e.getNewSlot()), e.getPlayer().getLocation());
}
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent e) {
simulatorShowHide(e.getPlayer(), i -> e.getItemDrop().getItemStack(), i -> null, e.getPlayer().getLocation());
}
private TNTSimulator simulatorShowHide(Player player, Function<PlayerInventory, ItemStack> oldItemFunction, Function<PlayerInventory, ItemStack> newItemFunction, Location location) {
TNTSimulator oldSimulator = SimulatorStorage.getSimulator(oldItemFunction.apply(player.getInventory()));
SimulatorCursor.hide(player, oldSimulator);
TNTSimulator simulator = SimulatorStorage.getSimulator(newItemFunction.apply(player.getInventory()));
if (simulator == null) return null;
SimulatorCursor.show(player, simulator, trace(player, location, simulator));
return simulator;
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
if (ItemUtils.isItem(e.getPlayer().getInventory().getItemInMainHand(), "simulator")) {
simulatorShowHide(e.getPlayer(), i -> null, PlayerInventory::getItemInMainHand, e.getPlayer().getLocation());
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
SimulatorCursor.hide(event.getPlayer(), null);
SimulatorStorage.getSimulatorNames().forEach(s -> {
SimulatorStorage.getSimulator(s)._hide(event.getPlayer());
});
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (!ItemUtils.isItem(event.getItem(), "simulator")) {
return;
}
event.setCancelled(true);
if (!permissionCheck(event.getPlayer())) {
return;
}
TNTSimulator simulator = SimulatorStorage.getSimulator(event.getItem());
switch (event.getAction()) {
case LEFT_CLICK_BLOCK:
case LEFT_CLICK_AIR:
if (simulator == null) {
return;
}
simulator.start(event.getPlayer());
break;
case RIGHT_CLICK_BLOCK:
case RIGHT_CLICK_AIR:
if (simulator == null) {
SimulatorSelectionGUI.open(event.getPlayer(), event.getItem());
} else {
simulator.edit(event.getPlayer(), trace(event.getPlayer(), event.getPlayer().getLocation(), simulator));
}
break;
default:
break;
}
}
}

Datei anzeigen

@ -0,0 +1,65 @@
/*
* 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.data;
import de.steamwar.bausystem.features.simulator.execute.SimulatorAction;
import de.steamwar.inventory.InvCallback;
import de.steamwar.inventory.SWItem;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
@Getter
@Setter
@RequiredArgsConstructor
public final class Simulator {
private Material material = Material.BARREL;
private final String name;
private boolean autoTrace = false;
private final List<SimulatorGroup> groups = new ArrayList<>();
public void move(int x, int y, int z) {
groups.forEach(simulatorGroup -> {
simulatorGroup.move(x, y, z);
});
}
public SWItem toItem(Player player, InvCallback invCallback) {
return new SWItem(material, "§e" + name, invCallback);
}
public void toSimulatorActions(BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd) {
groups.forEach(simulatorGroup -> {
simulatorGroup.toSimulatorActions(tickStart, tickEnd);
});
}
public Simulator add(SimulatorGroup group) {
groups.add(group);
return this;
}
}

Datei anzeigen

@ -0,0 +1,35 @@
/*
* 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.data;
import org.bukkit.Material;
import org.bukkit.util.Vector;
public abstract class SimulatorBlockAlignedElement<T extends SimulatorPhase> extends SimulatorElement<T> {
protected SimulatorBlockAlignedElement(Material material, Vector position) {
super(material, position);
}
@Override
public final boolean canBeInGroup(SimulatorGroup simulatorGroup) {
return simulatorGroup.getElements().stream().allMatch(SimulatorBlockAlignedElement.class::isInstance);
}
}

Datei anzeigen

@ -0,0 +1,126 @@
/*
* 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.data;
import de.steamwar.bausystem.features.simulator.execute.SimulatorAction;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.inventory.InvCallback;
import de.steamwar.inventory.SWItem;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import yapion.hierarchy.types.YAPIONObject;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
@Getter
@Setter
public abstract class SimulatorElement<T extends SimulatorPhase> {
protected Material material;
protected final Vector position;
protected boolean disabled = false;
protected final List<T> phases = new ArrayList<>();
protected SimulatorElement(Material material, Vector position) {
this.material = material;
this.position = position;
}
public SimulatorElement<T> add(T setting) {
phases.add(setting);
return this;
}
public void sort() {
phases.sort(Comparator.comparingInt(SimulatorPhase::getTickOffset));
}
public abstract String getName(Player player);
public int getBaseTick() {
return phases.stream()
.mapToInt(value -> value.tickOffset)
.min()
.orElse(0);
}
public void changeBaseTicks(int tick) {
phases.forEach(t -> {
t.tickOffset += tick;
});
}
public void move(double x, double y, double z) {
position.setX(position.getX() + x);
position.setY(position.getY() + y);
position.setZ(position.getZ() + z);
}
public abstract Material getWorldMaterial();
public abstract Material getWorldDisabledMaterial();
public abstract boolean canBeInGroup(SimulatorGroup simulatorGroup);
public Vector getWorldPos() {
return position;
}
public SWItem toItem(Player player, InvCallback invCallback) {
List<String> lore = new ArrayList<>();
lore.add("§7Phase count§8:§e " + phases.size());
lore.add("§7Tick§8:§e " + getBaseTick());
lore.add("");
lore.add("§7X§8:§e " + position.getX());
lore.add("§7Y§8:§e " + position.getY());
lore.add("§7Z§8:§e " + position.getZ());
if (disabled) {
lore.add("");
lore.add("§cDisabled");
}
return new SWItem(material, "§e" + getName(player), lore, disabled, invCallback);
}
public void toSimulatorActions(BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd) {
if (disabled) return;
phases.forEach(phase -> {
phase.toSimulatorActions(position.clone(), tickStart, tickEnd);
});
}
public abstract void open(Player player, Simulator simulator, SimulatorGroup group, SimulatorBaseGui back);
public SimulatorGroup getGroup(Simulator simulator) {
return simulator.getGroups().stream()
.filter(simulatorGroup -> simulatorGroup.getElements().contains(this))
.findFirst()
.orElse(null);
}
public abstract String getType();
public void saveExtra(YAPIONObject elementObject) {}
public void loadExtra(YAPIONObject elementObject) {}
}

Datei anzeigen

@ -0,0 +1,93 @@
/*
* 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.data;
import de.steamwar.bausystem.features.simulator.execute.SimulatorAction;
import de.steamwar.inventory.InvCallback;
import de.steamwar.inventory.SWItem;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.function.BiConsumer;
@Getter
@Setter
public final class SimulatorGroup {
private Material material = Material.CHEST;
private boolean disabled = false;
private final List<SimulatorElement<?>> elements = new ArrayList<>();
public SimulatorGroup add(SimulatorElement<?> element) {
if (!elements.contains(element)) {
elements.add(element);
}
return this;
}
public void sort() {
elements.sort(Comparator.comparingInt(SimulatorElement::getBaseTick));
}
public int getBaseTick() {
return elements.stream()
.mapToInt(SimulatorElement::getBaseTick)
.min()
.orElse(0);
}
public void changeBaseTicks(int tick) {
elements.forEach(simulatorElement -> {
simulatorElement.changeBaseTicks(tick);
});
}
public void move(double x, double y, double z) {
elements.forEach(simulatorElement -> {
simulatorElement.move(x, y, z);
});
}
public SWItem toItem(Player player, InvCallback groupCallback, InvCallback itemCallback) {
if (elements.size() == 1) {
return elements.get(0).toItem(player, itemCallback);
} else {
List<String> lore = new ArrayList<>();
lore.add("§7Element count§8:§e " + elements.size());
lore.add("§7Tick§8:§e " + getBaseTick());
if (disabled) {
lore.add("");
lore.add("§cDisabled");
}
return new SWItem(material != null ? material : Material.ENDER_CHEST, "§eGroup", lore, disabled, groupCallback);
}
}
public void toSimulatorActions(BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd) {
if (disabled) return;
elements.forEach(simulatorElement -> {
simulatorElement.toSimulatorActions(tickStart, tickEnd);
});
}
}

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.simulator.data;
import de.steamwar.bausystem.features.simulator.execute.SimulatorAction;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.util.Vector;
import yapion.hierarchy.types.YAPIONObject;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
@Getter
@Setter
public abstract class SimulatorPhase {
public static final int ORDER_LIMIT = 30;
protected int tickOffset = 0;
protected int lifetime = 80;
protected int order = 0;
public abstract void toSimulatorActions(Vector position, BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd);
public void saveExtra(YAPIONObject phaseObject) {}
public void loadExtra(YAPIONObject phaseObject) {}
}

Datei anzeigen

@ -0,0 +1,99 @@
/*
* 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.data.observer;
import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.data.SimulatorBlockAlignedElement;
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
import de.steamwar.bausystem.features.simulator.data.SimulatorPhase;
import de.steamwar.bausystem.features.simulator.execute.SimulatorAction;
import de.steamwar.bausystem.features.simulator.gui.SimulatorObserverGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BiConsumer;
public final class ObserverElement extends SimulatorBlockAlignedElement<ObserverPhase> {
public ObserverElement(Vector position) {
super(Material.OBSERVER, position);
}
@Override
public String getName(Player player) {
return "Observer";
}
@Override
public Material getWorldMaterial() {
return Material.OBSERVER;
}
@Override
public Material getWorldDisabledMaterial() {
return Material.GRAY_STAINED_GLASS;
}
public void toSimulatorActions(BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd) {
if (disabled) return;
phases.forEach(phase -> {
phase.toSimulatorActions(position.clone(), tickStart, tickEnd);
});
int end = phases.stream().mapToInt(SimulatorPhase::getTickOffset).max().orElse(0) + 4;
AtomicReference<BlockState> blockState = new AtomicReference<>();
tickStart.accept(0, new SimulatorAction(-100, 1) {
@Override
public void accept(World world) {
Block block = world.getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
blockState.set(block.getState());
block.setType(Material.OBSERVER, false);
}
});
tickEnd.accept(end, new SimulatorAction(0, 1) {
@Override
public void accept(World world) {
BlockState oldState = blockState.get();
if (oldState != null) {
oldState.update(true, true);
} else {
Block block = world.getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
block.setType(Material.AIR);
}
}
});
}
@Override
public void open(Player player, Simulator simulator, SimulatorGroup group, SimulatorBaseGui back) {
new SimulatorObserverGui(player, simulator, group, this, back).open();
}
@Override
public String getType() {
return "Observer";
}
}

Datei anzeigen

@ -0,0 +1,81 @@
/*
* 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.data.observer;
import de.steamwar.bausystem.features.simulator.data.SimulatorPhase;
import de.steamwar.bausystem.features.simulator.execute.SimulatorAction;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.type.Observer;
import org.bukkit.util.Vector;
import yapion.hierarchy.types.YAPIONObject;
import java.util.function.BiConsumer;
@NoArgsConstructor
public final class ObserverPhase extends SimulatorPhase {
@Getter
@Setter
private BlockFace orientation = BlockFace.UP;
public ObserverPhase(int tickOffset) {
this.tickOffset = tickOffset;
}
{
this.lifetime = 0;
}
@Override
public void toSimulatorActions(Vector position, BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd) {
Observer observer = (Observer) Material.OBSERVER.createBlockData();
observer.setFacing(orientation.getOppositeFace());
observer.setPowered(true);
tickStart.accept(tickOffset, new SimulatorAction(order, 1) {
@Override
public void accept(World world) {
Block block = world.getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
Block updateBlock = block.getRelative(orientation);
BlockState state = updateBlock.getState();
updateBlock.setType(Material.SPONGE, true);
block.setBlockData(observer, true);
state.update(true, true);
}
});
}
@Override
public void saveExtra(YAPIONObject phaseObject) {
phaseObject.add("orientation", orientation.name());
}
@Override
public void loadExtra(YAPIONObject phaseObject) {
orientation = BlockFace.valueOf(phaseObject.getPlainValue("orientation"));
}
}

Datei anzeigen

@ -0,0 +1,66 @@
/*
* 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.data.redstone;
import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.data.SimulatorBlockAlignedElement;
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
import de.steamwar.bausystem.features.simulator.gui.SimulatorRedstoneGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public final class RedstoneElement extends SimulatorBlockAlignedElement<RedstonePhase> {
public RedstoneElement(Vector position) {
super(Material.REDSTONE_BLOCK, position);
}
@Override
public String getName(Player player) {
return "Redstone";
}
@Override
public Material getWorldMaterial() {
return Material.REDSTONE_BLOCK;
}
@Override
public Material getWorldDisabledMaterial() {
return Material.WHITE_STAINED_GLASS;
}
@Override
public Vector getWorldPos() {
return position.clone().add(new Vector(0.5, 0, 0.5));
}
@Override
public void open(Player player, Simulator simulator, SimulatorGroup group, SimulatorBaseGui back) {
new SimulatorRedstoneGui(player, simulator, group, this, back).open();
}
@Override
public String getType() {
return "Redstone";
}
}

Datei anzeigen

@ -0,0 +1,70 @@
/*
* 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.data.redstone;
import de.steamwar.bausystem.features.simulator.data.SimulatorPhase;
import de.steamwar.bausystem.features.simulator.execute.SimulatorAction;
import lombok.NoArgsConstructor;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.util.Vector;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BiConsumer;
@NoArgsConstructor
public final class RedstonePhase extends SimulatorPhase {
public RedstonePhase(int tickOffset) {
this.tickOffset = tickOffset;
}
{
this.lifetime = 1;
}
@Override
public void toSimulatorActions(Vector position, BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd) {
AtomicReference<BlockState> blockState = new AtomicReference<>();
tickStart.accept(tickOffset, new SimulatorAction(order, 1) {
@Override
public void accept(World world) {
Block block = world.getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
blockState.set(block.getState());
block.setType(Material.REDSTONE_BLOCK);
}
});
tickStart.accept(tickOffset + lifetime, new SimulatorAction(ORDER_LIMIT + 1, 1) {
@Override
public void accept(World world) {
BlockState state = blockState.get();
if (state != null) {
state.update(true, true);
} else {
Block block = world.getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
block.setType(Material.AIR);
}
}
});
}
}

Datei anzeigen

@ -0,0 +1,113 @@
/*
* 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.data.tnt;
import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.data.SimulatorElement;
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
import de.steamwar.bausystem.features.simulator.gui.SimulatorTNTGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.inventory.InvCallback;
import de.steamwar.inventory.SWItem;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import yapion.hierarchy.types.YAPIONObject;
public final class TNTElement extends SimulatorElement<TNTPhase> {
public static final double SUB_PIXEL = 0.00999999046326;
@Getter
private final Vector alignment = new Vector();
public TNTElement(Vector position) {
super(Material.TNT, position);
}
@Override
public String getName(Player player) {
return "TNT";
}
public void move(double x, double y, double z) {
position.setX(position.getX() + x);
position.setY(position.getY() + y);
position.setZ(position.getZ() + z);
}
public void alignX(int direction) {
position.setX(position.getX() - SUB_PIXEL * alignment.getX());
alignment.setX(direction);
position.setX(position.getX() + SUB_PIXEL * alignment.getX());
}
public void alignZ(int direction) {
position.setZ(position.getZ() - SUB_PIXEL * alignment.getZ());
alignment.setZ(direction);
position.setZ(position.getZ() + SUB_PIXEL * alignment.getZ());
}
@Override
public SWItem toItem(Player player, InvCallback invCallback) {
long sum = phases.stream().mapToInt(TNTPhase::getCount).sum();
SWItem swItem = super.toItem(player, invCallback);
swItem.getItemStack().setAmount((int) Math.min(64, Math.max(1, sum)));
swItem.setName("§e" + getName(player) + "§8:§7 " + sum);
return swItem;
}
@Override
public Material getWorldMaterial() {
return Material.TNT;
}
@Override
public Material getWorldDisabledMaterial() {
return Material.RED_STAINED_GLASS;
}
@Override
public boolean canBeInGroup(SimulatorGroup simulatorGroup) {
return simulatorGroup.getElements().stream().allMatch(TNTElement.class::isInstance);
}
@Override
public void open(Player player, Simulator simulator, SimulatorGroup group, SimulatorBaseGui back) {
new SimulatorTNTGui(player, simulator, this, group, back).open();
}
@Override
public String getType() {
return "TNT";
}
@Override
public void saveExtra(YAPIONObject elementObject) {
elementObject.add("alignmentX", alignment.getX());
elementObject.add("alignmentZ", alignment.getZ());
}
@Override
public void loadExtra(YAPIONObject elementObject) {
alignment.setX(elementObject.getDoubleOrSetDefault("alignmentX", 0));
alignment.setZ(elementObject.getDoubleOrSetDefault("alignmentZ", 0));
}
}

Datei anzeigen

@ -0,0 +1,97 @@
/*
* 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.data.tnt;
import de.steamwar.bausystem.features.simulator.data.SimulatorPhase;
import de.steamwar.bausystem.features.simulator.execute.SimulatorAction;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.util.Vector;
import yapion.hierarchy.types.YAPIONObject;
import java.util.function.BiConsumer;
@Getter
@Setter
@NoArgsConstructor
public final class TNTPhase extends SimulatorPhase {
private int count = 1;
private boolean xJump = false;
private boolean yJump = false;
private boolean zJump = false;
public TNTPhase(int tickOffset) {
this.tickOffset = tickOffset;
}
public boolean hasJump() {
return xJump || yJump || zJump;
}
public void setJump(boolean jump) {
xJump = jump;
yJump = jump;
zJump = jump;
}
@Override
public void toSimulatorActions(Vector position, BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd) {
tickStart.accept(tickOffset, new SimulatorAction(order, count) {
@Override
public void accept(World world) {
Location location = position.toLocation(world);
if (Region.getRegion(location).get(Flag.FREEZE) == FreezeMode.ACTIVE) return;
TNTPrimed tnt = world.spawn(location, TNTPrimed.class);
if (!xJump) tnt.setVelocity(tnt.getVelocity().setX(0));
if (!yJump) tnt.setVelocity(tnt.getVelocity().setY(0));
if (!zJump) tnt.setVelocity(tnt.getVelocity().setZ(0));
tnt.setFuseTicks(lifetime);
}
});
tickEnd.accept(tickOffset + lifetime, new SimulatorAction(0, 1) {
@Override
public void accept(World world) {
}
});
}
@Override
public void saveExtra(YAPIONObject phaseObject) {
phaseObject.add("count", count);
phaseObject.add("xJump", xJump);
phaseObject.add("yJump", yJump);
phaseObject.add("zJump", zJump);
}
@Override
public void loadExtra(YAPIONObject phaseObject) {
count = phaseObject.getPlainValue("count");
xJump = phaseObject.getPlainValue("xJump");
yJump = phaseObject.getPlainValue("yJump");
zJump = phaseObject.getPlainValue("zJump");
}
}

Datei anzeigen

@ -0,0 +1,36 @@
/*
* 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.execute;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.World;
import java.util.function.Consumer;
@Getter
@AllArgsConstructor
public abstract class SimulatorAction implements Consumer<World> {
private int order;
@Setter
private int count;
}

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