276 Commits

Author SHA1 Message Date
eb218c33ca Fix missing key.reset() in BackendSync directory watch logic
All checks were successful
SteamWarCI Build successful
2025-07-20 00:08:51 +02:00
7b01f11b5b Introduce backend synchronization system for Velocity and WebsiteBackend
All checks were successful
SteamWarCI Build successful
2025-07-20 00:06:19 +02:00
fd57ba43e9 Mark createdAt as primary key in NodeData class
All checks were successful
SteamWarCI Build successful
2025-07-19 22:48:03 +02:00
03005adcd8 Merge pull request 'Add enhance ReplayCommand' (#115) from add-fight-id into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #115
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-07-19 22:06:36 +02:00
679d373a1e Fix colors final time, for 1.15 and earlier support
All checks were successful
SteamWarCI Build successful
2025-07-19 18:11:10 +02:00
828084a3d6 Update Guide color
All checks were successful
SteamWarCI Build successful
2025-07-19 17:58:53 +02:00
2b782585b1 Hotfix TeamCommand and WhoisCommand
All checks were successful
SteamWarCI Build successful
2025-07-19 17:54:39 +02:00
b43965be91 Revert "Update PREFIX_GUIDE color to §a in UserPerm"
All checks were successful
SteamWarCI Build successful
This reverts commit 30cdbe072e.
2025-07-19 17:45:39 +02:00
d82f306094 Add getById method in Fight class and enhance ReplayCommand handling with admin replay checks
All checks were successful
SteamWarCI Build successful
2025-07-19 17:12:44 +02:00
30cdbe072e Update PREFIX_GUIDE color to §a in UserPerm
All checks were successful
SteamWarCI Build successful
2025-07-19 17:07:18 +02:00
db7e1a5fc9 Add immersive portals channel to PluginMessage listener
All checks were successful
SteamWarCI Build successful
2025-07-19 17:01:30 +02:00
3e5055c246 Refine checkpoint handling in Subserver and remove unnecessary debug logs in CheckpointUtilsJ9
All checks were successful
SteamWarCI Build successful
2025-07-16 09:43:24 +02:00
44c06314c6 Update checkpoint restoration message handling in Subserver
All checks were successful
SteamWarCI Build successful
2025-07-16 09:39:38 +02:00
e06742d6d2 SpigotCore/SpigotCore_Main/src/de/steamwar/core/CheckpointUtilsJ9.java aktualisiert
All checks were successful
SteamWarCI Build successful
2025-07-16 09:34:38 +02:00
62e674ed42 SpigotCore/SpigotCore_Main/src/de/steamwar/core/CheckpointUtilsJ9.java aktualisiert
All checks were successful
SteamWarCI Build successful
2025-07-14 19:40:33 +02:00
0464442b83 VelocityCore/Persistent/src/de/steamwar/persistent/Subserver.java aktualisiert
All checks were successful
SteamWarCI Build successful
2025-07-14 19:38:46 +02:00
c682333771 Add Criu Debug
All checks were successful
SteamWarCI Build successful
2025-07-14 19:13:25 +02:00
58ab619144 Add Criu Debug
All checks were successful
SteamWarCI Build successful
2025-07-14 19:08:35 +02:00
00de852575 Add Criu Debug
All checks were successful
SteamWarCI Build successful
2025-07-14 19:07:48 +02:00
948cf5e8db Add Criu Debug
All checks were successful
SteamWarCI Build successful
2025-07-14 18:52:08 +02:00
7aba8da5a0 Add revision handling to setSchematic method in FightTeam
All checks were successful
SteamWarCI Build successful
2025-07-14 13:40:43 +02:00
5a77854752 Fix replaceColor usage and correct config flag handling
All checks were successful
SteamWarCI Build successful
2025-07-14 11:20:26 +02:00
cf1422f532 Fix NodeData query to correctly order by CreatedAt descending
All checks were successful
SteamWarCI Build successful
2025-07-14 09:46:06 +02:00
6260e65b33 Merge pull request 'Add Schematic Revisions' (#93) from schematic-revisions into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #93
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-07-14 09:13:16 +02:00
6db404c1e6 Merge pull request 'Add AuditLog' (#89) from AuditLog into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #89
Reviewed-by: Chaoscaot <max@chaoscaot.de>
2025-07-14 09:13:02 +02:00
b086fcaa32 Refactor validator method in download command
All checks were successful
SteamWarCI Build successful
2025-07-13 21:11:18 +02:00
f33b3521b8 Hotfix TNTPoint for 1.15 or earlier
All checks were successful
SteamWarCI Build successful
2025-07-13 21:00:42 +02:00
dc72ec1b93 Hotfix REntityServer for 1.15 or earlier
All checks were successful
SteamWarCI Build successful
2025-07-13 20:57:22 +02:00
0e9c9bd4dc Hotfix DiscordChannel
All checks were successful
SteamWarCI Build successful
2025-07-13 20:48:43 +02:00
291b6b1804 Merge pull request 'Add Winconditions.TIMED_DAMAGE_TECH_KO and Winconditions.RANDOM_ROTATE' (#111) from FightSystem/RandomRotationAndTimedDamageTechKO into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #111
Reviewed-by: D4rkr34lm <dark@steamwar.de>
2025-07-13 18:40:52 +02:00
104f0cf02d Fix final stuff
All checks were successful
SteamWarCI Build successful
2025-07-13 18:39:53 +02:00
f7662cdcba Fix build
All checks were successful
SteamWarCI Build successful
2025-07-13 18:15:24 +02:00
167b36b10c Update RandomRotate
Some checks failed
SteamWarCI Build failed
2025-07-13 18:10:53 +02:00
b9b541957b Fix older replays
All checks were successful
SteamWarCI Build successful
2025-07-13 17:54:28 +02:00
e9d107f0ed Fix older replays
All checks were successful
SteamWarCI Build successful
2025-07-13 17:54:06 +02:00
1e264a63a2 Add Winconditions.TIMED_DAMAGE_TECH_KO and Winconditions.RANDOM_ROTATE
All checks were successful
SteamWarCI Build successful
2025-07-13 16:48:35 +02:00
868ba4073b Add Winconditions.TIMED_DAMAGE_TECH_KO and Winconditions.RANDOM_ROTATE
All checks were successful
SteamWarCI Build successful
2025-07-13 16:46:11 +02:00
3410dd5a4b Merge pull request 'Improve perceived server start time' (#108) from VelocityCore/ImprovePerceivedServerStartTimeWithCRIU into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #108
Reviewed-by: Chaoscaot <max@chaoscaot.de>
2025-07-10 13:46:03 +02:00
b86a26a709 Fix Simulator.autoTrace
All checks were successful
SteamWarCI Build successful
2025-07-10 13:44:06 +02:00
71238a0167 Add Simulator.autoTestblock
All checks were successful
SteamWarCI Build successful
2025-07-10 13:40:21 +02:00
30ac947ebb Add Simulator.autoTestblock
All checks were successful
SteamWarCI Build successful
2025-07-10 13:39:03 +02:00
a7d64b5887 Improve TickManager21
All checks were successful
SteamWarCI Build successful
2025-07-10 13:21:17 +02:00
d7908c8255 Improve perceived server start time
All checks were successful
SteamWarCI Build successful
2025-07-10 13:02:24 +02:00
12f26b982e Rever CheckpointUtilsJ9
All checks were successful
SteamWarCI Build successful
2025-07-10 10:52:14 +02:00
2be4118399 Close server socket before world saving
All checks were successful
SteamWarCI Build successful
2025-07-10 10:23:28 +02:00
9d6981ee0c Trigger rebuild
All checks were successful
SteamWarCI Build successful
2025-07-10 10:09:39 +02:00
97a4d47aa7 Merge pull request 'Add support for TPS and tick rate management in 1.21+' (#105) from 1.21.1/tpslimit into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #105
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-07-08 22:17:22 +02:00
d657f9871d Update and integrate legacy system
All checks were successful
SteamWarCI Build successful
2025-07-08 22:16:52 +02:00
a572b84016 Add Items
All checks were successful
SteamWarCI Build successful
2025-07-08 21:11:27 +02:00
f1c6b4b453 Update UserPerm colors "final?"
All checks were successful
SteamWarCI Build successful
2025-07-08 19:58:49 +02:00
d0414c71f3 Fix v3Mode handling in WorldEditWrapper14
All checks were successful
SteamWarCI Build successful
2025-07-08 12:07:03 +02:00
3530aec5e2 Add more Flowers and add Leather horse Armour
All checks were successful
SteamWarCI Build successful
2025-07-08 10:45:40 +02:00
cccd090357 Add support for TPS and tick rate management in 1.21+
All checks were successful
SteamWarCI Build successful
2025-07-07 22:43:16 +02:00
3ae9a41b31 Hotfix: Entities on 1.21+
All checks were successful
SteamWarCI Build successful
2025-07-06 21:58:05 +02:00
b8b38cf777 Merge pull request 'Handle KickedFromServerEvent with redirect and empty component' (#103) from remove-kicked-message into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #103
2025-07-06 17:58:46 +02:00
c1eca74dd0 Handle KickedFromServerEvent with redirect and empty component
All checks were successful
SteamWarCI Build successful
2025-07-06 14:06:07 +02:00
8c23bf5bd4 Fix 1.21 DisplayEntities
All checks were successful
SteamWarCI Build successful
2025-07-06 11:58:54 +02:00
556c8f7db1 Fix MissileWars team colors and TNTLeague team colors
All checks were successful
SteamWarCI Build successful
2025-07-04 17:49:58 +02:00
7a03b327ef Fix tablist for real
All checks were successful
SteamWarCI Build successful
2025-07-03 18:00:17 +02:00
0091cba336 Fix Tablist in 1.21.5 or greater
All checks were successful
SteamWarCI Build successful
2025-07-03 16:59:24 +02:00
35d8bfb588 Update UserPerm
All checks were successful
SteamWarCI Build successful
Fix Tablist
2025-07-03 16:47:58 +02:00
78584fea34 Update UserPerm
All checks were successful
SteamWarCI Build successful
2025-07-03 16:38:46 +02:00
66511e514c Merge pull request 'Add a simple smaller Trace file' (#25) from BauSystem/SmallerTraces into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #25
Reviewed-by: D4rkr34lm <dark@steamwar.de>
2025-07-03 11:29:52 +02:00
6f64d03fee Update pr stuff
All checks were successful
SteamWarCI Build successful
2025-07-03 11:07:52 +02:00
c04e8d75eb Reorder Colors (again)
All checks were successful
SteamWarCI Build successful
2025-07-03 00:57:25 +02:00
5c7c982175 Merge branch 'main' into schematic-revisions
All checks were successful
SteamWarCI Build successful
2025-07-03 00:45:03 +02:00
d5ca1e14e1 Add prepared flag to schematics and refactor related logic
All checks were successful
SteamWarCI Build successful
2025-07-02 12:25:58 +02:00
60347bc481 Hotfix dependencies
All checks were successful
SteamWarCI Build successful
2025-07-02 11:53:24 +02:00
fbfdcf8fff Merge pull request 'VelocityCore/JDADependencyPlugin' (#91) from VelocityCore/JDADependencyPlugin into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #91
Reviewed-by: Chaoscaot <max@chaoscaot.de>
2025-07-02 11:46:07 +02:00
e56c41ca66 Improve dependency upload
All checks were successful
SteamWarCI Build successful
2025-07-02 11:36:06 +02:00
3b67048b9c Improve jar size
All checks were successful
SteamWarCI Build successful
2025-07-02 11:22:36 +02:00
6efbda669e Optimize and improve VelocityCore size
All checks were successful
SteamWarCI Build successful
Improve steamwar.devserver.gradle to not upload anything that is up to date!
2025-07-02 11:17:55 +02:00
4bd5d9eb0b Remove unused get and query
All checks were successful
SteamWarCI Build successful
2025-07-02 10:00:43 +02:00
60a70dfc40 Remove unused get
All checks were successful
SteamWarCI Build successful
2025-07-02 09:59:09 +02:00
95a97aed93 Update TraceRepository to save quite a bit smaller traces
All checks were successful
SteamWarCI Build successful
2025-07-02 09:16:48 +02:00
6fa54aba2f Merge pull request 'Update UserPerm' (#92) from UserPermColorUpdate into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #92
2025-07-02 09:16:04 +02:00
d04939fb2c Add a simple smaller Trace file, not finished!
All checks were successful
SteamWarCI Build successful
2025-07-02 08:12:09 +02:00
4c98ce4aff Add Schematic Revisions
All checks were successful
SteamWarCI Build successful
2025-07-01 21:39:08 +02:00
4ed6bc52d0 Update TheBreadBeards Easter particle
All checks were successful
SteamWarCI Build successful
2025-07-01 21:37:12 +02:00
bc00873314 Update UserPerm
All checks were successful
SteamWarCI Build successful
2025-07-01 21:28:59 +02:00
8677d59cce Fix some stuff
All checks were successful
SteamWarCI Build successful
2025-07-01 19:04:13 +02:00
6b16bbc785 Add DiscordDependency plugin for faster upload times
All checks were successful
SteamWarCI Build successful
2025-07-01 19:00:14 +02:00
617bae5a5c Add AuditLog
All checks were successful
SteamWarCI Build successful
2025-07-01 18:48:59 +02:00
9988774fb4 Fix Warp.WorldSpawn
All checks were successful
SteamWarCI Build successful
2025-06-30 17:27:23 +02:00
4fc707431f Fix WorldEditRenderer
All checks were successful
SteamWarCI Build successful
2025-06-30 17:10:24 +02:00
8ff0319fe6 Fix BauSystem.properties
All checks were successful
SteamWarCI Build successful
2025-06-30 16:53:28 +02:00
86537a00de Fix TraceRecorder
All checks were successful
SteamWarCI Build successful
2025-06-30 16:52:02 +02:00
e9f8a89758 Hotfix Tablist duplicate names after softreload
All checks were successful
SteamWarCI Build successful
2025-06-30 16:48:03 +02:00
f37fbfffdf Hotfix SmartPlaceListener
All checks were successful
SteamWarCI Build successful
2025-06-30 16:05:52 +02:00
9798c08cf3 Hotfix SmartPlaceListener
All checks were successful
SteamWarCI Build successful
2025-06-30 16:02:43 +02:00
dbd979a5fe Fix 1.21
All checks were successful
SteamWarCI Build successful
2025-06-30 15:58:31 +02:00
280202c43f Merge pull request 'Update to support Minecraft 1.21.6 version' (#52) from update/1.21.5 into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #52
2025-06-30 15:53:44 +02:00
23df187eb1 settings.gradle.kts aktualisiert
All checks were successful
SteamWarCI Build successful
2025-06-30 15:52:51 +02:00
39af920631 Remove TutorialSystem
All checks were successful
SteamWarCI Build successful
2025-06-30 15:29:19 +02:00
e4864e6eaf Add new changetype alias
All checks were successful
SteamWarCI Build successful
2025-06-29 20:11:36 +02:00
d2bb8e8e59 Fix Relations
All checks were successful
SteamWarCI Build successful
2025-06-29 19:53:42 +02:00
bd9451f2aa Fix Backend
All checks were successful
SteamWarCI Build successful
2025-06-29 11:22:41 +02:00
1bb15d9551 Fix RPlayer skin data
All checks were successful
SteamWarCI Build successful
2025-06-28 14:14:55 +02:00
d06faa5d18 Fix 'java.lang.reflect.InvocationTargetException' for RPlayer being initialised
All checks were successful
SteamWarCI Build successful
2025-06-28 13:32:50 +02:00
bc5e781810 Hotfix VersionAnnouncer
All checks were successful
SteamWarCI Build successful
2025-06-28 13:26:05 +02:00
14b756261e Merge pull request 'Add event grouping' (#57) from event-brackets into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #57
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-06-26 23:40:51 +02:00
1f1f99f8f3 Adjust advancing team logic in EventRelation to fix fromPlace handling
All checks were successful
SteamWarCI Build successful
2025-06-26 23:38:19 +02:00
d9aeb47a3a Merge pull request 'Update WorldEdit CUI to RBlockDisplay' (#34) from WorldEditCUI into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #34
Reviewed-by: D4rkr34lm <dark@steamwar.de>
2025-06-26 23:28:16 +02:00
afe30fd348 Merge pull request 'Add BauLockState.SUPERVISOR' (#80) from VelocityCore/BauLockSupervisor into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #80
Reviewed-by: D4rkr34lm <dark@steamwar.de>
2025-06-26 23:28:07 +02:00
9f323c8b38 Merge pull request 'Fix RPlayer not showing when same player is present' (#71) from FixRPlayerHandling into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #71
Reviewed-by: D4rkr34lm <dark@steamwar.de>
2025-06-26 23:28:00 +02:00
b6279fd7fa Remove useless line of code
All checks were successful
SteamWarCI Build successful
2025-06-26 22:06:38 +02:00
3f7cd48f27 Update sensible defaults for WorldEditRendererCUIEditor
All checks were successful
SteamWarCI Build successful
2025-06-26 22:01:56 +02:00
c682678827 Add ClientVersionPacket
All checks were successful
SteamWarCI Build successful
Update VersionAnnouncer
2025-06-26 21:57:44 +02:00
1fd8b3c4cb Add ClientVersionPacket
All checks were successful
SteamWarCI Build successful
2025-06-26 21:52:07 +02:00
c6ecab5aa8 Fix some stuff
All checks were successful
SteamWarCI Build successful
2025-06-26 21:05:11 +02:00
4383e541d8 Fix some stuff 2025-06-26 21:05:11 +02:00
cc4532ab90 Update CAALine to CLine
Update CAABox to CWireframe
2025-06-26 21:05:09 +02:00
3e448e7597 Remove default methods of WorldEditRendererWrapper 2025-06-26 21:04:46 +02:00
d975110470 Final fixes 2025-06-26 21:04:46 +02:00
f6852a5523 Add WorldEditRendererCUIEditor to Builder server 2025-06-26 21:04:45 +02:00
40437afb73 Final fixes 2025-06-26 21:04:45 +02:00
80a156754d Finalize WorldEditCUI 2025-06-26 21:04:45 +02:00
dfc7bbbe13 Fix WorldEditRendererWrapper9 2025-06-26 21:04:45 +02:00
dd5f46069f Delete WorldEditRenderer8 2025-06-26 21:04:45 +02:00
b10897c204 Update WorldEditRenderer 2025-06-26 21:04:43 +02:00
f6dc1e1059 Update WE version of 1.20 to FAWE 1.18 2025-06-26 21:04:35 +02:00
dccb435bce Update WorldEdit CUI to RBlockDisplay 2025-06-26 21:04:35 +02:00
1c8d6580d5 Fix Scoreboard
All checks were successful
SteamWarCI Build successful
2025-06-26 21:01:29 +02:00
187087f56b Fix LaufbauSettings
All checks were successful
SteamWarCI Build successful
2025-06-26 20:20:59 +02:00
77cf101889 Add BauLockState.SUPERVISOR
All checks were successful
SteamWarCI Build successful
2025-06-26 14:49:48 +02:00
0f68f671f5 Merge pull request 'Remove Shields from Check Arena' (#67) from remove-shield-from-check-arena into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #67
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-06-26 14:20:15 +02:00
75c4966e37 Fix SimulatorTNTGui for 1.19
All checks were successful
SteamWarCI Build successful
2025-06-26 13:52:01 +02:00
fcebb4ffd3 Add red team schematic paste in WGCommand
All checks were successful
SteamWarCI Build successful
2025-06-14 22:01:29 +02:00
9abbcc908d Remove unused fillRegion method from WorldEdit wrapper and related code
All checks were successful
SteamWarCI Build successful
2025-06-14 21:56:02 +02:00
4eb40581f2 Hotfix TexturePackSystem
All checks were successful
SteamWarCI Build successful
2025-06-12 22:07:24 +02:00
c3a4e7ed85 Improve network code
All checks were successful
SteamWarCI Build successful
2025-06-12 21:28:49 +02:00
5201a3edc0 Adjust TechareaCommand to refine wireframe bounds using offset subtraction
All checks were successful
SteamWarCI Build successful
2025-06-12 19:53:22 +02:00
c9821053ce Refactor TechareaCommand to support per-player REntityServer instances and add periodic tick updates
All checks were successful
SteamWarCI Build successful
2025-06-12 19:45:45 +02:00
eb8562b3a9 Merge pull request 'Add BlueInsetRegion management and implement TechareaCommand' (#73) from show-tech-area into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #73
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-06-12 19:29:32 +02:00
37acbf0033 Add BlueInsetRegion management and implement TechareaCommand
All checks were successful
SteamWarCI Build successful
2025-06-12 19:27:56 +02:00
9e294afa8f Merge pull request 'Add CEntity, CLine, CWireframe and optimize REntityServer' (#72) from WireFrames into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #72
Reviewed-by: Chaoscaot <max@chaoscaot.de>
2025-06-12 19:20:58 +02:00
3e9ffa52c3 Fix nit
All checks were successful
SteamWarCI Build successful
2025-06-12 19:19:38 +02:00
3296d9ebb3 Add CEntity, CLine, CWireframe and optimize REntityServer
All checks were successful
SteamWarCI Build successful
2025-06-12 18:53:35 +02:00
3d562cf743 Add skin cache to VelocityCore
All checks were successful
SteamWarCI Build successful
2025-06-11 17:05:47 +02:00
24f4ab7f37 Fix RPlayer not showing when same player is present
All checks were successful
SteamWarCI Build successful
Add DevLobby20 to LobbySystem build.gradle.kts
2025-06-11 15:35:27 +02:00
0ea92be2e1 Fix TexturePackSystem
All checks were successful
SteamWarCI Build successful
2025-06-11 11:25:56 +02:00
88d8016987 Fix TexturePackSystem
All checks were successful
SteamWarCI Build successful
2025-06-11 10:58:01 +02:00
909c1c52aa Hotfix Persistent
All checks were successful
SteamWarCI Build successful
2025-06-11 08:09:31 +02:00
26b126fdba Hotfix Persistent
All checks were successful
SteamWarCI Build successful
2025-06-11 08:05:28 +02:00
ecb2e736aa Mark declined schematics as seen and fix substring usage in CheckedSchematic creation
All checks were successful
SteamWarCI Build successful
2025-06-10 22:34:27 +02:00
38559e8a2b Fix parameter order in CheckedSchematic.create method
All checks were successful
SteamWarCI Build successful
2025-06-10 22:31:14 +02:00
1aba92e707 Add seen and nodeType fields to CheckedSchematic class
All checks were successful
SteamWarCI Build successful
2025-06-10 22:29:31 +02:00
e4df6f55fb Merge pull request 'GUIImprovements' (#64) from GUIImprovements into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #64
Reviewed-by: Chaoscaot <max@chaoscaot.de>
2025-06-10 21:08:23 +02:00
ff5113e112 Merge pull request 'Refactor schematic checks to handle unseen notifications' (#33) from add-offline-notify into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #33
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-06-10 20:57:33 +02:00
c425ca1171 Merge pull request 'Add declined question handling in CheckCommand' (#66) from add-saved-declined-questions-history into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #66
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-06-10 20:43:53 +02:00
c1293ffda0 Merge pull request 'Add 'queuerestart' command' (#68) from VelocityCore/QueueRestartCommand into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #68
Reviewed-by: Chaoscaot <max@chaoscaot.de>
2025-06-10 20:43:04 +02:00
02428868c2 Merge pull request 'Add player count to ListCommand' (#69) from VelocityCore/CountInListCommand into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #69
Reviewed-by: Chaoscaot <max@chaoscaot.de>
2025-06-10 20:42:37 +02:00
adaae7f943 Update Persistent.queueRestart to toggle
All checks were successful
SteamWarCI Build successful
2025-06-10 20:40:04 +02:00
c12d2c2ddf Add player count to ListCommand
All checks were successful
SteamWarCI Build successful
2025-06-10 20:39:11 +02:00
428c63429c Add 'queuerestart' command
All checks were successful
SteamWarCI Build successful
2025-06-10 17:26:20 +02:00
edec84c60a Merge pull request 'Use Transfer Packet for Event Velocity' (#40) from transfer-packet into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #40
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-06-10 17:18:58 +02:00
4f885a7269 Merge branch 'main' into transfer-packet
All checks were successful
SteamWarCI Build successful
2025-06-10 17:18:08 +02:00
dfd9febd8c Remove Shields from Check Arena
All checks were successful
SteamWarCI Build successful
2025-06-08 22:34:05 +02:00
1a570dca17 BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/SteamWarLuaPlugin.java aktualisiert
All checks were successful
SteamWarCI Build successful
2025-06-08 18:18:44 +02:00
761977c90a BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/SteamWarLuaPlugin.java aktualisiert
All checks were successful
SteamWarCI Build successful
2025-06-08 16:42:45 +02:00
5cc417c43c Add declined question handling in CheckCommand
All checks were successful
SteamWarCI Build successful
- Implemented tracking of declined questions during checks.
- Updated messaging logic to display declined questions to users.
- Added new translations for decline-related messages.
2025-06-05 23:41:01 +02:00
1014df5f31 PR Stuff
All checks were successful
SteamWarCI Build successful
2025-06-03 23:39:16 +02:00
c920664920 Merge branch 'main' into add-offline-notify 2025-06-03 23:35:35 +02:00
3069ffc991 Merge branch 'main' into update/1.21.5
All checks were successful
SteamWarCI Build successful
2025-06-03 23:09:05 +02:00
c3db2b7f86 VelocityCore/src/de/steamwar/velocitycore/listeners/EventModeListener.java aktualisiert
All checks were successful
SteamWarCI Build successful
2025-06-01 14:36:49 +02:00
c30f24ab8f Hotfix Protocol Version for real now
All checks were successful
SteamWarCI Build successful
2025-05-31 21:32:19 +02:00
bcb0ad4bef Merge branch 'main' into update/1.21.5
All checks were successful
SteamWarCI Build successful
# Conflicts:
#	VelocityCore/src/de/steamwar/velocitycore/ServerVersion.java
2025-05-31 20:20:07 +02:00
f2a46e54ea Revert "Add WeatherCommand"
All checks were successful
SteamWarCI Build successful
This reverts commit 30fa3fd66e.
2025-05-31 19:40:08 +02:00
daede98a0f Hotfix TeamCommand
All checks were successful
SteamWarCI Build successful
2025-05-31 17:45:24 +02:00
d37a14f280 Move some constants around
All checks were successful
SteamWarCI Build successful
2025-05-31 10:04:21 +02:00
083c5c07c2 Update CMDs for all current CustomModelData usages
All checks were successful
SteamWarCI Build successful
2025-05-31 09:39:03 +02:00
7b059cde0e Add customModelData to Velocity SWItem
All checks were successful
SteamWarCI Build successful
2025-05-31 08:51:56 +02:00
30fa3fd66e Add WeatherCommand
All checks were successful
SteamWarCI Build successful
2025-05-30 21:37:07 +02:00
37f6723542 Add CommonCore.DATA and CMDs
All checks were successful
SteamWarCI Build successful
2025-05-29 17:12:32 +02:00
7a9740c4c4 Fix EventFight activeFights query and add null check for spectatePort in CookieEvents
All checks were successful
SteamWarCI Build successful
2025-05-29 15:05:01 +02:00
54eec6d57c Merge pull request 'SchematicSystem: Add music disks to auto checker' (#59) from SchematicSystem/Allow-music-disks into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #59
Reviewed-by: Chaoscaot <max@chaoscaot.de>
2025-05-29 14:37:49 +02:00
2f93f336c9 Add image upload functionality and enhance page metadata creation.
All checks were successful
SteamWarCI Build successful
2025-05-29 14:30:06 +02:00
62f9d37230 Merge pull request 'Add tech hider bug handling for arena subservers in BugCommand' (#62) from bug-auto-techhider-bug into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #62
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-05-29 14:27:56 +02:00
b479b6667b Merge pull request 'Enable a Dirt Block (Schem owner -1 and Name like GameMode) to be selected for any ServerTeam member' (#51) from FightSystem/EnableDirtBlockForServerTeam into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #51
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-05-29 12:06:41 +02:00
9bc01a4e3b Revert FightTeam
All checks were successful
SteamWarCI Build successful
2025-05-29 12:00:12 +02:00
b14cf445df Fix PR stuff
All checks were successful
SteamWarCI Build successful
2025-05-29 11:32:50 +02:00
527bc39d38 Add some more CustomModelData ids to items
All checks were successful
SteamWarCI Build successful
2025-05-29 08:44:58 +02:00
8defbaa18b Add tech hider bug handling for arena subservers in BugCommand
All checks were successful
SteamWarCI Build successful
2025-05-29 00:03:25 +02:00
a5bb62590c Refactor page routing and point calculation logic
All checks were successful
SteamWarCI Build successful
Streamlined the `page` routing structure by optimizing branch and file handling, introducing a reusable `filesInDirectory` method, and cleaning up redundancies. Enhanced `EventGroup` point calculation with incremental updates, new helper methods (`getTeams`, `getTeamsId`), and better handling of unfinished fights.
2025-05-28 23:57:29 +02:00
c35d4741a0 Add TexturePackSystem
All checks were successful
SteamWarCI Build successful
2025-05-28 14:19:21 +02:00
a2a101c4e3 Merge pull request 'Add NoGravity' (#61) from FightSystem/EnableNoGravityFights into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #61
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-05-27 19:58:55 +02:00
277e1f9f9b Add NoGravity
All checks were successful
SteamWarCI Build successful
2025-05-27 18:15:03 +02:00
380506542f Remove some more duplicates
All checks were successful
SteamWarCI Build successful
2025-05-23 09:13:23 +02:00
d410484e4c Update JDA to newest version
All checks were successful
SteamWarCI Build successful
2025-05-22 19:47:14 +02:00
8768fd7d81 Refactor event handling and group assignment logic
All checks were successful
SteamWarCI Build successful
Replaced `fight.event` with `event.eventID` for consistency and improved event handling. Adjusted `setGroup` to accept `Integer` instead of `EventGroup` to simplify group assignment logic. Removed unused `event` field in `CreateEventFight` and streamlined related processing.
2025-05-22 19:42:49 +02:00
374e314faa Add new WATUT Channel
All checks were successful
SteamWarCI Build successful
2025-05-22 18:19:31 +02:00
45a8aab321 Revert "Add "/event vote" command for SteamWarArcade Event"
All checks were successful
SteamWarCI Build successful
This reverts commit 7f215b921e.
2025-05-18 19:44:29 +02:00
0d15bbc266 Revert "Add "/event vote" command for SteamWarArcade Event"
This reverts commit a5b61fb0d6.
2025-05-18 19:44:28 +02:00
7fa97ce36c Revert "Fix TowerRun event"
This reverts commit 8cd088050d.
2025-05-18 19:44:28 +02:00
8cd088050d Fix TowerRun event
All checks were successful
SteamWarCI Build successful
2025-05-18 16:32:01 +02:00
b0bbc09113 Fix TowerRun event
All checks were successful
SteamWarCI Build successful
2025-05-18 16:28:26 +02:00
a5b61fb0d6 Add "/event vote" command for SteamWarArcade Event
All checks were successful
SteamWarCI Build successful
To be removed after event
2025-05-18 16:22:50 +02:00
297e6c9b59 Fix OOM?
All checks were successful
SteamWarCI Build successful
2025-05-18 15:58:31 +02:00
400c78447a Fix IngameListener
All checks were successful
SteamWarCI Build successful
2025-05-18 15:41:43 +02:00
778d0282d3 Fix IngameListener
All checks were successful
SteamWarCI Build successful
2025-05-18 15:37:43 +02:00
2a314e7035 Add sout
All checks were successful
SteamWarCI Build successful
2025-05-18 15:31:48 +02:00
6ed639fbb3 Add sout
All checks were successful
SteamWarCI Build successful
2025-05-18 13:46:39 +02:00
3a79f19f37 Merge remote-tracking branch 'origin/main'
All checks were successful
SteamWarCI Build successful
2025-05-18 13:34:45 +02:00
f7e81f8204 Hotfix OOM in IngameListener 2025-05-18 13:34:42 +02:00
7f215b921e Add "/event vote" command for SteamWarArcade Event
All checks were successful
SteamWarCI Build successful
To be removed after event
2025-05-18 13:32:09 +02:00
b0be06136d Add 'ergebnis' field to EventFights data model and update logic
All checks were successful
SteamWarCI Build successful
Introduced a new 'ergebnis' field to the EventFights data model to handle fight results. Updated the logic to support processing and updating this field when provided. This ensures better tracking and management of event fight outcomes.
2025-05-18 13:31:14 +02:00
8132e4fca0 Remove code duplication
All checks were successful
SteamWarCI Build successful
2025-05-18 10:34:41 +02:00
bf5eef2ebd Fix copyright nit
Remove SchematicCommand19
2025-05-18 10:28:32 +02:00
69251f42a6 Add music disks to autochecker
All checks were successful
SteamWarCI Build successful
2025-05-17 23:40:48 +02:00
6bbe94150d Merge pull request 'Prevent usage of Flashback channels for restricted players' (#58) from flashback into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #58
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-05-17 11:57:40 +02:00
717cfa8baf Prevent usage of Flashback channels for restricted players
All checks were successful
SteamWarCI Build successful
Added new channel handlers to block Flashback mod channels for users without appropriate permissions. Ensures restricted players using these channels are disconnected with a specific warning message. This enhances control over mod usage and maintains server integrity.
2025-05-16 18:00:23 +02:00
260656ad35 Fix for events
All checks were successful
SteamWarCI Build successful
2025-05-14 19:28:27 +02:00
e893d7934a Fix TowerRun for events
All checks were successful
SteamWarCI Build successful
2025-05-14 19:11:05 +02:00
d0665932f4 Fix TowerRunGame.reset
All checks were successful
SteamWarCI Build successful
2025-05-11 20:19:23 +02:00
d6fba9b0af Fix many simple things
All checks were successful
SteamWarCI Build successful
2025-05-11 19:02:46 +02:00
b229b0d0ae Fix many simple things
All checks were successful
SteamWarCI Build successful
2025-05-11 19:02:02 +02:00
ac00245b04 Fix lag of IngameListener
All checks were successful
SteamWarCI Build successful
2025-05-11 18:50:21 +02:00
6eb01a61b1 Update every Back item to use the new texture
All checks were successful
SteamWarCI Build successful
2025-05-11 18:28:06 +02:00
fa13872f22 Add SWListInv 2025-05-11 18:28:06 +02:00
79edc1c591 Add Simulator to improvements 2025-05-11 18:28:06 +02:00
6e9db276ef Add event referees management and teams endpoint.
Introduced a new route for managing event referees with get, put, and delete operations. Also added an endpoint to fetch all teams, and integrated the referees routing into event configuration.
2025-05-10 22:22:43 +02:00
e3179c69aa Refactor event group management and routing system
All checks were successful
SteamWarCI Build successful
2025-05-08 17:32:12 +02:00
c633694222 Refactor event handling and tie-break logic implementation
All checks were successful
SteamWarCI Build successful
Introduced new methods and structures in EventGroup, EventRelation, and EventFight to streamline point calculations, tie-break detection, and dependency resolution. Improved modularity by adding methods like getLastFight, needsTieBreak, and getDependents while optimizing the event result setting process. This refactor enhances clarity, reduces redundancy, and supports better maintainability of event-related logic.
2025-05-07 16:16:36 +02:00
a4eea298d2 Hotfix PrepareSchem not copying allowReplay and replaceColor while creating a prepared schem
All checks were successful
SteamWarCI Build successful
2025-05-07 14:37:00 +02:00
f387805b40 Add event grouping
All checks were successful
SteamWarCI Build successful
2025-05-07 13:51:13 +02:00
2c644eef26 Merge pull request 'Maybe™️ fix Techhider' (#56) from techhider-fixes into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #56
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-05-02 14:26:18 +02:00
7f0fa09c56 Update OpenJ9 dump configuration to enable heap hprof.
All checks were successful
SteamWarCI Build successful
2025-05-02 14:14:27 +02:00
6940c32b02 Adjust OpenJ9 JVM arguments to include hprof option in dumps.
All checks were successful
SteamWarCI Build successful
2025-05-02 14:13:33 +02:00
5015aca159 Maybe™️ fix Techhider
All checks were successful
SteamWarCI Build successful
2025-05-02 10:13:47 +02:00
32c85b9bd5 Merge pull request 'Add error handling and logging to Techhider and TinyProtocol' (#55) from techhider-debug-nachrichten into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #55
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-04-29 18:13:00 +02:00
15bb92fbba Improve error handling and logging in Techhider and TinyProtocol
All checks were successful
SteamWarCI Build successful
Refined logging messages for clarity by replacing "Techhider" with "PacketInterceptor" where appropriate. Adjusted error handling in `TechhiderbugCommand` by removing redundant `flush` calls and properly logging exceptions during bug report generation. These changes aim to enhance maintainability and debugging.
2025-04-29 18:04:58 +02:00
d6a5caf95d Add error handling and logging to Techhider and TinyProtocol
All checks were successful
SteamWarCI Build successful
2025-04-29 17:59:22 +02:00
1912ad52e4 Add protocol version check to handle potential packet issue
All checks were successful
SteamWarCI Build successful
2025-04-28 23:25:36 +02:00
66d18e316b Hotfix: Schematic Download geht für nicht Supervisor Player
All checks were successful
SteamWarCI Build successful
2025-04-28 16:47:43 +02:00
f30c3b2f34 Update anvilgui library to version 1.10.5-SNAPSHOT
All checks were successful
SteamWarCI Build successful
2025-04-27 02:58:05 +02:00
7e863e8062 Refactor entity field access with version-aware adjustments
All checks were successful
SteamWarCI Build successful
2025-04-27 02:53:59 +02:00
5cdad8c2f4 Add Dev 1.21.5
All checks were successful
SteamWarCI Build successful
2025-04-27 02:28:39 +02:00
87a7120a6a Merge remote-tracking branch 'origin/main'
All checks were successful
SteamWarCI Build successful
2025-04-26 23:57:03 +02:00
b5a9564808 Allow next next location in JumpAndRun 2025-04-26 23:56:59 +02:00
f93362a023 LobbySystem/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java aktualisiert
All checks were successful
SteamWarCI Build successful
2025-04-26 23:48:33 +02:00
b1bef4ced5 Add ErrorLogging for Bugged Schematics
All checks were successful
SteamWarCI Build successful
2025-04-26 22:27:53 +02:00
e7e1e2d968 Merge remote-tracking branch 'origin/main'
All checks were successful
SteamWarCI Build successful
2025-04-26 22:17:50 +02:00
713275ba11 Add ErrorLogging for Bugged Schematics 2025-04-26 22:17:43 +02:00
e72ae3cf94 LobbySystem/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java aktualisiert
All checks were successful
SteamWarCI Build successful
2025-04-26 22:13:31 +02:00
d36753dec1 Merge pull request 'Fixed meterstock' (#54) from BauSystem/fix-meterstock into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #54
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-04-26 13:37:33 +02:00
84cc292df4 Fixed meterstock
All checks were successful
SteamWarCI Build successful
2025-04-26 13:08:13 +02:00
f89c4e88f9 Fix HotbarKit
All checks were successful
SteamWarCI Build successful
Fix steamwar.devserver.gradle
Add WarGear20 to build.gradle.kts
2025-04-25 18:07:14 +02:00
aeff16b7dd Update to support Minecraft 1.21.5 version
All checks were successful
SteamWarCI Build successful
2025-04-24 14:07:35 +02:00
bb97d80c18 Refactor to align with Minecraft 1.21.5 API changes
All checks were successful
SteamWarCI Build successful
2025-04-24 13:10:48 +02:00
7d45680fcb Enable a Dirt Block (Schem owner -1 and Name like GameMode) to be selected for any ServerTeam member
All checks were successful
SteamWarCI Build successful
2025-04-23 21:52:27 +02:00
a38f9222dd Merge remote-tracking branch 'origin/main'
All checks were successful
SteamWarCI Build successful
2025-04-23 20:55:30 +02:00
5ee9d3e167 Hotfix HotbarKit 2025-04-23 20:55:26 +02:00
98321de46c Merge pull request 'Replace Jukeboxes with Lodestone in panzer sklave' (#50) from BauSystem/fix-panzersklave into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #50
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-04-23 19:14:53 +02:00
239ba3f213 made more readable
All checks were successful
SteamWarCI Build successful
2025-04-23 19:14:44 +02:00
3d7dedd3ad Fix jukeboxes in panzer sklave
All checks were successful
SteamWarCI Build successful
2025-04-23 19:13:07 +02:00
ef66b8c1f1 Fix HotbarKit.onInventoryClick not resetting the cursor item
All checks were successful
SteamWarCI Build successful
2025-04-23 18:28:58 +02:00
1201b16ee4 Merge pull request 'Improve Server starter 'steamwar.devserver.gradle'' (#41) from ImprovedServerStarter into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #41
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-04-23 18:16:39 +02:00
4ddd88f540 Merge pull request 'Enable clicking 'Ready' in inventory' (#42) from FightSystem/HotbarKitInInv into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #42
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-04-23 18:12:40 +02:00
ca35ab9234 Remove code Duplication HotbarKit
All checks were successful
SteamWarCI Build successful
2025-04-20 20:41:47 +02:00
3df84a7dad Update from PR
All checks were successful
SteamWarCI Build successful
2025-04-20 20:40:19 +02:00
83c20729fa Fix RAM usage on multiple usages
All checks were successful
SteamWarCI Build successful
2025-04-20 08:27:56 +02:00
925901e40e Fix steamwar.devserver.gradle 2025-04-20 08:27:56 +02:00
059dd314d1 Fix building of DevServer 2025-04-20 08:27:56 +02:00
86ff619548 Add FightServer to configure those 2025-04-20 08:27:56 +02:00
76e00b07db Add plugins option to DevServer Task 2025-04-20 08:27:56 +02:00
4edfd32ff5 Add a check if the template exists in the user.home directory 2025-04-20 08:27:56 +02:00
5669725f9b Fix dev.py path 2025-04-20 08:27:56 +02:00
335649fa87 Fix steamwar.devserver.gradle 2025-04-20 08:27:56 +02:00
9001e83321 Add steamwar.properties 'worldName' and 'host'
Remove some options
2025-04-20 08:27:56 +02:00
32703c6659 Enable Velocity, prio Setup needed for that 2025-04-20 08:27:56 +02:00
e393aad25f Add all parameters that dev.py has 2025-04-20 08:27:56 +02:00
50543ddd4e Improve Server starter 'steamwar.devserver.gradle'
See build.gradle.kts of BauSystem
2025-04-20 08:27:56 +02:00
ae7d394ae2 Enable clicking 'Ready' in inventory
All checks were successful
SteamWarCI Build successful
2025-04-17 15:45:25 +02:00
40eeb4993f Add support for cookie-based event spectating
All checks were successful
SteamWarCI Build successful
ACHTUNG: Janky!
2025-04-13 20:06:38 +02:00
4c23915987 Use Transfer Packet for Event Velocity
Some checks failed
SteamWarCI Build failed
2025-04-13 18:09:24 +02:00
71522973a7 Refactor schematic checks to handle unseen notifications
All checks were successful
SteamWarCI Build successful
2025-03-24 16:50:39 +01:00
237 changed files with 5949 additions and 1796 deletions

4
.gitignore vendored
View File

@ -17,3 +17,7 @@ bin/
# Other # Other
lib lib
/WebsiteBackend/data
/WebsiteBackend/logs
/WebsiteBackend/skins
/WebsiteBackend/config.json

View File

@ -0,0 +1,140 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 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 de.steamwar.bausystem.region.GlobalRegion;
import de.steamwar.bausystem.utils.bossbar.BossBarService;
import de.steamwar.bausystem.utils.tps.TPSFreezeUtils;
import de.steamwar.bausystem.utils.tps.TPSLimitUtils;
import de.steamwar.core.TPSWarpUtils;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class TickManager15 implements TickManager, Listener {
private static float currentTPSLimit = 20;
private boolean currentlyStepping = false;
private float currentLimit;
private int stepsTotal;
private int stepsLeft;
@Override
public boolean canFreeze() {
return TPSFreezeUtils.isCanFreeze();
}
@Override
public void setTickRate(float tickRate) {
if (currentlyStepping) {
currentlyStepping = false;
Bukkit.getOnlinePlayers().forEach(player -> {
BossBarService.instance.remove(player, GlobalRegion.getInstance(), "TickStep");
});
}
TPSWarpUtils.warp(tickRate);
if (currentTPSLimit == 0 && tickRate != 0) {
TPSFreezeUtils.unfreeze();
}
currentTPSLimit = tickRate;
if (tickRate == 0) {
TPSLimitUtils.unlimit();
TPSFreezeUtils.freeze();
} else if (tickRate < 20.0) {
TPSLimitUtils.limit(tickRate);
} else if (tickRate >= 20) {
TPSLimitUtils.unlimit();
}
}
@Override
public boolean isFrozen() {
return TPSFreezeUtils.frozen();
}
@Override
public void setFreeze(boolean freeze) {
if (freeze) {
setTickRate(0);
}
}
@Override
public void stepTicks(int ticks) {
currentLimit = 0;
setTickRate(20);
stepsLeft = ticks;
stepsTotal = ticks;
currentlyStepping = true;
}
@Override
public void sprintTicks(int ticks) {
currentLimit = currentTPSLimit;
setTickRate(4000);
stepsLeft = ticks;
stepsTotal = ticks;
currentlyStepping = true;
}
@Override
public boolean isSprinting() {
return currentlyStepping && currentTPSLimit > 20;
}
@Override
public boolean isStepping() {
return currentlyStepping && currentTPSLimit <= 20;
}
@Override
public float getTickRate() {
return currentTPSLimit;
}
@Override
public void setBlockTpsPacket(boolean block) {
}
@Override
public long getTotalTicks() {
return stepsTotal;
}
@Override
public long getDoneTicks() {
return stepsTotal - stepsLeft;
}
@Override
public long getRemainingTicks() {
return stepsLeft;
}
@EventHandler
public void onTickEnd(TickEndEvent event) {
if (!currentlyStepping) return;
stepsLeft--;
if (stepsLeft <= 0) {
setTickRate(currentLimit);
}
}
}

View File

@ -1,7 +1,7 @@
/* /*
* This file is a part of the SteamWar software. * This file is a part of the SteamWar software.
* *
* Copyright (C) 2023 SteamWar.de-Serverteam * Copyright (C) 2020 SteamWar.de-Serverteam
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Affero General Public License as published by
@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.steamwar.bausystem.features.tpslimit; package de.steamwar.bausystem.utils.tps;
import de.steamwar.Reflection; import de.steamwar.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;

View File

@ -1,7 +1,7 @@
/* /*
* This file is a part of the SteamWar software. * This file is a part of the SteamWar software.
* *
* Copyright (C) 2023 SteamWar.de-Serverteam * Copyright (C) 2020 SteamWar.de-Serverteam
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Affero General Public License as published by
@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.steamwar.bausystem.features.tpslimit; package de.steamwar.bausystem.utils.tps;
import de.steamwar.Reflection; import de.steamwar.Reflection;
import lombok.Getter; import lombok.Getter;

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.steamwar.bausystem.features.tpslimit; package de.steamwar.bausystem.utils.tps;
import de.steamwar.Reflection; import de.steamwar.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;

View File

@ -22,7 +22,6 @@ package de.steamwar.bausystem.utils;
import com.destroystokyo.paper.event.server.ServerTickEndEvent; import com.destroystokyo.paper.event.server.ServerTickEndEvent;
import com.destroystokyo.paper.event.server.ServerTickStartEvent; import com.destroystokyo.paper.event.server.ServerTickStartEvent;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.tpslimit.TPSFreezeUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -37,7 +36,7 @@ public class TickListener19 implements TickListener, Listener {
@EventHandler @EventHandler
public void onServerTickStart(ServerTickStartEvent event) { public void onServerTickStart(ServerTickStartEvent event) {
if (TPSFreezeUtils.isFrozen()) return; if (TickManager.impl.isFrozen()) return;
Bukkit.getPluginManager().callEvent(new TickStartEvent()); Bukkit.getPluginManager().callEvent(new TickStartEvent());
tickStartRan = true; tickStartRan = true;
} }

View File

@ -21,41 +21,39 @@ package de.steamwar.bausystem.utils;
import de.steamwar.Reflection; import de.steamwar.Reflection;
import de.steamwar.bausystem.features.util.NoClipCommand; import de.steamwar.bausystem.features.util.NoClipCommand;
import net.minecraft.core.component.DataComponents; import io.papermc.paper.datacomponent.DataComponentTypes;
import net.minecraft.nbt.NBTBase; import io.papermc.paper.datacomponent.item.ItemContainerContents;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
import net.minecraft.nbt.NBTTagList; import net.minecraft.network.protocol.game.ClientboundExplodePacket;
import net.minecraft.network.protocol.game.PacketPlayInSetCreativeSlot; import net.minecraft.network.protocol.game.ClientboundGameEventPacket;
import net.minecraft.network.protocol.game.PacketPlayOutExplosion; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.network.protocol.game.PacketPlayOutGameStateChange; import net.minecraft.server.level.ServerPlayerGameMode;
import net.minecraft.server.level.EntityPlayer; import net.minecraft.world.entity.player.Abilities;
import net.minecraft.server.level.PlayerInteractManager; import net.minecraft.world.level.GameType;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.entity.player.PlayerAbilities;
import net.minecraft.world.item.component.CustomData;
import net.minecraft.world.level.EnumGamemode;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_21_R2.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerGameModeChangeEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.List;
import java.util.Optional; import java.util.Optional;
public class NMSWrapper21 implements NMSWrapper { public class NMSWrapper21 implements NMSWrapper {
private static final Reflection.Field<PlayerInteractManager> playerInteractManager = Reflection.getField(EntityPlayer.class, null, PlayerInteractManager.class); private static final Reflection.Field<ServerPlayerGameMode> playerInteractManager = Reflection.getField(ServerPlayer.class, null, ServerPlayerGameMode.class);
@Override @Override
public void setInternalGameMode(Player player, GameMode gameMode) { public void setInternalGameMode(Player player, GameMode gameMode) {
playerInteractManager.get(((CraftPlayer) player).getHandle()).a(EnumGamemode.a(gameMode.getValue())); playerInteractManager.get(((CraftPlayer) player).getHandle()).changeGameModeForPlayer(GameType.byId(gameMode.getValue()), PlayerGameModeChangeEvent.Cause.UNKNOWN, null);
} }
@Override @Override
public void setSlotToItemStack(Player player, Object o) { public void setSlotToItemStack(Player player, Object o) {
PacketPlayInSetCreativeSlot packetPlayInSetCreativeSlot = (PacketPlayInSetCreativeSlot) o; ClientboundContainerSetSlotPacket packetPlayInSetCreativeSlot = (ClientboundContainerSetSlotPacket) o;
int index = packetPlayInSetCreativeSlot.b(); int index = packetPlayInSetCreativeSlot.getSlot();
if (index >= 36 && index <= 44) { if (index >= 36 && index <= 44) {
index -= 36; index -= 36;
} else if (index > 44) { } else if (index > 44) {
@ -63,25 +61,23 @@ public class NMSWrapper21 implements NMSWrapper {
} else if (index <= 8) { } else if (index <= 8) {
index = index - 8 + 36; index = index - 8 + 36;
} }
player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.e())); player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.getItem()));
if (index < 9) player.getInventory().setHeldItemSlot(index); if (index < 9) player.getInventory().setHeldItemSlot(index);
player.updateInventory(); player.updateInventory();
} }
private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12); private static final Reflection.Field<ClientboundGameEventPacket.Type> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, ClientboundGameEventPacket.Type.class, 12);
@Override @Override
public void setGameStateChangeReason(Object packet) { public void setGameStateChangeReason(Object packet) {
gameStateChangeReason.set(packet, PacketPlayOutGameStateChange.d); gameStateChangeReason.set(packet, ClientboundGameEventPacket.CHANGE_GAME_MODE);
} }
private static final Reflection.Field<PlayerAbilities> playerAbilities = Reflection.getField(EntityHuman.class, null, PlayerAbilities.class);
@Override @Override
public void setPlayerBuildAbilities(Player player) { public void setPlayerBuildAbilities(Player player) {
PlayerAbilities abilities = playerAbilities.get(((CraftPlayer) player).getHandle()); Abilities abilities = (((CraftPlayer) player).getHandle()).getAbilities();
abilities.d = true; abilities.mayBuild = true;
abilities.e = true; abilities.mayfly = true;
} }
@Override @Override
@ -93,49 +89,45 @@ public class NMSWrapper21 implements NMSWrapper {
@Override @Override
public boolean checkItemStack(ItemStack item) { public boolean checkItemStack(ItemStack item) {
net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); ItemContainerContents data = item.getData(DataComponentTypes.CONTAINER);
NBTTagCompound tag = nmsItem.a(DataComponents.b, CustomData.a).c(); if (data == null) {
if (tag.e("BlockEntityTag")) {
NBTTagCompound blockTag = tag.p("BlockEntityTag");
if (blockTag.e("Items")) {
return drillDown(blockTag.c("Items", 10), 0, 0) > threshold;
}
}
return false; return false;
} }
private int drillDown(NBTTagList items, int layer, int start) { return drillDown(data.contents(), 0, 0) > threshold;
}
private int drillDown(List<ItemStack> items, int layer, int start) {
if (layer > 2) return start + threshold; if (layer > 2) return start + threshold;
int invalid = start; int invalid = start;
for (NBTBase nbtBase : items) { for (int i = start; i < items.size(); i++) {
if (!(nbtBase instanceof NBTTagCompound slot)) ItemStack item = items.get(i);
if (item.isEmpty()) continue;
invalid += item.getAmount();
ItemContainerContents data = item.getData(DataComponentTypes.CONTAINER);
if (data == null) {
continue; continue;
if (slot.e("tag")) {
invalid += slot.f("Count");
NBTTagCompound iTag = slot.p("tag");
if (iTag.e("BlockEntityTag")) {
NBTTagCompound blockTag = iTag.p("BlockEntityTag");
if (blockTag.e("Items")) {
invalid = drillDown(blockTag.c("Items", 10), layer + 1, invalid);
} }
List<ItemStack> subItems = data.contents();
if (subItems.size() > 1) {
invalid = drillDown(subItems, layer + 1, invalid);
} }
} }
if (invalid > threshold)
break;
}
return invalid; return invalid;
} }
@Override @Override
public Object resetExplosionKnockback(Object packet) { public Object resetExplosionKnockback(Object packet) {
PacketPlayOutExplosion explosion = (PacketPlayOutExplosion) packet; ClientboundExplodePacket explosion = (ClientboundExplodePacket) packet;
return new PacketPlayOutExplosion( return new ClientboundExplodePacket(
explosion.b(), explosion.center(),
Optional.empty(), Optional.empty(),
explosion.f(), explosion.explosionParticle(),
explosion.g() explosion.explosionSound()
); );
} }
} }

View File

@ -0,0 +1,150 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.Reflection;
import de.steamwar.bausystem.BauSystem;
import net.minecraft.network.protocol.game.ClientboundTickingStatePacket;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ServerTickRateManager;
import net.minecraft.world.TickRateManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class TickManager21 implements TickManager {
private static final ServerTickRateManager manager = MinecraftServer.getServer().tickRateManager();
private static final Reflection.Field<Integer> frozenTicksToRun = Reflection.getField(TickRateManager.class, int.class, 0);
private static final Reflection.Field<Long> remainingSprintTicks = Reflection.getField(ServerTickRateManager.class, long.class, 0);
private boolean blockTpsPacket = true;
private int totalSteps;
public TickManager21() {
TinyProtocol.instance.addFilter(ClientboundTickingStatePacket.class, this::blockPacket);
}
private Object blockPacket(Player player, Object packet) {
if (blockTpsPacket) {
return new ClientboundTickingStatePacket(20, manager.isFrozen());
} else {
return packet;
}
}
@Override
public boolean canFreeze() {
return true;
}
@Override
public void setBlockTpsPacket(boolean block) {
blockTpsPacket = block;
if (blockTpsPacket) {
ClientboundTickingStatePacket packet = new ClientboundTickingStatePacket(20, manager.isFrozen());
Bukkit.getOnlinePlayers().forEach(player -> TinyProtocol.instance.sendPacket(player, packet));
} else {
ClientboundTickingStatePacket packet = new ClientboundTickingStatePacket(manager.tickrate(), manager.isFrozen());
Bukkit.getOnlinePlayers().forEach(player -> TinyProtocol.instance.sendPacket(player, packet));
}
}
@Override
public void setTickRate(float tickRate) {
if (isFrozen()) {
setFreeze(false);
}
manager.setTickRate(tickRate);
}
@Override
public boolean isFrozen() {
return manager.isFrozen();
}
@Override
public void setFreeze(boolean freeze) {
manager.setFrozen(freeze);
}
@Override
public void stepTicks(int ticks) {
if (manager.isSprinting()) {
manager.stopSprinting();
} else if (manager.isSteppingForward()) {
manager.stopStepping();
}
this.totalSteps = ticks;
manager.setFrozen(true);
manager.stepGameIfPaused(ticks);
manager.setFrozen(false);
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), (bukkitTask) -> {
if (manager.isSteppingForward()) return;
manager.setFrozen(true);
bukkitTask.cancel();
}, 1, 1);
manager.tick();
}
@Override
public void sprintTicks(int ticks) {
if (manager.isSteppingForward()) {
manager.stopStepping();
} else if (manager.isSprinting()) {
manager.stopSprinting();
}
this.totalSteps = ticks;
manager.requestGameToSprint(ticks, true);
}
@Override
public boolean isSprinting() {
return manager.isSprinting();
}
@Override
public boolean isStepping() {
return manager.isSteppingForward();
}
@Override
public float getTickRate() {
return manager.tickrate();
}
@Override
public long getRemainingTicks() {
if (isSprinting()) {
return remainingSprintTicks.get(manager);
} else {
return frozenTicksToRun.get(manager);
}
}
@Override
public long getDoneTicks() {
return totalSteps - getRemainingTicks();
}
@Override
public long getTotalTicks() {
return totalSteps;
}
}

View File

@ -38,6 +38,7 @@ SCOREBOARD_TRACE_TICKS=Ticks
SCOREBOARD_TECHHIDER=TechHider§8: §aOn SCOREBOARD_TECHHIDER=TechHider§8: §aOn
SCOREBOARD_XRAY=XRay§8: §aOn SCOREBOARD_XRAY=XRay§8: §aOn
SCOREBOARD_LOCK_TEAM=Bau Lock§8: §eTeam SCOREBOARD_LOCK_TEAM=Bau Lock§8: §eTeam
SCOREBOARD_LOCK_SUPERVISOR=Bau Lock§8: §eSupervisor
SCOREBOARD_LOCK_TEAM_AND_SERVERTEAM=Bau Lock§8: §e(Server) Team SCOREBOARD_LOCK_TEAM_AND_SERVERTEAM=Bau Lock§8: §e(Server) Team
SCOREBOARD_LOCK_SERVERTEAM=Bau Lock§8: §eServer Team SCOREBOARD_LOCK_SERVERTEAM=Bau Lock§8: §eServer Team
SCOREBOARD_LOCK_NOBODY=Bau Lock§8: §cNobody SCOREBOARD_LOCK_NOBODY=Bau Lock§8: §cNobody
@ -514,7 +515,7 @@ LOADER_HELP_GUI=§8/§7loader gui §8- §7Shows Loader gui
LOADER_HELP_STOP=§8/§eloader stop §8- §7Stops recording/playback LOADER_HELP_STOP=§8/§eloader stop §8- §7Stops recording/playback
LOADER_HELP_WAIT=§8/§7loader wait §8[§7Ticks§8] - §7Sets wait time between shots LOADER_HELP_WAIT=§8/§7loader wait §8[§7Ticks§8] - §7Sets wait time between shots
LOADER_HELP_SPEED=§8/§7loader speed §8[§7Ticks§8] - §7Sets wait time between actions LOADER_HELP_SPEED=§8/§7loader speed §8[§7Ticks§8] - §7Sets wait time between actions
LOADER_NO_LOADER=§cYou have no Laoder. Create one with /loader setup LOADER_NO_LOADER=§cYou have no Loader. Create one with /loader setup
LOADER_NEW=§7Load your cannon and fire it once, to initialise the loader. LOADER_NEW=§7Load your cannon and fire it once, to initialise the loader.
LOADER_HOW_TO_START=§7Then, execute /§eloader start§7 to start the Loader LOADER_HOW_TO_START=§7Then, execute /§eloader start§7 to start the Loader
LOADER_ACTIVE=§7The Loader is now active. LOADER_ACTIVE=§7The Loader is now active.
@ -846,7 +847,7 @@ LAUFBAU_SETTINGS_INACTIVE=§cInactive
LAUFBAU_SETTINGS_MIXED=§e{0}§8/§e{1} §aActive LAUFBAU_SETTINGS_MIXED=§e{0}§8/§e{1} §aActive
LAUFBAU_SETTINGS_GUI_BACK=§eBack LAUFBAU_SETTINGS_GUI_BACK=§eBack
LAUFBAU_SETTINGS_TOGGLE=§eClick §8-§7 Toggle LAUFBAU_SETTINGS_TOGGLE=§eClick §8-§7 Toggle
LAUFBAU_SETTINGS_ADVANCED=§eMiddle-Click §8-§7 Advanced settings LAUFBAU_SETTINGS_ADVANCED=§eLeft-Click §8-§7 Advanced settings
LAUFBAU_BLOCK_COBWEB=§eCobweb LAUFBAU_BLOCK_COBWEB=§eCobweb
LAUFBAU_BLOCK_GRASS_PATH=§eGrass Path LAUFBAU_BLOCK_GRASS_PATH=§eGrass Path
LAUFBAU_BLOCK_SOUL_SAND=§eSoul Sand LAUFBAU_BLOCK_SOUL_SAND=§eSoul Sand

View File

@ -792,7 +792,7 @@ LAUFBAU_SETTINGS_INACTIVE=§cInaktiv
LAUFBAU_SETTINGS_MIXED=§e{0}§8/§e{1} §aAktiv LAUFBAU_SETTINGS_MIXED=§e{0}§8/§e{1} §aAktiv
LAUFBAU_SETTINGS_GUI_BACK=§eBack LAUFBAU_SETTINGS_GUI_BACK=§eBack
LAUFBAU_SETTINGS_TOGGLE=§eClick §8-§7 Toggle LAUFBAU_SETTINGS_TOGGLE=§eClick §8-§7 Toggle
LAUFBAU_SETTINGS_ADVANCED=§eMiddle-Click §8-§7 Erweiterte Einstellung LAUFBAU_SETTINGS_ADVANCED=§eLinks-Click §8-§7 Erweiterte Einstellung
LAUFBAU_BLOCK_COBWEB=§eCobweb LAUFBAU_BLOCK_COBWEB=§eCobweb
LAUFBAU_BLOCK_GRASS_PATH=§eGrass Path LAUFBAU_BLOCK_GRASS_PATH=§eGrass Path
LAUFBAU_BLOCK_SOUL_SAND=§eSoul Sand LAUFBAU_BLOCK_SOUL_SAND=§eSoul Sand

View File

@ -28,7 +28,6 @@ import de.steamwar.bausystem.features.script.lua.libs.LuaLib;
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader; import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
import de.steamwar.bausystem.features.slaves.panzern.Panzern; import de.steamwar.bausystem.features.slaves.panzern.Panzern;
import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm; import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
import de.steamwar.bausystem.features.tpslimit.TPSFreezeUtils;
import de.steamwar.bausystem.features.tracer.TraceManager; import de.steamwar.bausystem.features.tracer.TraceManager;
import de.steamwar.bausystem.features.tracer.TraceRecorder; import de.steamwar.bausystem.features.tracer.TraceRecorder;
import de.steamwar.bausystem.features.world.BauScoreboard; import de.steamwar.bausystem.features.world.BauScoreboard;
@ -38,11 +37,13 @@ import de.steamwar.bausystem.region.loader.RegionLoader;
import de.steamwar.bausystem.region.loader.Updater; import de.steamwar.bausystem.region.loader.Updater;
import de.steamwar.bausystem.utils.ScoreboardElement; import de.steamwar.bausystem.utils.ScoreboardElement;
import de.steamwar.bausystem.utils.TickListener; import de.steamwar.bausystem.utils.TickListener;
import de.steamwar.bausystem.utils.TickManager;
import de.steamwar.bausystem.worlddata.WorldData; import de.steamwar.bausystem.worlddata.WorldData;
import de.steamwar.command.AbstractValidator; import de.steamwar.command.AbstractValidator;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils; import de.steamwar.command.SWCommandUtils;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.core.WorldEditRendererCUIEditor;
import de.steamwar.linkage.LinkedInstance; import de.steamwar.linkage.LinkedInstance;
import de.steamwar.linkage.MaxVersion; import de.steamwar.linkage.MaxVersion;
import de.steamwar.linkage.MinVersion; import de.steamwar.linkage.MinVersion;
@ -206,6 +207,8 @@ public class BauSystem extends JavaPlugin {
TraceManager.instance.init(); TraceManager.instance.init();
TraceRecorder.instance.init(); TraceRecorder.instance.init();
new WorldEditRendererCUIEditor();
} }
@Override @Override
@ -263,7 +266,7 @@ public class BauSystem extends JavaPlugin {
@Override @Override
public void run() { public void run() {
if (TPSFreezeUtils.isFrozen()) return; if (TickManager.impl.isFrozen()) return;
if (counter >= delay) { if (counter >= delay) {
runnable.run(); runnable.run();
cancel(); cancel();
@ -281,7 +284,7 @@ public class BauSystem extends JavaPlugin {
@Override @Override
public void run() { public void run() {
if (TPSFreezeUtils.isFrozen()) return; if (TickManager.impl.isFrozen()) return;
if (counter >= (first ? delay : period)) { if (counter >= (first ? delay : period)) {
first = false; first = false;
runnable.run(); runnable.run();

View File

@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.gui.BauGUI; import de.steamwar.bausystem.features.gui.BauGUI;
import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.core.TrickyTrialsWrapper; import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv; import de.steamwar.inventory.SWListInv;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
@ -74,7 +75,7 @@ public class BauGuiEditor implements Listener {
inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> { inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> {
}).getItemStack()); }).getItemStack());
inv.setItem(mapping.getSize() + 6, new SWItem(TrickyTrialsWrapper.impl.getTurtleScute(), BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack()); inv.setItem(mapping.getSize() + 6, new SWItem(TrickyTrialsWrapper.impl.getTurtleScute(), BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack());
inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).getItemStack()); inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).setCustomModelData(CMDs.BACK).getItemStack());
p.openInventory(inv); p.openInventory(inv);
p.getOpenInventory().setCursor(cursor == null ? new SWItem().getItemStack() : cursor); p.getOpenInventory().setCursor(cursor == null ? new SWItem().getItemStack() : cursor);

View File

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.loader.elements; package de.steamwar.bausystem.features.loader.elements;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -113,7 +114,7 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
}); });
listInv.setItem(48, new SWItem(Material.ARROW, "§7Back", clickType -> { listInv.setItem(48, new SWItem(Material.ARROW, "§7Back", clickType -> {
backAction.run(); backAction.run();
})); }).setCustomModelData(CMDs.BACK));
listInv.setItem(50, new SWItem(Material.GHAST_SPAWN_EGG, "§7Insert another Setting", clickType -> { listInv.setItem(50, new SWItem(Material.GHAST_SPAWN_EGG, "§7Insert another Setting", clickType -> {
elements.add(defaultSetting); elements.add(defaultSetting);
extraPower.add(0); extraPower.add(0);
@ -150,7 +151,7 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
SWInventory swInventory = new SWInventory(player, guiSize, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player)); SWInventory swInventory = new SWInventory(player, guiSize, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
for (int i = guiSize - 9; i < guiSize; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", clickType -> {})); for (int i = guiSize - 9; i < guiSize; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", clickType -> {}));
swInventory.setItem(guiSize - 9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).getItemStack(), clickType -> back.run()); swInventory.setItem(guiSize - 9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> back.run());
swInventory.setItem(guiSize - 5, new SWItem(Material.WOODEN_AXE, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_COPY", player)).getItemStack(), clickType -> { swInventory.setItem(guiSize - 5, new SWItem(Material.WOODEN_AXE, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_COPY", player)).getItemStack(), clickType -> {
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_GUI_COPY_TITLE", player), "1"); SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_GUI_COPY_TITLE", player), "1");
swAnvilInv.setCallback(s -> { swAnvilInv.setCallback(s -> {

View File

@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.loader.elements.impl;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.loader.elements.LoaderElement; import de.steamwar.bausystem.features.loader.elements.LoaderElement;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -60,7 +61,7 @@ public class LoaderWait implements LoaderElement {
public void click(Player player, Runnable backAction) { public void click(Player player, Runnable backAction) {
SWInventory swInventory = new SWInventory(player, 18, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_TITLE", player)); SWInventory swInventory = new SWInventory(player, 18, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_TITLE", player));
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7")); for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_BACK", player)).getItemStack(), clickType -> backAction.run()); swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> backAction.run());
swInventory.setItem(3, new SWItem(SWItem.getDye(1), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> { swInventory.setItem(3, new SWItem(SWItem.getDye(1), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
delay -= clickType.isShiftClick() ? 5 : 1; delay -= clickType.isShiftClick() ? 5 : 1;

View File

@ -226,7 +226,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
} }
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent e) { public void onBlockBreak(BlockBreakEvent e) {
if (Core.getVersion() < 19) return; if (Core.getVersion() < 19) return;
if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) return; if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) return;

View File

@ -166,6 +166,8 @@ public class SteamWarLuaPlugin extends TwoArgFunction {
env.set("rawlen", NIL); env.set("rawlen", NIL);
env.set("rawset", NIL); env.set("rawset", NIL);
env.set("xpcall", NIL); env.set("xpcall", NIL);
env.set("require", NIL);
env.set("package", NIL);
return null; return null;
} }

View File

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.script.lua.libs; package de.steamwar.bausystem.features.script.lua.libs;
import de.steamwar.bausystem.features.tpslimit.TPSSystem; import de.steamwar.bausystem.features.tpslimit.TPSSystem;
import de.steamwar.bausystem.utils.TickManager;
import de.steamwar.core.TPSWatcher; import de.steamwar.core.TPSWatcher;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance; import de.steamwar.linkage.LinkedInstance;
@ -51,7 +52,7 @@ public class TpsLib implements LuaLib {
tpsLib.set("fiveMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES))); tpsLib.set("fiveMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES)));
tpsLib.set("tenMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES))); tpsLib.set("tenMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES)));
tpsLib.set("current", getter(TPSWatcher::getTPS)); tpsLib.set("current", getter(TPSWatcher::getTPS));
tpsLib.set("limit", getter(TPSSystem::getCurrentTPSLimit)); tpsLib.set("limit", getter(() -> (double) TickManager.impl.getTickRate()));
return tpsLib; return tpsLib;
} }
} }

View File

@ -76,7 +76,7 @@ public class SimulatorCommand extends SWCommand {
@Register(value = "start", description = "SIMULATOR_START_HELP") @Register(value = "start", description = "SIMULATOR_START_HELP")
public void start(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator) { public void start(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator) {
SimulatorExecutor.run(simulator, () -> {}); SimulatorExecutor.run(p, simulator, null);
} }
@Register(value = "rename", description = "SIMULATOR_RENAME_HELP") @Register(value = "rename", description = "SIMULATOR_RENAME_HELP")

View File

@ -367,7 +367,7 @@ public class SimulatorCursor implements Listener {
if (simulator == null) { if (simulator == null) {
return; return;
} }
SimulatorExecutor.run(simulator, () -> {}); SimulatorExecutor.run(event.getPlayer(), simulator, null);
return; return;
} }

View File

@ -40,9 +40,11 @@ public final class Simulator {
private SimulatorStabGenerator stabGenerator = null; private SimulatorStabGenerator stabGenerator = null;
private Material material = Material.BARREL; private Material material = Material.BARREL;
private final String name; private final String name;
private boolean autoTrace = false;
private final List<SimulatorGroup> groups = new ArrayList<>(); private final List<SimulatorGroup> groups = new ArrayList<>();
private boolean autoTrace = false;
private boolean autoTestblock = false;
public void move(int x, int y, int z) { public void move(int x, int y, int z) {
groups.forEach(simulatorGroup -> { groups.forEach(simulatorGroup -> {
simulatorGroup.move(x, y, z); simulatorGroup.move(x, y, z);

View File

@ -31,6 +31,7 @@ import de.steamwar.linkage.Linked;
import de.steamwar.linkage.MinVersion; import de.steamwar.linkage.MinVersion;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -46,7 +47,7 @@ public class SimulatorExecutor implements Listener {
private static Map<Long, Map<Integer, List<SimulatorAction>>> tickStartActions = new HashMap<>(); private static Map<Long, Map<Integer, List<SimulatorAction>>> tickStartActions = new HashMap<>();
private static Map<Long, List<SimulatorAction>> tickEndActions = new HashMap<>(); private static Map<Long, List<SimulatorAction>> tickEndActions = new HashMap<>();
public static boolean run(Simulator simulator, Runnable onEnd) { public static boolean run(Player player, Simulator simulator, Runnable onEnd) {
if (currentlyRunning.contains(simulator)) return false; if (currentlyRunning.contains(simulator)) return false;
currentlyRunning.add(simulator); currentlyRunning.add(simulator);
@ -83,10 +84,15 @@ public class SimulatorExecutor implements Listener {
}); });
} }
if (onEnd != null) {
onEnd.run(); onEnd.run();
} }
}
}); });
if (player != null && simulator.isAutoTestblock()) {
player.performCommand("tb");
}
if (simulator.isAutoTrace() && onEnd == null) { if (simulator.isAutoTrace() && onEnd == null) {
simulator.getGroups() simulator.getGroups()
.stream() .stream()

View File

@ -58,7 +58,7 @@ public abstract class StabStep {
protected abstract void start(); protected abstract void start();
protected final void runSimulator(Runnable onFinish) { protected final void runSimulator(Runnable onFinish) {
SimulatorExecutor.run(data.simulator, () -> { SimulatorExecutor.run(null, data.simulator, () -> {
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
if (this instanceof Listener) { if (this instanceof Listener) {
HandlerList.unregisterAll((Listener) this); HandlerList.unregisterAll((Listener) this);

View File

@ -25,6 +25,7 @@ import de.steamwar.bausystem.features.simulator.data.SimulatorElement;
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup; import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -70,12 +71,12 @@ public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> {
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(CMDs.BACK));
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> { inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
simulatorGroup.getElements().clear(); simulatorGroup.getElements().clear();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(CMDs.Simulator.DELETE));
inventory.setItem(4, simulatorGroup.toItem(player, clickType -> { inventory.setItem(4, simulatorGroup.toItem(player, clickType -> {
if (simulatorGroup.getMaterial() == null) return; if (simulatorGroup.getMaterial() == null) return;
@ -85,7 +86,7 @@ public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> {
inventory.setItem(48, new SWItem(Material.REPEATER, "§eSettings", clickType -> { inventory.setItem(48, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorGroupSettingsGui(player, simulator, simulatorGroup, this).open(); new SimulatorGroupSettingsGui(player, simulator, simulatorGroup, this).open();
})); }).setCustomModelData(CMDs.Simulator.SETTINGS));
boolean disabled = simulatorGroup.getMaterial() == null ? simulatorGroup.getElements().stream().allMatch(SimulatorElement::isDisabled) : simulatorGroup.isDisabled(); boolean disabled = simulatorGroup.getMaterial() == null ? simulatorGroup.getElements().stream().allMatch(SimulatorElement::isDisabled) : simulatorGroup.isDisabled();
inventory.setItem(50, new SWItem(disabled ? Material.ENDER_PEARL : Material.ENDER_EYE, simulatorGroup.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> { inventory.setItem(50, new SWItem(disabled ? Material.ENDER_PEARL : Material.ENDER_EYE, simulatorGroup.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
if (simulatorGroup.getMaterial() == null) { if (simulatorGroup.getMaterial() == null) {
@ -96,7 +97,7 @@ public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> {
simulatorGroup.setDisabled(!disabled); simulatorGroup.setDisabled(!disabled);
} }
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
} }
@Override @Override

View File

@ -25,10 +25,10 @@ import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement; import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.Arrays; import java.util.Arrays;
@ -58,7 +58,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(CMDs.BACK));
// Material Chooser // Material Chooser
inventory.setItem(4, simulatorGroup.toItem(player, clickType -> { inventory.setItem(4, simulatorGroup.toItem(player, clickType -> {
@ -69,10 +69,10 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
// Base Tick // Base Tick
int baseTicks = simulatorGroup.getBaseTick(); int baseTicks = simulatorGroup.getBaseTick();
inventory.setItem(9, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? 5 : 1); simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> { SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> { new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
if (integer < 0) return false; if (integer < 0) return false;
@ -83,14 +83,14 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
}); });
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64))); baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
inventory.setItem(18, baseTick); inventory.setItem(18, baseTick);
inventory.setItem(27, SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) { if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
simulatorGroup.changeBaseTicks(-baseTicks); simulatorGroup.changeBaseTicks(-baseTicks);
} else { } else {
simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? -5 : -1); simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
} }
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
boolean allTNT = simulatorGroup.getElements().stream().allMatch(TNTElement.class::isInstance); boolean allTNT = simulatorGroup.getElements().stream().allMatch(TNTElement.class::isInstance);
@ -163,10 +163,10 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
} }
//Pos X //Pos X
inventory.setItem(15, SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0, 0); simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> { inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> {
new SimulatorAnvilGui<>(player, "Relative X", "", Double::parseDouble, number -> { new SimulatorAnvilGui<>(player, "Relative X", "", Double::parseDouble, number -> {
if(!allTNT){ if(!allTNT){
@ -177,16 +177,16 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).setItem(Material.PAPER).open(); }, this).setItem(Material.PAPER).open();
})); }));
inventory.setItem(33, SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0, 0); simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Pos Y //Pos Y
inventory.setItem(16, SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0); simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> { inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> {
new SimulatorAnvilGui<>(player, "Relative Y", "", Double::parseDouble, number -> { new SimulatorAnvilGui<>(player, "Relative Y", "", Double::parseDouble, number -> {
if(!allTNT){ if(!allTNT){
@ -197,16 +197,16 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).setItem(Material.PAPER).open(); }, this).setItem(Material.PAPER).open();
})); }));
inventory.setItem(34, SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0); simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
//Pos Z //Pos Z
inventory.setItem(17, SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1); simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> { inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> {
new SimulatorAnvilGui<>(player, "Relative Z", "", Double::parseDouble, number -> { new SimulatorAnvilGui<>(player, "Relative Z", "", Double::parseDouble, number -> {
if(!allTNT){ if(!allTNT){
@ -217,9 +217,9 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).setItem(Material.PAPER).open(); }, this).setItem(Material.PAPER).open();
})); }));
inventory.setItem(35, SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1); simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
} }
} }

View File

@ -24,6 +24,7 @@ import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.data.SimulatorElement; import de.steamwar.bausystem.features.simulator.data.SimulatorElement;
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup; import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -50,7 +51,7 @@ public class SimulatorGui extends SimulatorPageGui<SimulatorGroup> {
})); }));
inventory.setItem(49, new SWItem(Material.REPEATER, "§eSettings", clickType -> { inventory.setItem(49, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorSettingsGui(player, simulator, this).open(); new SimulatorSettingsGui(player, simulator, this).open();
})); }).setCustomModelData(CMDs.Simulator.SETTINGS));
} }
@Override @Override

View File

@ -23,6 +23,7 @@ import de.steamwar.bausystem.features.simulator.SimulatorWatcher;
import de.steamwar.bausystem.features.simulator.data.Simulator; import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -75,7 +76,7 @@ public class SimulatorMaterialGui extends SimulatorPageGui<Material> {
})); }));
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(CMDs.BACK));
} }
@Override @Override

View File

@ -26,6 +26,7 @@ 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.observer.ObserverPhase;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -82,12 +83,12 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open(); new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
} }
} }
})); }).setCustomModelData(CMDs.BACK));
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> { inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
observer.getPhases().clear(); observer.getPhases().clear();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(CMDs.Simulator.DELETE));
// Material Chooser // Material Chooser
inventory.setItem(4, observer.toItem(player, clickType -> { inventory.setItem(4, observer.toItem(player, clickType -> {
@ -97,18 +98,18 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
// Settings // Settings
inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> { inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorObserverSettingsGui(player, simulator, observer, this).open(); new SimulatorObserverSettingsGui(player, simulator, observer, this).open();
})); }).setCustomModelData(CMDs.Simulator.SETTINGS));
// Enable/Disable // Enable/Disable
inventory.setItem(48, new SWItem(observer.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, observer.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> { inventory.setItem(48, new SWItem(observer.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, observer.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
observer.setDisabled(!observer.isDisabled()); observer.setDisabled(!observer.isDisabled());
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
// Group chooser // Group chooser
inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> { inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> {
new SimulatorGroupChooserGui(player, simulator, observer, observer.getGroup(simulator), this).open(); new SimulatorGroupChooserGui(player, simulator, observer, observer.getGroup(simulator), this).open();
})); }).setCustomModelData(CMDs.Simulator.JOIN_GROUP));
} }
@Override @Override
@ -151,15 +152,15 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1))); setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}), }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
observer, observer,
new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> { new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1))); setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}), }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> { new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> {
new SimulatorObserverPhaseSettingsGui(player, simulator, this.observer, observerPhase, this).open(); new SimulatorObserverPhaseSettingsGui(player, simulator, this.observer, observerPhase, this).open();
}), }).setCustomModelData(CMDs.Simulator.EDIT_ACTIVATION),
}; };
} }
@ -168,12 +169,12 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
return new SWItem[]{ return new SWItem[]{
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
addNewPhase(clickType.isShiftClick()); addNewPhase(clickType.isShiftClick());
}), }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
new SWItem(Material.QUARTZ, "§eObserver§8:§a New Phase", clickType -> { new SWItem(Material.QUARTZ, "§eObserver§8:§a New Phase", clickType -> {
addNewPhase(false); addNewPhase(false);
}), }).setCustomModelData(CMDs.Simulator.NEW_PHASE),
new SWItem(SWItem.getDye(8), "§7", clickType -> { new SWItem(SWItem.getDye(8), "§7", clickType -> {
}), }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
}; };
} }

View File

@ -27,6 +27,7 @@ import de.steamwar.bausystem.features.simulator.data.observer.ObserverPhase;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
@ -62,7 +63,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(CMDs.BACK));
// Material Chooser // Material Chooser
inventory.setItem(4, observerElement.toItem(player, clickType -> { inventory.setItem(4, observerElement.toItem(player, clickType -> {
@ -74,7 +75,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
observerElement.getPhases().remove(observer); observerElement.getPhases().remove(observer);
back.open(); back.open();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(CMDs.Simulator.DELETE));
int index = observerElement.getPhases().indexOf(observer); int index = observerElement.getPhases().indexOf(observer);
int min; int min;
@ -95,10 +96,10 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
//Tick Offset //Tick Offset
int offset = observer.getTickOffset(); int offset = observer.getTickOffset();
inventory.setItem(10, SWItem.getDye(offset < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(10, new SWItem(SWItem.getDye(offset < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
observer.setTickOffset(Math.min(max, offset + (clickType.isShiftClick() ? 5 : 1))); observer.setTickOffset(Math.min(max, offset + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> { SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> {
new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> { new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> {
@ -111,17 +112,17 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64))); offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
inventory.setItem(19, offsetItem); inventory.setItem(19, offsetItem);
inventory.setItem(28, SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(28, new SWItem(SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
observer.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1))); observer.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Order //Order
int order = observer.getOrder(); int order = observer.getOrder();
inventory.setItem(13, SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
observer.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1))); observer.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR"); Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR");
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eActivation Order§8:§7 " + order, clickType -> { SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eActivation Order§8:§7 " + order, clickType -> {
@ -136,10 +137,10 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30))); orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
inventory.setItem(22, orderItem); inventory.setItem(22, orderItem);
inventory.setItem(31, SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
observer.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1))); observer.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
// Update orientation // Update orientation
inventory.setItem(25, new SWItem(Material.SUNFLOWER, "§7", clickType -> { inventory.setItem(25, new SWItem(Material.SUNFLOWER, "§7", clickType -> {

View File

@ -24,6 +24,7 @@ import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.data.observer.ObserverElement; import de.steamwar.bausystem.features.simulator.data.observer.ObserverElement;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -56,7 +57,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(CMDs.BACK));
// Material Chooser // Material Chooser
inventory.setItem(4, observer.toItem(player, clickType -> { inventory.setItem(4, observer.toItem(player, clickType -> {
@ -65,10 +66,10 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
// Base Tick // Base Tick
int baseTicks = observer.getBaseTick(); int baseTicks = observer.getBaseTick();
inventory.setItem(9, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
observer.changeBaseTicks(clickType.isShiftClick() ? 5 : 1); observer.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> { SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> { new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
if (integer < 0) return false; if (integer < 0) return false;
@ -79,20 +80,20 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
}); });
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64))); baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
inventory.setItem(18, baseTick); inventory.setItem(18, baseTick);
inventory.setItem(27, SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) { if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
observer.changeBaseTicks(-baseTicks); observer.changeBaseTicks(-baseTicks);
} else { } else {
observer.changeBaseTicks(clickType.isShiftClick() ? -5 : -1); observer.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
} }
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Pos X //Pos X
inventory.setItem(15, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
observer.move(clickType.isShiftClick() ? 5 : 1, 0, 0); observer.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + observer.getPosition().getBlockX(), clickType -> { inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + observer.getPosition().getBlockX(), clickType -> {
new SimulatorAnvilGui<>(player, "X", observer.getPosition().getBlockX() + "", Integer::parseInt, i -> { new SimulatorAnvilGui<>(player, "X", observer.getPosition().getBlockX() + "", Integer::parseInt, i -> {
observer.getPosition().setX(i); observer.getPosition().setX(i);
@ -100,16 +101,16 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, this).open();
})); }));
inventory.setItem(33, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
observer.move(clickType.isShiftClick() ? -5 : -1, 0, 0); observer.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Pos Y //Pos Y
inventory.setItem(16, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
observer.move(0, clickType.isShiftClick() ? 5 : 1, 0); observer.move(0, clickType.isShiftClick() ? 5 : 1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + observer.getPosition().getBlockY(), clickType -> { inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + observer.getPosition().getBlockY(), clickType -> {
new SimulatorAnvilGui<>(player, "Y", observer.getPosition().getBlockY() + "", Integer::parseInt, i -> { new SimulatorAnvilGui<>(player, "Y", observer.getPosition().getBlockY() + "", Integer::parseInt, i -> {
observer.getPosition().setY(i); observer.getPosition().setY(i);
@ -117,16 +118,16 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, this).open();
})); }));
inventory.setItem(34, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
observer.move(0, clickType.isShiftClick() ? -5 : -1, 0); observer.move(0, clickType.isShiftClick() ? -5 : -1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Pos Z //Pos Z
inventory.setItem(17, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
observer.move(0, 0, clickType.isShiftClick() ? 5 : 1); observer.move(0, 0, clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + observer.getPosition().getBlockZ(), clickType -> { inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + observer.getPosition().getBlockZ(), clickType -> {
new SimulatorAnvilGui<>(player, "Z", observer.getPosition().getBlockZ() + "", Integer::parseInt, i -> { new SimulatorAnvilGui<>(player, "Z", observer.getPosition().getBlockZ() + "", Integer::parseInt, i -> {
observer.getPosition().setZ(i); observer.getPosition().setZ(i);
@ -134,9 +135,9 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, this).open();
})); }));
inventory.setItem(35, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
observer.move(0, 0, clickType.isShiftClick() ? -5 : -1); observer.move(0, 0, clickType.isShiftClick() ? -5 : -1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
} }
} }

View File

@ -26,6 +26,7 @@ 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.redstone.RedstonePhase;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.bukkit.Material; import org.bukkit.Material;
@ -88,12 +89,12 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open(); new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
} }
} }
})); }).setCustomModelData(CMDs.BACK));
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> { inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
redstone.getPhases().clear(); redstone.getPhases().clear();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(CMDs.Simulator.DELETE));
// Material Chooser // Material Chooser
inventory.setItem(4, redstone.toItem(player, clickType -> { inventory.setItem(4, redstone.toItem(player, clickType -> {
@ -103,18 +104,18 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
// Settings // Settings
inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> { inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorRedstoneSettingsGui(player, simulator, redstone, this).open(); new SimulatorRedstoneSettingsGui(player, simulator, redstone, this).open();
})); }).setCustomModelData(CMDs.Simulator.SETTINGS));
// Enable/Disable // Enable/Disable
inventory.setItem(48, new SWItem(redstone.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, redstone.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> { inventory.setItem(48, new SWItem(redstone.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, redstone.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
redstone.setDisabled(!redstone.isDisabled()); redstone.setDisabled(!redstone.isDisabled());
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
// Group chooser // Group chooser
inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> { inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> {
new SimulatorGroupChooserGui(player, simulator, redstone, redstone.getGroup(simulator), this).open(); new SimulatorGroupChooserGui(player, simulator, redstone, redstone.getGroup(simulator), this).open();
})); }).setCustomModelData(CMDs.Simulator.JOIN_GROUP));
} }
@Override @Override
@ -166,15 +167,15 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1))); setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}), }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
redstone, redstone,
new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> { new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1))); setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}), }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> { new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> {
new SimulatorRedstonePhaseSettingsGui(player, simulator, this.redstone, redstoneSubPhase.phase, this).open(); new SimulatorRedstonePhaseSettingsGui(player, simulator, this.redstone, redstoneSubPhase.phase, this).open();
}), }).setCustomModelData(CMDs.Simulator.EDIT_ACTIVATION),
}; };
} }
@ -183,12 +184,12 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
return new SWItem[]{ return new SWItem[]{
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
addNewPhase(clickType.isShiftClick()); addNewPhase(clickType.isShiftClick());
}), }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
new SWItem(Material.REDSTONE, "§eRedstone§8:§a New Phase", clickType -> { new SWItem(Material.REDSTONE, "§eRedstone§8:§a New Phase", clickType -> {
addNewPhase(false); addNewPhase(false);
}), }).setCustomModelData(CMDs.Simulator.NEW_PHASE),
new SWItem(SWItem.getDye(8), "§7", clickType -> { new SWItem(SWItem.getDye(8), "§7", clickType -> {
}), }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
}; };
} }

View File

@ -27,6 +27,7 @@ import de.steamwar.bausystem.features.simulator.data.redstone.RedstonePhase;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -60,7 +61,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(CMDs.BACK));
// Material Chooser // Material Chooser
inventory.setItem(4, redstoneElement.toItem(player, clickType -> { inventory.setItem(4, redstoneElement.toItem(player, clickType -> {
@ -72,7 +73,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
redstoneElement.getPhases().remove(redstone); redstoneElement.getPhases().remove(redstone);
back.open(); back.open();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(CMDs.Simulator.DELETE));
int index = redstoneElement.getPhases().indexOf(redstone); int index = redstoneElement.getPhases().indexOf(redstone);
int min; int min;
@ -96,10 +97,10 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
//Tick Offset //Tick Offset
int offset = redstone.getTickOffset(); int offset = redstone.getTickOffset();
inventory.setItem(10, SWItem.getDye(offset < maxOffset ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(10, new SWItem(SWItem.getDye(offset < maxOffset ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
redstone.setTickOffset(Math.min(maxOffset, offset + (clickType.isShiftClick() ? 5 : 1))); redstone.setTickOffset(Math.min(maxOffset, offset + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> { SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> {
new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> { new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> {
@ -112,17 +113,17 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64))); offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
inventory.setItem(19, offsetItem); inventory.setItem(19, offsetItem);
inventory.setItem(28, SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(28, new SWItem(SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
redstone.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1))); redstone.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Lifetime //Lifetime
int lifetime = redstone.getLifetime(); int lifetime = redstone.getLifetime();
inventory.setItem(11, SWItem.getDye(lifetime < maxLifetime ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(11, new SWItem(SWItem.getDye(lifetime < maxLifetime ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
redstone.setLifetime(Math.min(maxLifetime, lifetime + (clickType.isShiftClick() ? 5 : 1))); redstone.setLifetime(Math.min(maxLifetime, lifetime + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eActivation Time§8:§7 " + lifetime, clickType -> { SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eActivation Time§8:§7 " + lifetime, clickType -> {
new SimulatorAnvilGui<>(player, "Activation Time", lifetime + "", Integer::parseInt, integer -> { new SimulatorAnvilGui<>(player, "Activation Time", lifetime + "", Integer::parseInt, integer -> {
@ -135,17 +136,17 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64))); lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
inventory.setItem(20, lifetimeItem); inventory.setItem(20, lifetimeItem);
inventory.setItem(29, SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(29, new SWItem(SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
redstone.setLifetime(Math.max(0, lifetime - (clickType.isShiftClick() ? 5 : 1))); redstone.setLifetime(Math.max(0, lifetime - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Order //Order
int order = redstone.getOrder(); int order = redstone.getOrder();
inventory.setItem(13, SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
redstone.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1))); redstone.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR"); Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR");
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eActivation Order§8:§7 " + order, clickType -> { SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eActivation Order§8:§7 " + order, clickType -> {
@ -160,9 +161,9 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30))); orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
inventory.setItem(22, orderItem); inventory.setItem(22, orderItem);
inventory.setItem(31, SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
redstone.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1))); redstone.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
} }
} }

View File

@ -24,6 +24,7 @@ import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.data.redstone.RedstoneElement; import de.steamwar.bausystem.features.simulator.data.redstone.RedstoneElement;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -55,7 +56,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(CMDs.BACK));
// Material Chooser // Material Chooser
inventory.setItem(4, redstone.toItem(player, clickType -> { inventory.setItem(4, redstone.toItem(player, clickType -> {
@ -64,10 +65,10 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
// Base Tick // Base Tick
int baseTicks = redstone.getBaseTick(); int baseTicks = redstone.getBaseTick();
inventory.setItem(9, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
redstone.changeBaseTicks(clickType.isShiftClick() ? 5 : 1); redstone.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> { SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> { new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
if (integer < 0) return false; if (integer < 0) return false;
@ -78,20 +79,20 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
}); });
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64))); baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
inventory.setItem(18, baseTick); inventory.setItem(18, baseTick);
inventory.setItem(27, SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) { if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
redstone.changeBaseTicks(-baseTicks); redstone.changeBaseTicks(-baseTicks);
} else { } else {
redstone.changeBaseTicks(clickType.isShiftClick() ? -5 : -1); redstone.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
} }
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Pos X //Pos X
inventory.setItem(15, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
redstone.move(clickType.isShiftClick() ? 5 : 1, 0, 0); redstone.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + redstone.getPosition().getBlockX(), clickType -> { inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + redstone.getPosition().getBlockX(), clickType -> {
new SimulatorAnvilGui<>(player, "X", redstone.getPosition().getBlockX() + "", Integer::parseInt, i -> { new SimulatorAnvilGui<>(player, "X", redstone.getPosition().getBlockX() + "", Integer::parseInt, i -> {
redstone.getPosition().setX(i); redstone.getPosition().setX(i);
@ -99,16 +100,16 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, this).open();
})); }));
inventory.setItem(33, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
redstone.move(clickType.isShiftClick() ? -5 : -1, 0, 0); redstone.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Pos Y //Pos Y
inventory.setItem(16, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
redstone.move(0, clickType.isShiftClick() ? 5 : 1, 0); redstone.move(0, clickType.isShiftClick() ? 5 : 1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + redstone.getPosition().getBlockY(), clickType -> { inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + redstone.getPosition().getBlockY(), clickType -> {
new SimulatorAnvilGui<>(player, "Y", redstone.getPosition().getBlockY() + "", Integer::parseInt, i -> { new SimulatorAnvilGui<>(player, "Y", redstone.getPosition().getBlockY() + "", Integer::parseInt, i -> {
redstone.getPosition().setY(i); redstone.getPosition().setY(i);
@ -116,16 +117,16 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, this).open();
})); }));
inventory.setItem(34, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
redstone.move(0, clickType.isShiftClick() ? -5 : -1, 0); redstone.move(0, clickType.isShiftClick() ? -5 : -1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Pos Z //Pos Z
inventory.setItem(17, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
redstone.move(0, 0, clickType.isShiftClick() ? 5 : 1); redstone.move(0, 0, clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + redstone.getPosition().getBlockZ(), clickType -> { inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + redstone.getPosition().getBlockZ(), clickType -> {
new SimulatorAnvilGui<>(player, "Z", redstone.getPosition().getBlockZ() + "", Integer::parseInt, i -> { new SimulatorAnvilGui<>(player, "Z", redstone.getPosition().getBlockZ() + "", Integer::parseInt, i -> {
redstone.getPosition().setZ(i); redstone.getPosition().setZ(i);
@ -133,9 +134,9 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, this).open();
})); }));
inventory.setItem(35, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
redstone.move(0, 0, clickType.isShiftClick() ? -5 : -1); redstone.move(0, 0, clickType.isShiftClick() ? -5 : -1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
} }
} }

View File

@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.simulator.gui;
import de.steamwar.bausystem.features.simulator.SimulatorWatcher; import de.steamwar.bausystem.features.simulator.SimulatorWatcher;
import de.steamwar.bausystem.features.simulator.data.Simulator; import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -47,7 +48,7 @@ public class SimulatorSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(CMDs.BACK));
// Material Chooser // Material Chooser
inventory.setItem(4, simulator.toItem(player, clickType -> { inventory.setItem(4, simulator.toItem(player, clickType -> {
@ -55,45 +56,49 @@ public class SimulatorSettingsGui extends SimulatorBaseGui {
})); }));
//AutoTrace //AutoTrace
inventory.setItem(20, new SWItem(simulator.isAutoTrace() ? Material.CHAIN_COMMAND_BLOCK : Material.COMMAND_BLOCK, "§eAutoTrace§8: " + (simulator.isAutoTrace() ? "§aOn" : "§cOff"), clickType -> { inventory.setItem(19, new SWItem(simulator.isAutoTrace() ? Material.CHAIN_COMMAND_BLOCK : Material.COMMAND_BLOCK, "§eAutoTrace§8: " + (simulator.isAutoTrace() ? "§aOn" : "§cOff"), clickType -> {
simulator.setAutoTrace(!simulator.isAutoTrace()); simulator.setAutoTrace(!simulator.isAutoTrace());
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }));
inventory.setItem(20, new SWItem(simulator.isAutoTestblock() ? Material.END_STONE : Material.BARRIER, "§eTestblock§8: " + (simulator.isAutoTestblock() ? "§aOn" : "§cOff"), clickType -> {
simulator.setAutoTestblock(!simulator.isAutoTestblock());
SimulatorWatcher.update(simulator);
}));
//Pos X //Pos X
inventory.setItem(15, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
simulator.move(clickType.isShiftClick() ? 5 : 1, 0, 0); simulator.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> { inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> {
})); }));
inventory.setItem(33, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
simulator.move(clickType.isShiftClick() ? -5 : -1, 0, 0); simulator.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Pos Y //Pos Y
inventory.setItem(16, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
simulator.move(0, clickType.isShiftClick() ? 5 : 1, 0); simulator.move(0, clickType.isShiftClick() ? 5 : 1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> { inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> {
})); }));
inventory.setItem(34, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
simulator.move(0, clickType.isShiftClick() ? -5 : -1, 0); simulator.move(0, clickType.isShiftClick() ? -5 : -1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Pos Z //Pos Z
inventory.setItem(17, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
simulator.move(0, 0, clickType.isShiftClick() ? 5 : 1); simulator.move(0, 0, clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> { inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> {
})); }));
inventory.setItem(35, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
simulator.move(0, 0, clickType.isShiftClick() ? -5 : -1); simulator.move(0, 0, clickType.isShiftClick() ? -5 : -1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
} }
} }

View File

@ -29,6 +29,8 @@ import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.core.Core;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -81,12 +83,12 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open(); new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
} }
} }
})); }).setCustomModelData(CMDs.BACK));
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> { inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
tnt.getPhases().clear(); tnt.getPhases().clear();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(CMDs.Simulator.DELETE));
// Material Chooser // Material Chooser
inventory.setItem(4, tnt.toItem(player, clickType -> { inventory.setItem(4, tnt.toItem(player, clickType -> {
@ -95,11 +97,12 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> { inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorTNTSettingsGui(player, simulator, tnt, this).open(); new SimulatorTNTSettingsGui(player, simulator, tnt, this).open();
})); }).setCustomModelData(CMDs.Simulator.SETTINGS));
inventory.setItem(48, new SWItem(tnt.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, tnt.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> { inventory.setItem(48, new SWItem(tnt.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, tnt.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
tnt.setDisabled(!tnt.isDisabled()); tnt.setDisabled(!tnt.isDisabled());
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
if (Core.getVersion() > 19) {
inventory.setItem(49, new SWItem(Material.CALIBRATED_SCULK_SENSOR, "§eCreate Stab", click -> { inventory.setItem(49, new SWItem(Material.CALIBRATED_SCULK_SENSOR, "§eCreate Stab", click -> {
new SimulatorAnvilGui<>(player, "Depth Limit", "", Integer::parseInt, depthLimit -> { new SimulatorAnvilGui<>(player, "Depth Limit", "", Integer::parseInt, depthLimit -> {
if (depthLimit <= 0) return false; if (depthLimit <= 0) return false;
@ -107,17 +110,18 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
return true; return true;
}, null).open(); }, null).open();
})); }).setCustomModelData(CMDs.Simulator.CREATE_STAB));
}
inventory.setItem(50, new SWItem(Material.CHEST, parent.getElements().size() == 1 ? "§eMake Group" : "§eAdd another TNT to Group", clickType -> { inventory.setItem(50, new SWItem(Material.CHEST, parent.getElements().size() == 1 ? "§eMake Group" : "§eAdd another TNT to Group", clickType -> {
TNTElement tntElement = new TNTElement(tnt.getPosition().clone()); TNTElement tntElement = new TNTElement(tnt.getPosition().clone());
tntElement.add(new TNTPhase()); tntElement.add(new TNTPhase());
parent.add(tntElement); parent.add(tntElement);
new SimulatorGroupGui(player, simulator, parent, new SimulatorGui(player, simulator)).open(); new SimulatorGroupGui(player, simulator, parent, new SimulatorGui(player, simulator)).open();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(CMDs.Simulator.MAKE_GROUP));
inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> { inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> {
new SimulatorGroupChooserGui(player, simulator, tnt, tnt.getGroup(simulator), this).open(); new SimulatorGroupChooserGui(player, simulator, tnt, tnt.getGroup(simulator), this).open();
})); }).setCustomModelData(CMDs.Simulator.JOIN_GROUP));
} }
@Override @Override
@ -136,15 +140,15 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
tntSetting.setCount(tntSetting.getCount() + (clickType.isShiftClick() ? 5 : 1)); tntSetting.setCount(tntSetting.getCount() + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}), }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
tnt, tnt,
new SWItem(SWItem.getDye(tntSetting.getCount() > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> { new SWItem(SWItem.getDye(tntSetting.getCount() > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
tntSetting.setCount(Math.max(1, tntSetting.getCount() - (clickType.isShiftClick() ? 5 : 1))); tntSetting.setCount(Math.max(1, tntSetting.getCount() - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}), }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
new SWItem(Material.ANVIL, "§eEdit Phase", clickType -> { new SWItem(Material.ANVIL, "§eEdit Phase", clickType -> {
new SimulatorTNTPhaseSettingsGui(player, simulator, this.tnt, tntSetting, this).open(); new SimulatorTNTPhaseSettingsGui(player, simulator, this.tnt, tntSetting, this).open();
}), }).setCustomModelData(CMDs.Simulator.EDIT_ACTIVATION),
}; };
} }
@ -153,12 +157,12 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
return new SWItem[]{ return new SWItem[]{
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> { new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
addNewPhase(clickType.isShiftClick()); addNewPhase(clickType.isShiftClick());
}), }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
new SWItem(Material.GUNPOWDER, "§eTNT§8:§a New Phase", clickType -> { new SWItem(Material.GUNPOWDER, "§eTNT§8:§a New Phase", clickType -> {
addNewPhase(false); addNewPhase(false);
}), }).setCustomModelData(CMDs.Simulator.NEW_PHASE),
new SWItem(SWItem.getDye(8), "§7", clickType -> { new SWItem(SWItem.getDye(8), "§7", clickType -> {
}), }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
}; };
} }

View File

@ -27,6 +27,7 @@ import de.steamwar.bausystem.features.simulator.data.tnt.TNTPhase;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -60,7 +61,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(CMDs.BACK));
// Material Chooser // Material Chooser
inventory.setItem(4, tntElement.toItem(player, clickType -> { inventory.setItem(4, tntElement.toItem(player, clickType -> {
@ -72,14 +73,14 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
tntElement.getPhases().remove(tnt); tntElement.getPhases().remove(tnt);
back.open(); back.open();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
})); }).setCustomModelData(CMDs.Simulator.DELETE));
//Count //Count
int count = tnt.getCount(); int count = tnt.getCount();
inventory.setItem(9, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
tnt.setCount(count + (clickType.isShiftClick() ? 5 : 1)); tnt.setCount(count + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem countItem = new SWItem(Material.TNT, "§eCount§8:§7 " + count, clickType -> { SWItem countItem = new SWItem(Material.TNT, "§eCount§8:§7 " + count, clickType -> {
new SimulatorAnvilGui<>(player, "Count", count + "", Integer::parseInt, integer -> { new SimulatorAnvilGui<>(player, "Count", count + "", Integer::parseInt, integer -> {
@ -92,17 +93,17 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
countItem.getItemStack().setAmount(Math.max(1, Math.min(count, 64))); countItem.getItemStack().setAmount(Math.max(1, Math.min(count, 64)));
inventory.setItem(18, countItem); inventory.setItem(18, countItem);
inventory.setItem(27, SWItem.getDye(count > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(27, new SWItem(SWItem.getDye(count > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
tnt.setCount(Math.max(1, count - (clickType.isShiftClick() ? 5 : 1))); tnt.setCount(Math.max(1, count - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Tick Offset //Tick Offset
int offset = tnt.getTickOffset(); int offset = tnt.getTickOffset();
inventory.setItem(10, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(10, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
tnt.setTickOffset(offset + (clickType.isShiftClick() ? 5 : 1)); tnt.setTickOffset(offset + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> { SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> {
new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> { new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> {
@ -115,17 +116,17 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64))); offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
inventory.setItem(19, offsetItem); inventory.setItem(19, offsetItem);
inventory.setItem(28, SWItem.getDye(offset > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(28, new SWItem(SWItem.getDye(offset > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
tnt.setTickOffset(Math.max(0, offset - (clickType.isShiftClick() ? 5 : 1))); tnt.setTickOffset(Math.max(0, offset - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Lifetime //Lifetime
int lifetime = tnt.getLifetime(); int lifetime = tnt.getLifetime();
inventory.setItem(11, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(11, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
tnt.setLifetime(lifetime + (clickType.isShiftClick() ? 5 : 1)); tnt.setLifetime(lifetime + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eLifetime§8:§7 " + lifetime, clickType -> { SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eLifetime§8:§7 " + lifetime, clickType -> {
new SimulatorAnvilGui<>(player, "Lifetime", lifetime + "", Integer::parseInt, integer -> { new SimulatorAnvilGui<>(player, "Lifetime", lifetime + "", Integer::parseInt, integer -> {
@ -138,17 +139,17 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64))); lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
inventory.setItem(20, lifetimeItem); inventory.setItem(20, lifetimeItem);
inventory.setItem(29, SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(29, new SWItem(SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
tnt.setLifetime(Math.max(1, lifetime - (clickType.isShiftClick() ? 5 : 1))); tnt.setLifetime(Math.max(1, lifetime - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Order //Order
int order = tnt.getOrder(); int order = tnt.getOrder();
inventory.setItem(13, SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
tnt.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1))); tnt.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR"); Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR");
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eCalculation Order§8:§7 " + order, clickType -> { SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eCalculation Order§8:§7 " + order, clickType -> {
@ -163,10 +164,10 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30))); orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
inventory.setItem(22, orderItem); inventory.setItem(22, orderItem);
inventory.setItem(31, SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
tnt.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1))); tnt.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Jump //Jump
SWItem jumpX = new SWItem(tnt.isXJump() ? Material.LIME_WOOL : Material.RED_WOOL, "§7TNT §eJump X§8: " + (tnt.isZJump() ? "§aon" : "§coff"), clickType -> { SWItem jumpX = new SWItem(tnt.isXJump() ? Material.LIME_WOOL : Material.RED_WOOL, "§7TNT §eJump X§8: " + (tnt.isZJump() ? "§aon" : "§coff"), clickType -> {

View File

@ -24,10 +24,10 @@ import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement; import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -58,7 +58,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }).setCustomModelData(CMDs.BACK));
// Material Chooser // Material Chooser
List<String> lore = new ArrayList<>(); List<String> lore = new ArrayList<>();
@ -74,10 +74,10 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
// Base Tick // Base Tick
int baseTicks = tnt.getBaseTick(); int baseTicks = tnt.getBaseTick();
inventory.setItem(9, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> { inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
tnt.changeBaseTicks(clickType.isShiftClick() ? 5 : 1); tnt.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> { SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> { new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
if (integer < 0) return false; if (integer < 0) return false;
@ -88,14 +88,14 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
}); });
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64))); baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
inventory.setItem(18, baseTick); inventory.setItem(18, baseTick);
inventory.setItem(27, SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> { inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) { if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
tnt.changeBaseTicks(-baseTicks); tnt.changeBaseTicks(-baseTicks);
} else { } else {
tnt.changeBaseTicks(clickType.isShiftClick() ? -5 : -1); tnt.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
} }
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
// Subpixel Alignment // Subpixel Alignment
inventory.setItem(21, new SWItem(Material.SUNFLOWER, "§7Align§8: §eCenter", clickType -> { inventory.setItem(21, new SWItem(Material.SUNFLOWER, "§7Align§8: §eCenter", clickType -> {
@ -135,10 +135,10 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
inventory.setItem(30, positivXItem); inventory.setItem(30, positivXItem);
// Pos X // Pos X
inventory.setItem(15, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> { inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
tnt.move(clickType.isShiftClick() ? 0.0625 : 1, 0, 0); tnt.move(clickType.isShiftClick() ? 0.0625 : 1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + tnt.getPosition().getX(), clickType -> { inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + tnt.getPosition().getX(), clickType -> {
new SimulatorAnvilGui<>(player, "X", tnt.getPosition().getX() + "", Double::parseDouble, d -> { new SimulatorAnvilGui<>(player, "X", tnt.getPosition().getX() + "", Double::parseDouble, d -> {
tnt.getPosition().setX(d); tnt.getPosition().setX(d);
@ -146,16 +146,16 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, this).open();
})); }));
inventory.setItem(33, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> { inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
tnt.move(clickType.isShiftClick() ? -0.0625 : -1, 0, 0); tnt.move(clickType.isShiftClick() ? -0.0625 : -1, 0, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
// Pos Y // Pos Y
inventory.setItem(16, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> { inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
tnt.move(0, clickType.isShiftClick() ? 0.0625 : 1, 0); tnt.move(0, clickType.isShiftClick() ? 0.0625 : 1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + tnt.getPosition().getY(), clickType -> { inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + tnt.getPosition().getY(), clickType -> {
new SimulatorAnvilGui<>(player, "Y", tnt.getPosition().getY() + "", Double::parseDouble, d -> { new SimulatorAnvilGui<>(player, "Y", tnt.getPosition().getY() + "", Double::parseDouble, d -> {
tnt.getPosition().setY(d); tnt.getPosition().setY(d);
@ -163,16 +163,16 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, this).open();
})); }));
inventory.setItem(34, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> { inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
tnt.move(0, clickType.isShiftClick() ? -0.0625 : -1, 0); tnt.move(0, clickType.isShiftClick() ? -0.0625 : -1, 0);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
// Pos Z // Pos Z
inventory.setItem(17, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> { inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
tnt.move(0, 0, clickType.isShiftClick() ? 0.0625 : 1); tnt.move(0, 0, clickType.isShiftClick() ? 0.0625 : 1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + tnt.getPosition().getZ(), clickType -> { inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + tnt.getPosition().getZ(), clickType -> {
new SimulatorAnvilGui<>(player, "Z", tnt.getPosition().getZ() + "", Double::parseDouble, d -> { new SimulatorAnvilGui<>(player, "Z", tnt.getPosition().getZ() + "", Double::parseDouble, d -> {
tnt.getPosition().setZ(d); tnt.getPosition().setZ(d);
@ -180,9 +180,9 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
return true; return true;
}, this).open(); }, this).open();
})); }));
inventory.setItem(35, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> { inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
tnt.move(0, 0, clickType.isShiftClick() ? -0.0625 : -1); tnt.move(0, 0, clickType.isShiftClick() ? -0.0625 : -1);
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); }).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
} }
} }

View File

@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.simulator.gui.base;
import de.steamwar.bausystem.features.simulator.data.Simulator; import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -50,19 +51,19 @@ public abstract class SimulatorPageGui<T> extends SimulatorBaseGui {
headerAndFooter(); headerAndFooter();
page = Math.min(page, maxPage()); page = Math.min(page, maxPage());
inventory.setItem(size - 9, SWItem.getDye(page > 0 ? 10 : 8), page > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(page > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> { inventory.setItem(size - 9, new SWItem(SWItem.getDye(page > 0 ? 10 : 8), page > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(page > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> {
if (page > 0) { if (page > 0) {
page--; page--;
open(); open();
} }
}); }).setCustomModelData(CMDs.PREVIOUS_PAGE));
boolean hasNext = page < maxPage() - (data.size() % (size - 18) == 0 ? 1 : 0); boolean hasNext = page < maxPage() - (data.size() % (size - 18) == 0 ? 1 : 0);
inventory.setItem(size - 1, SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> { inventory.setItem(size - 1, new SWItem(SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> {
if (hasNext) { if (hasNext) {
page++; page++;
open(); open();
} }
}); }).setCustomModelData(CMDs.NEXT_PAGE));
int minElement = page * (size - 18); int minElement = page * (size - 18);
int maxElement = Math.min(data.size(), (page + 1) * (size - 18)); int maxElement = Math.min(data.size(), (page + 1) * (size - 18));

View File

@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.simulator.gui.base;
import de.steamwar.bausystem.features.simulator.data.Simulator; import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -50,19 +51,19 @@ public abstract class SimulatorScrollGui<T> extends SimulatorBaseGui {
headerAndFooter(); headerAndFooter();
scroll = maxScroll(); scroll = maxScroll();
inventory.setItem(size - 9, SWItem.getDye(scroll > 0 ? 10 : 8), scroll > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(scroll > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> { inventory.setItem(size - 9, new SWItem(SWItem.getDye(scroll > 0 ? 10 : 8), scroll > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(scroll > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> {
if (scroll > 0) { if (scroll > 0) {
scroll = Math.max(0, scroll - 9); scroll = Math.max(0, scroll - 9);
open(); open();
} }
}); }).setCustomModelData(CMDs.PREVIOUS_PAGE));
boolean hasNext = (data.size() + 1) - scroll > 9; boolean hasNext = (data.size() + 1) - scroll > 9;
inventory.setItem(size - 1, SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> { inventory.setItem(size - 1, new SWItem(SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> {
if (hasNext) { if (hasNext) {
scroll = Math.min(scroll + 9, data.size() + 1 - 9); scroll = Math.min(scroll + 9, data.size() + 1 - 9);
open(); open();
} }
}); }).setCustomModelData(CMDs.NEXT_PAGE));
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
if (scroll + i < data.size()) { if (scroll + i < data.size()) {

View File

@ -68,6 +68,7 @@ public class SimFormatSimulatorLoader implements SimulatorLoader {
private void loadSimulator(YAPIONObject simulatorObject, Simulator simulator) { private void loadSimulator(YAPIONObject simulatorObject, Simulator simulator) {
simulator.setMaterial(Material.valueOf(simulatorObject.getPlainValue("material"))); simulator.setMaterial(Material.valueOf(simulatorObject.getPlainValue("material")));
simulator.setAutoTrace(simulatorObject.getPlainValue("autoTrace")); simulator.setAutoTrace(simulatorObject.getPlainValue("autoTrace"));
simulator.setAutoTestblock(simulatorObject.getPlainValueOrDefault("autoTestblock", false));
YAPIONArray groups = simulatorObject.getArray("groups"); YAPIONArray groups = simulatorObject.getArray("groups");
groups.streamObject().forEach(groupObject -> { groups.streamObject().forEach(groupObject -> {

View File

@ -39,6 +39,7 @@ public class SimulatorSaver {
YAPIONObject simulatorObject = new YAPIONObject(); YAPIONObject simulatorObject = new YAPIONObject();
simulatorObject.add("material", simulator.getMaterial().name()); simulatorObject.add("material", simulator.getMaterial().name());
simulatorObject.add("autoTrace", simulator.isAutoTrace()); simulatorObject.add("autoTrace", simulator.isAutoTrace());
simulatorObject.add("autoTestblock", simulator.isAutoTestblock());
YAPIONArray groups = new YAPIONArray(); YAPIONArray groups = new YAPIONArray();
simulator.getGroups().forEach(group -> { simulator.getGroups().forEach(group -> {

View File

@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.slaves.laufbau;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.shared.Pair; import de.steamwar.bausystem.shared.Pair;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv; import de.steamwar.inventory.SWListInv;
import org.bukkit.Material; import org.bukkit.Material;
@ -59,7 +60,7 @@ public class LaufbauSettings {
open(); open();
return; return;
} }
if (clickType.isCreativeAction()) { if (clickType.isLeftClick()) {
open(entry.getKey()); open(entry.getKey());
return; return;
} }
@ -91,7 +92,7 @@ public class LaufbauSettings {
}); });
inv.setItem(49, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_GUI_BACK", p), clickType -> { inv.setItem(49, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_GUI_BACK", p), clickType -> {
open(); open();
})); }).setCustomModelData(CMDs.BACK));
inv.open(); inv.open();
} }

View File

@ -25,6 +25,7 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import de.steamwar.bausystem.utils.WorldEditUtils; import de.steamwar.bausystem.utils.WorldEditUtils;
import de.steamwar.core.Core;
import lombok.Getter; import lombok.Getter;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.bukkit.Location; import org.bukkit.Location;
@ -56,7 +57,7 @@ public class Panzern {
private BaseBlock blockType; private BaseBlock blockType;
private BaseBlock slabType; private BaseBlock slabType;
private static final BaseBlock jukeboxType = BlockTypes.JUKEBOX.getDefaultState().toBaseBlock(); private static final BaseBlock jukeboxType = (Core.getVersion() > 19 ? BlockTypes.get("lodestone"): BlockTypes.get("jukebox")).getDefaultState().toBaseBlock();
private static final BaseBlock cobwebType = BlockTypes.COBWEB.getDefaultState().toBaseBlock(); private static final BaseBlock cobwebType = BlockTypes.COBWEB.getDefaultState().toBaseBlock();
private static final BaseBlock airType = BlockTypes.AIR.getDefaultState().toBaseBlock(); private static final BaseBlock airType = BlockTypes.AIR.getDefaultState().toBaseBlock();

View File

@ -57,6 +57,7 @@ public class SmartPlaceListener implements Listener {
static { static {
World world = Bukkit.getWorlds().get(0); World world = Bukkit.getWorlds().get(0);
Block block = world.getBlockAt(0, 0, 0); Block block = world.getBlockAt(0, 0, 0);
block.setType(Material.AIR);
BlockState state = block.getState(); BlockState state = block.getState();
for (Material material : Material.values()) { for (Material material : Material.values()) {
if (material.isLegacy()) continue; if (material.isLegacy()) continue;
@ -68,6 +69,7 @@ public class SmartPlaceListener implements Listener {
} else if (blockData instanceof Stairs) { } else if (blockData instanceof Stairs) {
CONTAINERS.add(material); CONTAINERS.add(material);
} }
state.update(true, false);
} }
CONTAINERS.add(Material.GRINDSTONE); CONTAINERS.add(Material.GRINDSTONE);
CONTAINERS.remove(Material.COMPARATOR); CONTAINERS.remove(Material.COMPARATOR);

View File

@ -1,7 +1,7 @@
/* /*
* This file is a part of the SteamWar software. * This file is a part of the SteamWar software.
* *
* Copyright (C) 2023 SteamWar.de-Serverteam * Copyright (C) 2020 SteamWar.de-Serverteam
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Affero General Public License as published by

View File

@ -27,19 +27,17 @@ import de.steamwar.bausystem.region.GlobalRegion;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.utils.ScoreboardElement; import de.steamwar.bausystem.utils.ScoreboardElement;
import de.steamwar.bausystem.utils.TickEndEvent; import de.steamwar.bausystem.utils.TickEndEvent;
import de.steamwar.bausystem.utils.TickManager;
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar; import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
import de.steamwar.bausystem.utils.bossbar.BossBarService; import de.steamwar.bausystem.utils.bossbar.BossBarService;
import de.steamwar.command.AbstractSWCommand; import de.steamwar.command.AbstractSWCommand;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.core.TPSWarpUtils;
import de.steamwar.core.TPSWatcher; import de.steamwar.core.TPSWatcher;
import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance; import de.steamwar.linkage.LinkedInstance;
import de.steamwar.linkage.MaxVersion;
import lombok.Getter;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.boss.BarColor; import org.bukkit.boss.BarColor;
@ -52,91 +50,61 @@ import org.bukkit.inventory.ItemStack;
import java.util.Arrays; import java.util.Arrays;
@Linked @Linked
@MaxVersion(20) // Hotfix for 1.21 tps limit! -> Backport coming later
public class TPSSystem implements Listener { public class TPSSystem implements Listener {
@Getter
private static double currentTPSLimit = 20;
public TPSSystem() { public TPSSystem() {
if (TPSFreezeUtils.isCanFreeze()) { if (TickManager.impl.canFreeze()) {
new TPSFreezeCommand(); new TPSFreezeCommand();
new TickFreezeCommand(); new TickFreezeCommand();
new TickStepCommand(); new TickStepCommand();
} }
new TPSLimitCommand(); new TPSLimitCommand();
new TickLimitCommand(); new TickLimitCommand();
if (Core.getVersion() >= 15 && Core.getVersion() <= 20) { // If 1.21 support is not directly present if (Core.getVersion() >= 15) {
new TPSWarpCommand(); new TPSWarpCommand();
new TickWarpCommand(); new TickWarpCommand();
if (TPSFreezeUtils.isCanFreeze()) { if (TickManager.impl.canFreeze()) {
new TickWarpingCommand(); new TickWarpingCommand();
} }
} }
if (Core.getVersion() >= 21) {
new Tick21Command();
}
new TPSDefaultCommand(); new TPSDefaultCommand();
new TickDefaultCommand(); new TickDefaultCommand();
new TPSBaseCommand(); new TPSBaseCommand();
new TickBaseCommand(); new TickBaseCommand();
} Bukkit.getPluginManager().registerEvents(TickManager.impl, BauSystem.getInstance());
private void setTPS(double tps) {
if (currentlyStepping) {
currentlyStepping = false;
Bukkit.getOnlinePlayers().forEach(player -> {
BossBarService.instance.remove(player, GlobalRegion.getInstance(), "TickStep");
});
}
TPSWarpUtils.warp(tps);
if (currentTPSLimit == 0 && tps != 0) {
TPSFreezeUtils.unfreeze();
}
currentTPSLimit = tps;
if (tps == 0) {
TPSLimitUtils.unlimit();
TPSFreezeUtils.freeze();
} else if (tps < 20.0) {
TPSLimitUtils.limit(tps);
} else if (tps >= 20) {
TPSLimitUtils.unlimit();
}
Bukkit.getOnlinePlayers().forEach(player -> {
if (currentTPSLimit == 0) {
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("TPSLIMIT_FROZEN", player));
} else {
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("TPSLIMIT_SET", player, currentTPSLimit));
}
});
}
private boolean currentlyStepping = false;
private double currentLimit;
private int stepsTotal;
private int stepsLeft;
private void setSkip(int steps, double tpsLimitToUse) {
currentLimit = tpsLimitToUse == 20 ? 0 : currentTPSLimit;
setTPS(tpsLimitToUse);
stepsLeft = steps;
stepsTotal = steps;
currentlyStepping = true;
} }
@EventHandler @EventHandler
public void onTickEnd(TickEndEvent event) { public void onTickEnd(TickEndEvent event) {
if (!currentlyStepping) return; bossbar();
if (stepsTotal > 1) { }
private void bossbar() {
if ((TickManager.impl.isStepping() || TickManager.impl.isSprinting()) && TickManager.impl.getRemainingTicks() > 0) {
Bukkit.getOnlinePlayers().forEach(player -> { Bukkit.getOnlinePlayers().forEach(player -> {
BauSystemBossbar bossbar = BossBarService.instance.get(player, GlobalRegion.getInstance(), "TickStep"); BauSystemBossbar bossbar = BossBarService.instance.get(player, GlobalRegion.getInstance(), "TickStep");
bossbar.setColor(BarColor.YELLOW); bossbar.setColor(BarColor.YELLOW);
bossbar.setTitle(BauSystem.MESSAGE.parse("TICK_BOSSBAR", player, (stepsTotal - stepsLeft), stepsTotal)); bossbar.setTitle(BauSystem.MESSAGE.parse("TICK_BOSSBAR", player, TickManager.impl.getDoneTicks(), TickManager.impl.getTotalTicks()));
bossbar.setProgress((stepsTotal - stepsLeft) / (double) stepsTotal); bossbar.setProgress(TickManager.impl.getDoneTicks() / (double) TickManager.impl.getTotalTicks());
});
} else {
Bukkit.getOnlinePlayers().forEach(player -> {
BossBarService.instance.remove(player, GlobalRegion.getInstance(), "TickStep");
}); });
} }
stepsLeft--;
if (stepsLeft <= 0) {
setTPS(currentLimit);
} }
public static void sendTickRateChange() {
Bukkit.getOnlinePlayers().forEach(player -> {
if (TickManager.impl.isFrozen()) {
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("TPSLIMIT_FROZEN", player));
} else {
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("TPSLIMIT_SET", player, TickManager.impl.getTickRate()));
}
});
} }
private class TPSBaseCommand extends SWCommand { private class TPSBaseCommand extends SWCommand {
@ -157,7 +125,8 @@ public class TPSSystem implements Listener {
@Register(value = "0", description = "TPSLIMIT_FREEZE_HELP") @Register(value = "0", description = "TPSLIMIT_FREEZE_HELP")
public void freeze(@Validator Player player) { public void freeze(@Validator Player player) {
setTPS(0); TickManager.impl.setFreeze(true);
sendTickRateChange();
} }
} }
@ -169,8 +138,9 @@ public class TPSSystem implements Listener {
} }
@Register(description = "TPSLIMIT_LIMIT_HELP") @Register(description = "TPSLIMIT_LIMIT_HELP")
public void limit(@Validator Player player, @Min(doubleValue = 0.5) @Max(doubleValue = 20.0) double tpsLimit) { public void limit(@Validator Player player, @Min(doubleValue = 0.5) @Max(doubleValue = 20.0) float tpsLimit) {
setTPS(tpsLimit); TickManager.impl.setTickRate(tpsLimit);
sendTickRateChange();
} }
} }
@ -182,8 +152,9 @@ public class TPSSystem implements Listener {
} }
@Register(description = "TPSLIMIT_WARP_HELP") @Register(description = "TPSLIMIT_WARP_HELP")
public void warp(@Validator Player player, @Min(doubleValue = 20.0, inclusive = false) double tpsLimit) { public void warp(@Validator Player player, @Min(doubleValue = 20.0, inclusive = false) float tpsLimit) {
setTPS(tpsLimit); TickManager.impl.setTickRate(tpsLimit);
sendTickRateChange();
} }
} }
@ -196,12 +167,13 @@ public class TPSSystem implements Listener {
@Register(description = "TPSLIMIT_HELP") @Register(description = "TPSLIMIT_HELP")
public void currentLimit(Player player) { public void currentLimit(Player player) {
BauSystem.MESSAGE.send("TPSLIMIT_CURRENT", player, currentTPSLimit); BauSystem.MESSAGE.send("TPSLIMIT_CURRENT", player, TickManager.impl.getTickRate());
} }
@Register(value = "default", description = "TPSLIMIT_DEFAULT_HELP") @Register(value = "default", description = "TPSLIMIT_DEFAULT_HELP")
public void reset(@Validator Player player) { public void reset(@Validator Player player) {
setTPS(20); TickManager.impl.setTickRate(20.0F);
sendTickRateChange();
} }
} }
@ -223,12 +195,14 @@ public class TPSSystem implements Listener {
@Register(value = {"rate", "0"}, description = "TICK_FREEZE_HELP") @Register(value = {"rate", "0"}, description = "TICK_FREEZE_HELP")
@Register(value = "freeze", description = "TICK_FREEZE_HELP_2") @Register(value = "freeze", description = "TICK_FREEZE_HELP_2")
public void freeze(@Validator Player player) { public void freeze(@Validator Player player) {
setTPS(0); TickManager.impl.setFreeze(true);
sendTickRateChange();
} }
@Register(value = "unfreeze", description = "TICK_UNFREEZE_HELP") @Register(value = "unfreeze", description = "TICK_UNFREEZE_HELP")
public void unfreeze(@Validator Player player) { public void unfreeze(@Validator Player player) {
setTPS(20); TickManager.impl.setTickRate(20.0F);
sendTickRateChange();
} }
} }
@ -241,7 +215,9 @@ public class TPSSystem implements Listener {
@Register(value = "step", description = "TICK_STEPPING_HELP") @Register(value = "step", description = "TICK_STEPPING_HELP")
public void step(@Validator Player player, @Min(intValue = 1) @OptionalValue("1") int steps) { public void step(@Validator Player player, @Min(intValue = 1) @OptionalValue("1") int steps) {
setSkip(steps, 20); TickManager.impl.stepTicks(steps);
sendTickRateChange();
bossbar();
} }
} }
@ -253,8 +229,9 @@ public class TPSSystem implements Listener {
} }
@Register(value = "warp", description = "TICK_WARPING_HELP") @Register(value = "warp", description = "TICK_WARPING_HELP")
public void warp(@Validator Player player, @Min(intValue = 1) @OptionalValue("1") int steps, @Min(doubleValue = 20) @OptionalValue("4000") double tps) { public void warp(@Validator Player player, @Min(intValue = 1) @OptionalValue("1") int steps) {
setSkip(steps, tps); TickManager.impl.sprintTicks(steps);
sendTickRateChange();
} }
} }
@ -266,8 +243,9 @@ public class TPSSystem implements Listener {
} }
@Register(value = "rate", description = "TICK_LIMIT_HELP") @Register(value = "rate", description = "TICK_LIMIT_HELP")
public void limit(@Validator Player player, @Min(doubleValue = 0.5, inclusive = false) @Max(doubleValue = 20.0) double tpsLimit) { public void limit(@Validator Player player, @Min(doubleValue = 0.5, inclusive = false) @Max(doubleValue = 20.0) float tpsLimit) {
setTPS(tpsLimit); TickManager.impl.setTickRate(tpsLimit);
sendTickRateChange();
} }
} }
@ -279,8 +257,9 @@ public class TPSSystem implements Listener {
} }
@Register(value = "rate", description = "TICK_WARP_HELP") @Register(value = "rate", description = "TICK_WARP_HELP")
public void warp(@Validator Player player, @Min(doubleValue = 20.0, inclusive = false) double tpsLimit) { public void warp(@Validator Player player, @Min(doubleValue = 20.0, inclusive = false) float tpsLimit) {
setTPS(tpsLimit); TickManager.impl.setTickRate(tpsLimit);
sendTickRateChange();
} }
} }
@ -293,12 +272,31 @@ public class TPSSystem implements Listener {
@Register(value = "rate", description = "TICK_HELP") @Register(value = "rate", description = "TICK_HELP")
public void currentLimit(Player player) { public void currentLimit(Player player) {
BauSystem.MESSAGE.send("TPSLIMIT_CURRENT", player, currentTPSLimit); BauSystem.MESSAGE.send("TPSLIMIT_CURRENT", player, TickManager.impl.getTickRate());
} }
@Register(value = {"rate", "default"}, description = "TICK_DEFAULT_HELP") @Register(value = {"rate", "default"}, description = "TICK_DEFAULT_HELP")
public void reset(@Validator Player player) { public void reset(@Validator Player player) {
setTPS(20); TickManager.impl.setTickRate(20.0F);
sendTickRateChange();
}
}
@AbstractSWCommand.PartOf(TickBaseCommand.class)
private class Tick21Command extends SWCommand {
private Tick21Command() {
super("");
}
@Register(value = "normalclient")
public void smooth(@Validator Player player) {
TickManager.impl.setBlockTpsPacket(true);
}
@Register(value = "slowclient")
public void unsmooth(@Validator Player player) {
TickManager.impl.setBlockTpsPacket(false);
} }
} }
@ -320,7 +318,10 @@ public class TPSSystem implements Listener {
@Override @Override
public String get(Region region, Player p) { public String get(Region region, Player p) {
if (tpsSystem != null && tpsSystem.currentlyStepping) { boolean isWarping = TickManager.impl.isSprinting();
boolean isFrozen = TickManager.impl.isFrozen();
if (tpsSystem != null && isWarping) {
long time = System.currentTimeMillis() % 1000; long time = System.currentTimeMillis() % 1000;
if (time < 250) { if (time < 250) {
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: §7•••"; return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: §7•••";
@ -331,7 +332,7 @@ public class TPSSystem implements Listener {
} else { } else {
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: §7••§e•"; return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: §7••§e•";
} }
} else if (TPSFreezeUtils.frozen()) { } else if (isFrozen) {
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + BauSystem.MESSAGE.parse("SCOREBOARD_TPS_FROZEN", p); return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + BauSystem.MESSAGE.parse("SCOREBOARD_TPS_FROZEN", p);
} else { } else {
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + tpsColor() + TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.ONE_SECOND) + tpsLimit(); return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + tpsColor() + TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.ONE_SECOND) + tpsLimit();
@ -340,20 +341,20 @@ public class TPSSystem implements Listener {
private String tpsColor() { private String tpsColor() {
double tps = TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.ONE_SECOND); double tps = TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.ONE_SECOND);
if (tps > TPSSystem.getCurrentTPSLimit() * 0.9) { if (tps > TickManager.impl.getTickRate() * 0.9) {
return "§a"; return "§a";
} }
if (tps > TPSSystem.getCurrentTPSLimit() * 0.5) { if (tps > TickManager.impl.getTickRate() * 0.5) {
return "§e"; return "§e";
} }
return "§c"; return "§c";
} }
private String tpsLimit() { private String tpsLimit() {
if (TPSSystem.getCurrentTPSLimit() == 20) { if (TickManager.impl.getTickRate() == 20) {
return ""; return "";
} }
return "§8/§7" + TPSSystem.getCurrentTPSLimit(); return "§8/§7" + TickManager.impl.getTickRate();
} }
} }
@ -369,7 +370,7 @@ public class TPSSystem implements Listener {
@Override @Override
public ItemStack getItem(Player player) { public ItemStack getItem(Player player) {
return new SWItem(Material.CLOCK, BauSystem.MESSAGE.parse("TPSLIMIT_GUI_ITEM_NAME", player), Arrays.asList(BauSystem.MESSAGE.parse("TPSLIMIT_GUI_ITEM_LORE", player, tpsSystem.currentTPSLimit)), false, clickType -> { return new SWItem(Material.CLOCK, BauSystem.MESSAGE.parse("TPSLIMIT_GUI_ITEM_NAME", player), Arrays.asList(BauSystem.MESSAGE.parse("TPSLIMIT_GUI_ITEM_LORE", player, TickManager.impl.getTickRate())), false, clickType -> {
}).getItemStack(); }).getItemStack();
} }

View File

@ -22,19 +22,15 @@ package de.steamwar.bausystem.features.tracer;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.core.Core;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -106,7 +102,11 @@ public class TNTPoint{
List<TNTPoint> history, List<Block> destroyedBlocks) { List<TNTPoint> history, List<Block> destroyedBlocks) {
this.tntId = tntId; this.tntId = tntId;
this.explosion = explosion; this.explosion = explosion;
if (Core.getVersion() > 15) {
this.inWater = tnt.isInWater(); this.inWater = tnt.isInWater();
} else {
this.inWater = false;
}
this.afterFirstExplosion = afterFirstExplosion; this.afterFirstExplosion = afterFirstExplosion;
this.ticksSinceStart = ticksSinceStart; this.ticksSinceStart = ticksSinceStart;
fuse = tnt.getFuseTicks(); fuse = tnt.getFuseTicks();

View File

@ -50,12 +50,6 @@ public class Trace {
@Getter @Getter
private final File recordsSaveFile; private final File recordsSaveFile;
/**
* File the metadata are saved in
*/
@Getter
private final File metadataSaveFile;
/** /**
* Region the trace was recorded in * Region the trace was recorded in
*/ */
@ -75,7 +69,7 @@ public class Trace {
@Setter @Setter
@Getter @Getter
private int recordsCount; private int tntIdCount;
/** /**
* A map of all REntityServers rendering this trace * A map of all REntityServers rendering this trace
@ -95,21 +89,19 @@ public class Trace {
this.date = new Date(); this.date = new Date();
records = new SoftReference<>(recordList); records = new SoftReference<>(recordList);
recordsSaveFile = new File(TraceRepository.tracesFolder, uuid + ".records"); recordsSaveFile = new File(TraceRepository.tracesFolder, uuid + ".records");
metadataSaveFile = new File(TraceRepository.tracesFolder, uuid + ".meta");
} }
/** /**
* Constructor for deserialising a trace from the file system * Constructor for deserialising a trace from the file system
*/ */
@SneakyThrows @SneakyThrows
protected Trace(UUID uuid, Region region, Date date, File metadataFile, File recordsFile, int recordsCount) { protected Trace(UUID uuid, Region region, Date date, File recordsFile, int tntIdCount) {
this.metadataSaveFile = metadataFile;
recordsSaveFile = recordsFile; recordsSaveFile = recordsFile;
this.uuid = uuid; this.uuid = uuid;
this.region = region; this.region = region;
this.date = date; this.date = date;
this.records = new SoftReference<>(null); this.records = new SoftReference<>(null);
this.recordsCount = recordsCount; this.tntIdCount = tntIdCount;
} }
/** /**
@ -311,7 +303,7 @@ public class Trace {
", region=" + region + ", region=" + region +
", creationTime=" + date + ", creationTime=" + date +
", recordsSaveFile=" + recordsSaveFile.getName() + ", recordsSaveFile=" + recordsSaveFile.getName() +
", recordCount=" + recordsCount + ", tntCount=" + tntIdCount +
", records=" + getRecords() + ", records=" + getRecords() +
'}'; '}';
} }

View File

@ -57,19 +57,26 @@ public class TraceManager implements Listener {
if (traceFiles == null) if (traceFiles == null)
return; return;
boolean hasMetaFiles = false;
for (File traceFile : traceFiles) { for (File traceFile : traceFiles) {
if (traceFile.getName().contains(".records")) if (traceFile.getName().contains(".meta")) {
continue; hasMetaFiles = true;
}
if (TraceRepository.getVersion(traceFile) == TraceRepository.SERIALISATION_VERSION) { }
add(TraceRepository.readTrace(traceFile)); if (hasMetaFiles) {
} else { for (File traceFile : traceFiles) {
String uuid = traceFile.getName().replace(".meta", ""); traceFile.delete();
}
new File(tracesFolder, uuid + ".records").deleteOnExit(); traceFiles = new File[0];
new File(tracesFolder, uuid + ".meta").deleteOnExit();
} }
for (File traceFile : traceFiles) {
Trace trace = TraceRepository.readTrace(traceFile);
if (trace == null) {
traceFile.delete();
continue;
}
add(trace);
} }
} }
@ -152,7 +159,6 @@ public class TraceManager implements Listener {
if (traceId == null) throw new RuntimeException("Trace not found while trying to remove see (c978eb98-b0b2-4009-91d8-acfa34e2831a)"); if (traceId == null) throw new RuntimeException("Trace not found while trying to remove see (c978eb98-b0b2-4009-91d8-acfa34e2831a)");
traces.remove(traceId); traces.remove(traceId);
trace.hide(); trace.hide();
trace.getMetadataSaveFile().delete();
trace.getRecordsSaveFile().delete(); trace.getRecordsSaveFile().delete();
} }
@ -172,7 +178,6 @@ public class TraceManager implements Listener {
tracesByRegion.getOrDefault(region, new HashMap<>()) tracesByRegion.getOrDefault(region, new HashMap<>())
.forEach((i, trace) -> { .forEach((i, trace) -> {
if (trace.getRegion() != region) return; if (trace.getRegion() != region) return;
trace.getMetadataSaveFile().delete();
trace.getRecordsSaveFile().delete(); trace.getRecordsSaveFile().delete();
}); });
tracesByRegion.getOrDefault(region, new HashMap<>()).clear(); tracesByRegion.getOrDefault(region, new HashMap<>()).clear();

View File

@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
@ -31,7 +32,6 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.server.PluginEnableEvent;
import java.util.*; import java.util.*;
import java.util.logging.Level; import java.util.logging.Level;
@ -40,12 +40,9 @@ import java.util.logging.Logger;
@Linked @Linked
public class TraceRecorder implements Listener { public class TraceRecorder implements Listener {
@LinkedInstance
public static TraceRecorder instance; public static TraceRecorder instance;
{
instance = this;
}
/** /**
* Map for all traces being actively recorded * Map for all traces being actively recorded
*/ */

View File

@ -65,7 +65,7 @@ public class TraceRecordingWrapper {
TraceManager.instance.showPartial(trace, recordsToAdd); TraceManager.instance.showPartial(trace, recordsToAdd);
recordList.addAll(recordsToAdd); recordList.addAll(recordsToAdd);
trace.setRecordsCount(recordList.size()); trace.setTntIdCount((int) recordList.stream().map(TNTPoint::getTntId).distinct().count());
recordsToAdd.clear(); recordsToAdd.clear();
} }

View File

@ -9,95 +9,125 @@ import org.bukkit.util.Vector;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
public class TraceRepository { public class TraceRepository {
/** /**
* Increment this when changing serialisation format * Increment this when changing serialisation format
*/ */
public static final int SERIALISATION_VERSION = 1; public static final int SERIALISATION_VERSION = 2;
public static final int WRITE_TICK_DATA = 0b00000001;
public static final int EXPLOSION = 0b00000010;
public static final int IN_WATER = 0b00000100;
public static final int AFTER_FIRST_EXPLOSION = 0b00001000;
public static final int DESTROYED_BUILD_AREA = 0b00010000;
public static final int DESTROYED_TEST_BLOCK = 0b00100000;
public static File tracesFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "traces"); public static File tracesFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "traces");
@SneakyThrows @SneakyThrows
protected static int getVersion(File metadataFile) { public static Trace readTrace(File recordsFile) {
@Cleanup @Cleanup
ObjectInputStream reader = new ObjectInputStream(new FileInputStream(metadataFile)); ObjectInputStream reader = new ObjectInputStream(new GZIPInputStream(new FileInputStream(recordsFile)));
reader.readUTF();
reader.readUTF();
reader.readObject();
try {
int version = reader.readInt();
return version;
} catch (EOFException e) {
return 0;
}
}
@SneakyThrows
public static Trace readTrace(File metadataFile) {
@Cleanup
ObjectInputStream reader = new ObjectInputStream(new FileInputStream(metadataFile));
UUID uuid = UUID.fromString(reader.readUTF()); UUID uuid = UUID.fromString(reader.readUTF());
Region region = Region.getREGION_MAP().get(reader.readUTF()); Region region = Region.getREGION_MAP().get(reader.readUTF());
Date date = (Date) reader.readObject(); Date date = (Date) reader.readObject();
File recordsFile = new File(tracesFolder,uuid + ".records");
int serialisationVersion = reader.readInt(); int serialisationVersion = reader.readInt();
int recordsCount = reader.readInt(); if (serialisationVersion != SERIALISATION_VERSION) {
return null;
}
int tntIdCount = reader.readInt();
return new Trace(uuid, region, date, metadataFile, recordsFile, recordsCount); return new Trace(uuid, region, date, recordsFile, tntIdCount);
} }
@SneakyThrows @SneakyThrows
protected static void writeTrace(Trace trace, List<TNTPoint> records) { protected static void writeTrace(Trace trace, List<TNTPoint> records) {
ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(trace.getMetadataSaveFile())); ObjectOutputStream outputStream = new ObjectOutputStream(new GZIPOutputStream(new FileOutputStream(trace.getRecordsSaveFile())));
outputStream.writeUTF(trace.getUuid().toString()); outputStream.writeUTF(trace.getUuid().toString());
outputStream.writeUTF(trace.getRegion().getName()); outputStream.writeUTF(trace.getRegion().getName());
outputStream.writeObject(trace.getDate()); outputStream.writeObject(trace.getDate());
outputStream.writeInt(SERIALISATION_VERSION); outputStream.writeInt(SERIALISATION_VERSION);
outputStream.writeInt(records.size());
Map<Integer, List<TNTPoint>> pointsByTNTId = new HashMap<>();
records.forEach(tntPoint -> {
pointsByTNTId.computeIfAbsent(tntPoint.getTntId(), integer -> new ArrayList<>()).add(tntPoint);
});
outputStream.writeInt(pointsByTNTId.size());
for (Map.Entry<Integer, List<TNTPoint>> entry : pointsByTNTId.entrySet()) {
outputStream.writeInt(entry.getKey());
outputStream.writeInt(entry.getValue().size());
for (int i = 0; i < entry.getValue().size(); i++) {
TNTPoint current = entry.getValue().get(i);
if (i == 0) {
writeTNTPoint(outputStream, current, true);
continue;
}
TNTPoint last = entry.getValue().get(i - 1);
boolean writeTickData = true;
if (last.getTicksSinceStart() + 1 == current.getTicksSinceStart() && last.getFuse() - 1 == current.getFuse()) {
writeTickData = false;
}
writeTNTPoint(outputStream, current, writeTickData);
}
}
outputStream.flush(); outputStream.flush();
outputStream.close(); outputStream.close();
writeTraceRecords(trace.getRecordsSaveFile(), records);
} }
@SneakyThrows @SneakyThrows
protected static void writeTraceRecords(File recordsFile, List<TNTPoint> records) { private static void writeTNTPoint(ObjectOutputStream outputStream, TNTPoint tntPoint, boolean writeTickData) {
DataOutputStream outputStream = new DataOutputStream(new FileOutputStream(recordsFile)); byte data = 0;
for (TNTPoint record : records) { if (writeTickData) data |= WRITE_TICK_DATA;
outputStream.writeInt(record.getTntId()); if (tntPoint.isExplosion()) data |= EXPLOSION;
outputStream.writeBoolean(record.isExplosion()); if (tntPoint.isInWater()) data |= IN_WATER;
outputStream.writeBoolean(record.isInWater()); if (tntPoint.isAfterFirstExplosion()) data |= AFTER_FIRST_EXPLOSION;
outputStream.writeBoolean(record.isAfterFirstExplosion()); if (tntPoint.isDestroyedBuildArea()) data |= DESTROYED_BUILD_AREA;
outputStream.writeBoolean(record.isDestroyedBuildArea()); if (tntPoint.isDestroyedTestBlock()) data |= DESTROYED_TEST_BLOCK;
outputStream.writeBoolean(record.isDestroyedTestBlock()); outputStream.write(data);
outputStream.writeLong(record.getTicksSinceStart());
outputStream.writeInt(record.getFuse()); if (writeTickData) {
Location location = record.getLocation(); outputStream.writeLong(tntPoint.getTicksSinceStart());
outputStream.writeInt(tntPoint.getFuse());
}
Location location = tntPoint.getLocation();
outputStream.writeDouble(location.getX()); outputStream.writeDouble(location.getX());
outputStream.writeDouble(location.getY()); outputStream.writeDouble(location.getY());
outputStream.writeDouble(location.getZ()); outputStream.writeDouble(location.getZ());
Vector velocity = record.getVelocity();
Vector velocity = tntPoint.getVelocity();
outputStream.writeDouble(velocity.getX()); outputStream.writeDouble(velocity.getX());
outputStream.writeDouble(velocity.getY()); outputStream.writeDouble(velocity.getY());
outputStream.writeDouble(velocity.getZ()); outputStream.writeDouble(velocity.getZ());
} }
outputStream.flush();
outputStream.close();
}
@SneakyThrows @SneakyThrows
protected static TNTPoint readTraceRecord(DataInputStream objectInput) { protected static TNTPoint readTraceRecord(int tntId, TNTPoint last, ObjectInputStream objectInput) {
int tntId = objectInput.readInt(); int data = objectInput.read();
boolean explosion = objectInput.readBoolean(); boolean explosion = (data & EXPLOSION) > 0;
boolean inWater = objectInput.readBoolean(); boolean inWater = (data & IN_WATER) > 0;
boolean afterFirstExplosion = objectInput.readBoolean(); boolean afterFirstExplosion = (data & AFTER_FIRST_EXPLOSION) > 0;
boolean destroyedBuildArea = objectInput.readBoolean(); boolean destroyedBuildArea = (data & DESTROYED_BUILD_AREA) > 0;
boolean destroyedTestBlock = objectInput.readBoolean(); boolean destroyedTestBlock = (data & DESTROYED_TEST_BLOCK) > 0;
long ticksSinceStart = objectInput.readLong();
int fuse = objectInput.readInt(); long ticksSinceStart;
int fuse;
if ((data & WRITE_TICK_DATA) > 0) {
ticksSinceStart = objectInput.readLong();
fuse = objectInput.readInt();
} else {
ticksSinceStart = last.getTicksSinceStart() + 1;
fuse = last.getFuse() - 1;
}
double locX = objectInput.readDouble(); double locX = objectInput.readDouble();
double locY = objectInput.readDouble(); double locY = objectInput.readDouble();
@ -116,21 +146,29 @@ public class TraceRepository {
protected static List<TNTPoint> readTraceRecords(Trace trace) { protected static List<TNTPoint> readTraceRecords(Trace trace) {
File recordsFile = trace.getRecordsSaveFile(); File recordsFile = trace.getRecordsSaveFile();
@Cleanup @Cleanup
DataInputStream inputStream = new DataInputStream(new FileInputStream(recordsFile)); ObjectInputStream inputStream = new ObjectInputStream(new GZIPInputStream(new FileInputStream(recordsFile)));
inputStream.readUTF();
inputStream.readUTF();
inputStream.readObject();
inputStream.readInt();
inputStream.readInt();
List<TNTPoint> records = new ArrayList<>(); List<TNTPoint> records = new ArrayList<>();
for (int i = 0; i < trace.getRecordsCount(); i++) {
records.add(readTraceRecord(inputStream));
}
Map<Integer, List<TNTPoint>> histories = new HashMap<>(); Map<Integer, List<TNTPoint>> histories = new HashMap<>();
for (TNTPoint record : records) { for (int i = 0; i < trace.getTntIdCount(); i++) {
int tntId = record.getTntId(); int tntId = inputStream.readInt();
List<TNTPoint> history = histories.computeIfAbsent(tntId, id -> new ArrayList<>()); int size = inputStream.readInt();
history.add(record); List<TNTPoint> points = histories.computeIfAbsent(tntId, id -> new ArrayList<>());
record.setHistory(history);
}
TNTPoint last = null;
for (int j = 0; j < size; j++) {
TNTPoint point = readTraceRecord(tntId, last, inputStream);
point.setHistory(points);
points.add(point);
last = point;
records.add(point);
}
}
return records; return records;
} }
} }

View File

@ -26,6 +26,7 @@ import de.steamwar.bausystem.shared.EnumDisplay;
import de.steamwar.command.PreviousArguments; import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
@ -202,9 +203,9 @@ public class MaterialCommand extends SWCommand implements Listener {
private void searchGUI(Player p) { private void searchGUI(Player p) {
SWInventory swInventory = new SWInventory(p, 54, BauSystem.MESSAGE.parse("MATERIAL_SEARCH", p)); SWInventory swInventory = new SWInventory(p, 54, BauSystem.MESSAGE.parse("MATERIAL_SEARCH", p));
Search search = searchMap.get(p); Search search = searchMap.get(p);
swInventory.setItem(45, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("MATERIAL_BACK", p), clickType -> { swInventory.setItem(0, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("MATERIAL_BACK", p), clickType -> {
materialGUI(p); materialGUI(p);
})); }).setCustomModelData(CMDs.BACK));
swInventory.setItem(10, new SWItem(Material.NAME_TAG, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_NAME", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.name), clickType -> { swInventory.setItem(10, new SWItem(Material.NAME_TAG, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_NAME", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.name), clickType -> {
SWAnvilInv swAnvilInv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_NAME", p), search.name); SWAnvilInv swAnvilInv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_NAME", p), search.name);
swAnvilInv.setCallback(s -> { swAnvilInv.setCallback(s -> {

View File

@ -36,7 +36,7 @@ public class Warp {
public static void enable() { public static void enable() {
Warp worldSpawn = new Warp("WorldSpawn"); Warp worldSpawn = new Warp("WorldSpawn");
worldSpawn.setLocation(Bukkit.getWorlds().get(0).getSpawnLocation().clone().add(0.5, Core.getVersion() == 20 ? 124 : 1, 0.5)); worldSpawn.setLocation(Bukkit.getWorlds().get(0).getSpawnLocation().clone().add(0.5, Core.getVersion() >= 20 ? 124 : 1, 0.5));
worldSpawn.setMat(Material.NETHER_STAR); worldSpawn.setMat(Material.NETHER_STAR);
warpMap.put("WorldSpawn", worldSpawn); warpMap.put("WorldSpawn", worldSpawn);
} }

View File

@ -59,6 +59,7 @@ public class BauLockStateScoreboard implements ScoreboardElement {
public enum BauLockState { public enum BauLockState {
NOBODY, NOBODY,
SUPERVISOR,
SERVERTEAM, SERVERTEAM,
TEAM_AND_SERVERTEAM, TEAM_AND_SERVERTEAM,
TEAM, TEAM,

View File

@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.world;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import de.steamwar.sql.NodeData;
import de.steamwar.sql.SchematicData; import de.steamwar.sql.SchematicData;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
@ -65,7 +66,8 @@ public class ClipboardListener implements Listener {
} }
try { try {
new SchematicData(schematic).saveFromPlayer(e.getPlayer()); NodeData.get(schematic).forEach(NodeData::delete);
SchematicData.saveFromPlayer(e.getPlayer(), schematic);
} catch (Exception ex) { } catch (Exception ex) {
if (newSchem) { if (newSchem) {
schematic.delete(); schematic.delete();

View File

@ -179,7 +179,12 @@ public class SpectatorListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
if (event.getMessage().startsWith("/schem save") || event.getMessage().startsWith("//schem save") || event.getMessage().startsWith("/schematic save") || event.getMessage().startsWith("//schematic save")) { if (event.getMessage().startsWith("/schem save") ||
event.getMessage().startsWith("//schem save") ||
event.getMessage().startsWith("/schematic save") ||
event.getMessage().startsWith("//schematic save") ||
event.getMessage().startsWith("/download") ||
event.getMessage().startsWith("//download")) {
if (!Permission.SUPERVISOR.hasPermission(event.getPlayer())) { if (!Permission.SUPERVISOR.hasPermission(event.getPlayer())) {
event.setCancelled(true); event.setCancelled(true);
event.setMessage("/"); event.setMessage("/");

View File

@ -0,0 +1,46 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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 de.steamwar.bausystem.BauSystem;
import de.steamwar.core.VersionDependent;
import org.bukkit.event.Listener;
public interface TickManager extends Listener {
TickManager impl = VersionDependent.getVersionImpl(BauSystem.getInstance());
void setTickRate(float tickRate);
float getTickRate();
boolean canFreeze();
void setFreeze(boolean freeze);
boolean isFrozen();
void stepTicks(int ticks);
boolean isStepping();
void sprintTicks(int ticks);
boolean isSprinting();
void setBlockTpsPacket(boolean block);
long getRemainingTicks();
long getDoneTicks();
long getTotalTicks();
}

View File

@ -34,3 +34,20 @@ dependencies {
implementation(project(":BauSystem:BauSystem_20")) implementation(project(":BauSystem:BauSystem_20"))
implementation(project(":BauSystem:BauSystem_21")) implementation(project(":BauSystem:BauSystem_21"))
} }
tasks.register<DevServer>("DevBau20") {
group = "run"
description = "Run a 1.20 Dev Bau"
dependsOn(":SpigotCore:shadowJar")
dependsOn(":BauSystem:shadowJar")
dependsOn(":SchematicSystem:shadowJar")
template = "Bau20"
}
tasks.register<DevServer>("DevBau21") {
group = "run"
description = "Run a 1.21 Dev Bau"
dependsOn(":SpigotCore:shadowJar")
dependsOn(":BauSystem:shadowJar")
template = "Bau21"
}

View File

@ -22,7 +22,4 @@ plugins {
} }
dependencies { dependencies {
compileOnly(project(":SpigotCore", "default"))
compileOnly(libs.nms15)
} }

View File

@ -0,0 +1,92 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 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.data;
// Custom Model Data Constants
public interface CMDs {
// Material.ARROW
int BACK = 1;
// Material.DYE (Color 10/8)
int PREVIOUS_PAGE = 1;
// Material.DYE (Color 10/8)
int NEXT_PAGE = 2;
// BauSystem Simulator
interface Simulator {
// Material.BARRIER
int DELETE = 1;
// Material.REPEATER
int SETTINGS = 1;
// Material.ENDER_PEARL and Material.ENDER_EYE
int ENABLED_OR_DISABLED = 1;
// Material.DYE (Color 10/8)
int INCREMENT_OR_DISABLED = 3;
// Material.DYE (Color 1/8)
int DECREMENT_OR_DISABLED = 3;
// Material.LEAD
int JOIN_GROUP = 1;
// Material.ANVIL
int EDIT_ACTIVATION = 1;
// Material.QUARTZ, Material.REDSTONE, Material.GUNPOWDER
int NEW_PHASE = 1;
// Material.CALIBRATED_SCULK_SENSOR
int CREATE_STAB = 1;
// Material.CHEST
int MAKE_GROUP = 1;
}
// Schematic System
interface Schematic {
// Material.LEAD
int BACK = 2;
// Material.BUCKET
int OWN_SCHEMS = 1;
// Material.GLASS
int PUBLIC_SCHEMS = 1;
// Material.CHEST
int NEW_DIR = 2;
// Material.NAME_TAG
int FILTER = 3;
// Material.PAPER, Material.CAULDRON, Material.CLOCK
int SORT_ASCENDING = 3;
// Material.PAPER, Material.CAULDRON, Material.CLOCK
int SORT_DESCENDING = 4;
}
}

View File

@ -0,0 +1,25 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.data;
public class SyncCommands {
public static final String RELOAD_PLAYER = "reload_player";
public static final String RELOAD_EVENT = "reload_event";
}

View File

@ -0,0 +1,36 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 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.network.packets.common;
import de.steamwar.network.packets.NetworkPacket;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
import java.util.UUID;
@AllArgsConstructor
@Getter
@ToString
public class PlayerSkinRequestPacket extends NetworkPacket {
private static final long serialVersionUID = 277267302555671765L;
private UUID uuid;
}

View File

@ -0,0 +1,38 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 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.network.packets.common;
import de.steamwar.network.packets.NetworkPacket;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
import java.util.UUID;
@AllArgsConstructor
@Getter
@ToString
public class PlayerSkinResponsePacket extends NetworkPacket {
private static final long serialVersionUID = 5792855362547625112L;
private UUID uuid;
private String skin;
private String signature;
}

View File

@ -0,0 +1,37 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 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.network.packets.server;
import de.steamwar.network.packets.NetworkPacket;
import lombok.*;
import java.util.UUID;
@EqualsAndHashCode(callSuper = true)
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class ClientVersionPacket extends NetworkPacket {
private static final long serialVersionUID = 3686482311704273200L;
private UUID player;
private int version;
}

View File

@ -0,0 +1,125 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 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.sql;
import de.steamwar.sql.internal.Field;
import de.steamwar.sql.internal.SqlTypeMapper;
import de.steamwar.sql.internal.Statement;
import de.steamwar.sql.internal.Table;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NonNull;
import java.sql.Timestamp;
import java.time.Instant;
@AllArgsConstructor
public class AuditLog {
static {
SqlTypeMapper.nameEnumMapper(AuditLog.Type.class);
}
public static final String SERVER_NAME_VELOCITY = "Velocity";
private static final Table<AuditLog> table = new Table<>(AuditLog.class);
private static final Statement create = table.insertFields(true, "time", "serverName", "serverOwner", "actor", "actionType", "actionText");
@Getter
@Field
private final Timestamp time;
@Getter
@Field
private final String serverName;
@Field(nullable = true)
private final int serverOwner;
@Field
private final int actor;
@Getter
@Field
private final Type actionType;
@Getter
@Field
private final String actionText;
public enum Type {
JOIN,
LEAVE,
COMMAND,
SENSITIVE_COMMAND,
CHAT,
GUI_OPEN,
GUI_CLOSE,
GUI_CLICK,
}
private static void create(String serverName, SteamwarUser serverOwner, SteamwarUser actor, Type actionType, String text) {
create.insertGetKey(Timestamp.from(Instant.now()), serverName, serverOwner, actor, actionType, text);
}
public static void createJoin(@NonNull String jointServerName, SteamwarUser serverOwner, @NonNull SteamwarUser joinedPlayer) {
create(jointServerName, serverOwner, joinedPlayer, Type.JOIN, "");
}
public static void createLeave(@NonNull String leftServerName, SteamwarUser serverOwner, @NonNull SteamwarUser joinedPlayer) {
create(leftServerName, serverOwner, joinedPlayer, Type.LEAVE, "");
}
public static void createCommand(@NonNull String serverName, SteamwarUser serverOwner, SteamwarUser player, @NonNull String command) {
if (player == null) return;
create(serverName, serverOwner, player, Type.COMMAND, command);
}
public static void createSensitiveCommand(@NonNull String serverName, SteamwarUser serverOwner, SteamwarUser player, @NonNull String command) {
if (player == null) return;
create(serverName, serverOwner, player, Type.SENSITIVE_COMMAND, command);
}
public static void createChat(@NonNull String serverName, SteamwarUser serverOwner, @NonNull SteamwarUser chatter, @NonNull String chat) {
create(serverName, serverOwner, chatter, Type.CHAT, chat);
}
public static void createGuiOpen(@NonNull String serverName, SteamwarUser serverOwner, @NonNull SteamwarUser player, @NonNull String guiName) {
create(serverName, serverOwner, player, Type.GUI_OPEN, guiName);
}
public static void createGuiClick(@NonNull String serverName, SteamwarUser serverOwner, @NonNull SteamwarUser player, @NonNull String guiName, @NonNull String clickType, int slot, @NonNull String itemName) {
create(serverName, serverOwner, player, Type.GUI_CLICK, "Gui: " + guiName + "\nSlot: " + slot + "\nClickType: " + clickType + "\nItemName: " + itemName);
}
public static void createGuiClose(@NonNull String serverName, SteamwarUser serverOwner, @NonNull SteamwarUser player, @NonNull String guiName) {
create(serverName, serverOwner, player, Type.GUI_CLOSE, guiName);
}
public SteamwarUser getServerOwner() {
return SteamwarUser.get(serverOwner);
}
public SteamwarUser getActor() {
return SteamwarUser.get(actor);
}
}

View File

@ -28,6 +28,7 @@ import lombok.Getter;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture;
@AllArgsConstructor @AllArgsConstructor
public class CheckedSchematic { public class CheckedSchematic {
@ -37,12 +38,11 @@ public class CheckedSchematic {
private static final SelectStatement<CheckedSchematic> nodeHistory = new SelectStatement<>(table, "SELECT * FROM CheckedSchematic WHERE NodeId = ? AND DeclineReason != '' AND DeclineReason != 'Prüfvorgang abgebrochen' ORDER BY EndTime DESC"); private static final SelectStatement<CheckedSchematic> nodeHistory = new SelectStatement<>(table, "SELECT * FROM CheckedSchematic WHERE NodeId = ? AND DeclineReason != '' AND DeclineReason != 'Prüfvorgang abgebrochen' ORDER BY EndTime DESC");
private static final Statement insert = table.insertAll(); private static final Statement insert = table.insertAll();
public static void create(int nodeId, String name, int owner, int validator, Timestamp startTime, Timestamp endTime, String reason){ private static final SelectStatement<CheckedSchematic> getUnseen = new SelectStatement<>(table, "SELECT * FROM CheckedSchematic WHERE Seen = 0 AND NodeOwner = ? ORDER BY StartTime DESC");
insert.update(nodeId, owner, name, validator, startTime, endTime, reason); private static final Statement updateSeen = new Statement("UPDATE CheckedSchematic SET Seen = ? WHERE StartTime = ? AND EndTime = ? AND NodeName = ?");
}
public static void create(SchematicNode node, int validator, Timestamp startTime, Timestamp endTime, String reason){ public static void create(SchematicNode node, int validator, Timestamp startTime, Timestamp endTime, String reason, boolean seen) {
create(node.getId(), node.getName(), node.getOwner(), validator, startTime, endTime, reason); insert.update(node.getId(), node.getOwner(), node.getName(), validator, startTime, endTime, reason, seen, node.getSchemtype().toDB().substring(1));
} }
public static List<CheckedSchematic> getLastDeclinedOfNode(int node) { public static List<CheckedSchematic> getLastDeclinedOfNode(int node) {
@ -53,6 +53,10 @@ public class CheckedSchematic {
return nodeHistory.listSelect(node.getId()); return nodeHistory.listSelect(node.getId());
} }
public static List<CheckedSchematic> getUnseen(SteamwarUser owner) {
return getUnseen.listSelect(owner);
}
@Field(nullable = true) @Field(nullable = true)
private final Integer nodeId; private final Integer nodeId;
@Field @Field
@ -71,6 +75,12 @@ public class CheckedSchematic {
@Getter @Getter
@Field @Field
private final String declineReason; private final String declineReason;
@Getter
@Field
private boolean seen;
@Getter
@Field
private final String nodeType;
public int getNode() { public int getNode() {
return nodeId; return nodeId;
@ -83,4 +93,9 @@ public class CheckedSchematic {
public int getSchemOwner() { public int getSchemOwner() {
return nodeOwner; return nodeOwner;
} }
public void setSeen(boolean seen) {
this.seen = seen;
updateSeen.update(seen, startTime, endTime, nodeName);
}
} }

View File

@ -37,14 +37,18 @@ public class EventFight implements Comparable<EventFight> {
private static final Table<EventFight> table = new Table<>(EventFight.class); private static final Table<EventFight> table = new Table<>(EventFight.class);
private static final SelectStatement<EventFight> byId = table.select(Table.PRIMARY); private static final SelectStatement<EventFight> byId = table.select(Table.PRIMARY);
private static final SelectStatement<EventFight> byGroup = new SelectStatement<EventFight>(table, "SELECT * FROM EventFight WHERE GroupID = ? ORDER BY StartTime ASC");
private static final SelectStatement<EventFight> byGroupLast = new SelectStatement<EventFight>(table, "SELECT * FROM EventFight WHERE GroupID = ? ORDER BY StartTime DESC LIMIT 1");
private static final SelectStatement<EventFight> allComing = new SelectStatement<>(table, "SELECT * FROM EventFight WHERE StartTime > now() ORDER BY StartTime ASC"); private static final SelectStatement<EventFight> allComing = new SelectStatement<>(table, "SELECT * FROM EventFight WHERE StartTime > now() ORDER BY StartTime ASC");
private static final SelectStatement<EventFight> event = new SelectStatement<>(table, "SELECT * FROM EventFight WHERE EventID = ? ORDER BY StartTime ASC"); private static final SelectStatement<EventFight> event = new SelectStatement<>(table, "SELECT * FROM EventFight WHERE EventID = ? ORDER BY StartTime ASC");
private static final SelectStatement<EventFight> activeFights = new SelectStatement<>(table, "SELECT * FROM EventFight WHERE Fight IS NOT NULL AND StartTime < now() AND DATEDIFF(StartTime, now()) < 0");
private static final Statement reschedule = table.update(Table.PRIMARY, "StartTime"); private static final Statement reschedule = table.update(Table.PRIMARY, "StartTime");
private static final Statement setResult = table.update(Table.PRIMARY, "Ergebnis"); private static final Statement setResult = table.update(Table.PRIMARY, "Ergebnis");
private static final Statement setFight = table.update(Table.PRIMARY, "Fight"); private static final Statement setFight = table.update(Table.PRIMARY, "Fight");
private static final Statement create = table.insertFields(true, "eventID", "startTime", "spielmodus", "map", "teamBlue", "teamRed", "spectatePort"); private static final Statement create = table.insertFields(true, "eventID", "startTime", "spielmodus", "map", "teamBlue", "teamRed", "spectatePort");
private static final Statement update = table.update(Table.PRIMARY, "startTime", "spielModus", "map", "teamBlue", "teamRed", "spectatePort"); private static final Statement update = table.update(Table.PRIMARY, "startTime", "spielModus", "map", "teamBlue", "teamRed", "spectatePort");
private static final Statement setGroup = table.update(Table.PRIMARY, "GroupID");
private static final Statement delete = table.delete(Table.PRIMARY); private static final Statement delete = table.delete(Table.PRIMARY);
@Getter @Getter
@ -54,6 +58,14 @@ public class EventFight implements Comparable<EventFight> {
return byId.select(fightID); return byId.select(fightID);
} }
public static List<EventFight> get(EventGroup group) {
return byGroup.listSelect(group.getId());
}
public static Optional<EventFight> getLast(EventGroup group) {
return Optional.ofNullable(byGroupLast.select(group.getId()));
}
public static void loadAllComingFights() { public static void loadAllComingFights() {
fights.clear(); fights.clear();
fights.addAll(allComing.listSelect()); fights.addAll(allComing.listSelect());
@ -63,6 +75,19 @@ public class EventFight implements Comparable<EventFight> {
return event.listSelect(eventID); return event.listSelect(eventID);
} }
private static List<EventFight> activeFightsCache = null;
public static void clearActiveFightsCache() {
activeFightsCache = null;
}
public static List<EventFight> getActiveFights() {
if (activeFightsCache == null) {
activeFightsCache = activeFights.listSelect();
}
return activeFightsCache;
}
public static EventFight create(int event, Timestamp from, String spielmodus, String map, int blueTeam, int redTeam, Integer spectatePort) { public static EventFight create(int event, Timestamp from, String spielmodus, String map, int blueTeam, int redTeam, Integer spectatePort) {
return get(create.insertGetKey(event, from, spielmodus, map, blueTeam, redTeam, spectatePort)); return get(create.insertGetKey(event, from, spielmodus, map, blueTeam, redTeam, spectatePort));
} }
@ -75,6 +100,10 @@ public class EventFight implements Comparable<EventFight> {
private final int fightID; private final int fightID;
@Getter @Getter
@Setter @Setter
@Field(nullable = true, def = "null")
private Integer groupId;
@Getter
@Setter
@Field @Field
private Timestamp startTime; private Timestamp startTime;
@Getter @Getter
@ -98,11 +127,35 @@ public class EventFight implements Comparable<EventFight> {
@Field(nullable = true) @Field(nullable = true)
private Integer spectatePort; private Integer spectatePort;
@Getter @Getter
@Setter
@Field(def = "1")
private int bestOf;
@Getter
@Field(def = "0") @Field(def = "0")
private int ergebnis; private int ergebnis;
@Field(nullable = true) @Field(nullable = true)
private int fight; private int fight;
public Optional<EventGroup> getGroup() {
return Optional.ofNullable(groupId).flatMap(EventGroup::get);
}
public Optional<Team> getWinner() {
if(ergebnis == 0)
return Optional.empty();
return Optional.ofNullable(ergebnis == 1 ? Team.get(teamBlue) : Team.get(teamRed));
}
public Optional<Team> getLosser() {
if(ergebnis == 0)
return Optional.empty();
return Optional.ofNullable(ergebnis == 1 ? Team.get(teamRed) : Team.get(teamBlue));
}
public List<EventRelation> getDependents() {
return EventRelation.getFightRelations(this);
}
public void setErgebnis(int winner) { public void setErgebnis(int winner) {
this.ergebnis = winner; this.ergebnis = winner;
setResult.update(winner, fightID); setResult.update(winner, fightID);
@ -114,6 +167,11 @@ public class EventFight implements Comparable<EventFight> {
setFight.update(fight, fightID); setFight.update(fight, fightID);
} }
public void setGroup(Integer group) {
setGroup.update(group, fightID);
this.groupId = group;
}
public boolean hasFinished() { public boolean hasFinished() {
return fight != 0 || ergebnis != 0; return fight != 0 || ergebnis != 0;
} }

View File

@ -0,0 +1,173 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.sql;
import de.steamwar.sql.internal.*;
import lombok.Getter;
import lombok.Setter;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Getter
@Setter
public class EventGroup {
static {
SqlTypeMapper.ordinalEnumMapper(EventGroupType.class);
}
private static final Table<EventGroup> table = new Table<>(EventGroup.class);
private static final SelectStatement<EventGroup> get = table.select(Table.PRIMARY);
private static final SelectStatement<EventGroup> byEvent = new SelectStatement<>(table, "SELECT * FROM EventGroup WHERE EventID = ?");
private static final Statement insert = table.insertFields(true, "EventID", "Name", "Type");
private static final Statement update = table.update(Table.PRIMARY, "Name", "Type", "PointsPerWin", "PointsPerLoss", "PointsPerDraw");
private static final Statement delete = table.delete(Table.PRIMARY);
public static List<EventGroup> get(Event eventID) {
return byEvent.listSelect(eventID.getEventID());
}
public static EventGroup create(Event event, String name, EventGroupType type) {
int key = insert.insertGetKey(event.getEventID(), name, type);
return EventGroup.get(key).get();
}
public static Optional<EventGroup> get(int id) {
return Optional.ofNullable(get.select(id));
}
@Field(keys = Table.PRIMARY)
private final int id;
@Field(keys = "EVENT_NAME")
private int eventID;
@Field(keys = "EVENT_NAME")
private String name;
@Field
private EventGroupType type;
@Field
private int pointsPerWin;
@Field
private int pointsPerLoss;
@Field
private int pointsPerDraw;
public EventGroup(int id, int eventID, String name, EventGroupType type, int pointsPerWin, int pointsPerLoss, int pointsPerDraw) {
this.id = id;
this.eventID = eventID;
this.name = name;
this.type = type;
this.pointsPerWin = pointsPerWin;
this.pointsPerLoss = pointsPerLoss;
this.pointsPerDraw = pointsPerDraw;
}
private Map<Team, Integer> points;
public List<EventFight> getFights() {
return EventFight.get(this);
}
public Set<Integer> getTeamsId() {
return getFights().stream().flatMap(fight -> Stream.of(fight.getTeamBlue(), fight.getTeamRed()))
.collect(Collectors.toSet());
}
public Set<Team> getTeams() {
return getTeamsId().stream().map(Team::get).collect(Collectors.toSet());
}
public Optional<EventFight> getLastFight() {
return EventFight.getLast(this);
}
public List<EventRelation> getDependents() {
return EventRelation.getGroupRelations(this);
}
public Map<Team, Integer> calculatePoints() {
if (points == null) {
Map<Integer, Integer> p = getTeamsId().stream().collect(Collectors.toMap(team -> team, team -> 0));
for (EventFight fight : getFights()) {
int blueTeamAdd = 0;
int redTeamAdd = 0;
if (!fight.hasFinished()) {
continue;
}
switch (fight.getErgebnis()) {
case 1:
blueTeamAdd += pointsPerWin;
redTeamAdd += pointsPerLoss;
break;
case 2:
blueTeamAdd += pointsPerLoss;
redTeamAdd += pointsPerWin;
break;
case 0:
if (fight.getFightID() != 0) {
blueTeamAdd += pointsPerDraw;
redTeamAdd += pointsPerDraw;
}
break;
}
p.put(fight.getTeamBlue(), p.get(fight.getTeamBlue()) + blueTeamAdd);
p.put(fight.getTeamRed(), p.get(fight.getTeamRed()) + redTeamAdd);
}
points = p.entrySet().stream().collect(Collectors.toMap(integerIntegerEntry -> Team.get(integerIntegerEntry.getKey()), Map.Entry::getValue));
}
return points;
}
public void update(String name, EventGroupType type, int pointsPerWin, int pointsPerLoss, int pointsPerDraw) {
update.update(name, type, pointsPerWin, pointsPerLoss, pointsPerDraw, id);
this.name = name;
this.type = type;
this.pointsPerWin = pointsPerWin;
this.pointsPerLoss = pointsPerLoss;
this.pointsPerDraw = pointsPerDraw;
}
public boolean needsTieBreak() {
return calculatePoints().values().stream().sorted().limit(2).distinct().count() < 2;
}
public void delete() {
delete.update(id);
}
public static enum EventGroupType {
GROUP_STAGE,
ELIMINATION_STAGE
}
}

View File

@ -0,0 +1,192 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.sql;
import de.steamwar.sql.internal.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@AllArgsConstructor
@Getter
@Setter
public class EventRelation {
static {
SqlTypeMapper.ordinalEnumMapper(FightTeam.class);
SqlTypeMapper.ordinalEnumMapper(FromType.class);
}
private static final Table<EventRelation> table = new Table<>(EventRelation.class);
private static final SelectStatement<EventRelation> get = new SelectStatement<>(table, "SELECT * FROM EventRelation WHERE FromType = ? AND FromId = ?");
private static final SelectStatement<EventRelation> byId = new SelectStatement<>(table, "SELECT * FROM EventRelation WHERE id = ?");
private static final SelectStatement<EventRelation> byEvent = new SelectStatement<>(table, "SELECT ER.* FROM EventRelation ER JOIN EventFight EF ON EF.id = ER.fightId WHERE EF.EventID = ?");
private static final Statement insert = table.insertAll(true);
private static final Statement update = table.update(Table.PRIMARY, "fromType", "fromId", "fromPlace");
private static final Statement updateTeam = table.update(Table.PRIMARY, "fightTeam");
private static final Statement delete = table.delete(Table.PRIMARY);
public static List<EventRelation> get(Event event) {
return byId.listSelect(event.getEventID());
}
public static EventRelation get(int id) {
return byId.select(id);
}
public static List<EventRelation> getFightRelations(EventFight fight) {
return get.listSelect(FromType.FIGHT, fight.getFightID());
}
public static List<EventRelation> getGroupRelations(EventGroup group) {
return get.listSelect(FromType.GROUP, group.getId());
}
public static EventRelation create(EventFight fight, FightTeam fightTeam, FromType fromType, int fromId, int fromPlace) {
int id = insert.insertGetKey(fight.getFightID(), fightTeam, fromType, fromId, fromPlace);
return get(id);
}
@Field(keys = Table.PRIMARY)
private final int id;
@Field
private int fightId;
@Field
private FightTeam fightTeam;
@Field
private FromType fromType;
@Field
private int fromId;
@Field
private int fromPlace;
public EventFight getFight() {
return EventFight.get(fightId);
}
public Optional<EventFight> getFromFight() {
if(fromType == FromType.FIGHT) {
return Optional.of(EventFight.get(fromId));
} else {
return Optional.empty();
}
}
public Optional<EventGroup> getFromGroup() {
if(fromType == FromType.GROUP) {
return EventGroup.get(fromId);
} else {
return Optional.empty();
}
}
public void delete() {
delete.update(id);
}
public void setUpdateTeam(FightTeam team) {
updateTeam.update(id, team);
this.fightTeam = team;
}
public void setFromFight(EventFight fight, int place) {
setFrom(fight.getFightID(), place, FromType.FIGHT);
}
public void setFromGroup(EventGroup group, int place) {
setFrom(group.getId(), place, FromType.GROUP);
}
private void setFrom(int id, int place, FromType type) {
update.update(id, type, id, place);
this.fromType = type;
this.fromId = id;
this.fromPlace = place;
}
public Optional<Team> getAdvancingTeam() {
if (fromType == FromType.FIGHT) {
if (fromPlace == 0) {
return getFromFight().flatMap(EventFight::getWinner);
} else {
return getFromFight().flatMap(EventFight::getLosser);
}
} else if (fromType == FromType.GROUP) {
return getFromGroup().map(EventGroup::calculatePoints)
.flatMap(points -> points.entrySet().stream()
.sorted(Map.Entry.<Team, Integer>comparingByValue().reversed())
.skip(fromPlace)
.findFirst()
.map(Map.Entry::getKey));
} else {
return Optional.empty();
}
}
public boolean apply() {
Optional<Integer> team = getAdvancingTeam().map(Team::getTeamId);
if(!team.isPresent())
return false;
EventFight fight = getFight();
if(fightTeam == FightTeam.RED) {
fight.update(
fight.getStartTime(),
fight.getSpielmodus(),
fight.getMap(),
team.get(),
fight.getTeamBlue(),
fight.getSpectatePort()
);
} else {
fight.update(
fight.getStartTime(),
fight.getSpielmodus(),
fight.getMap(),
fight.getTeamRed(),
team.get(),
fight.getSpectatePort()
);
}
return true;
}
public static enum FightTeam {
RED,
BLUE
}
public static enum FromType {
FIGHT,
GROUP
}
}

View File

@ -35,7 +35,8 @@ import java.util.stream.Collectors;
public class Fight { public class Fight {
private static final Table<Fight> table = new Table<>(Fight.class); private static final Table<Fight> table = new Table<>(Fight.class);
private static final SelectStatement<Fight> getPage = new SelectStatement<>(table, "SELECT f.*, (b.NodeId IS NULL OR b.AllowReplay) AND (r.NodeId IS NULL OR r.AllowReplay) AS ReplayAllowed FROM Fight f LEFT OUTER JOIN SchematicNode b ON f.BlueSchem = b.NodeId LEFT OUTER JOIN SchematicNode r ON f.RedSchem = r.NodeId ORDER BY FightID DESC LIMIT ?, ?"); private static final SelectStatement<Fight> getPage = new SelectStatement<>(table, "SELECT f.*, (b.NodeId IS NULL OR b.Config & 2) AND (r.NodeId IS NULL OR r.Config & 2) AS ReplayAllowed FROM Fight f LEFT OUTER JOIN SchematicNode b ON f.BlueSchem = b.NodeId LEFT OUTER JOIN SchematicNode r ON f.RedSchem = r.NodeId ORDER BY FightID DESC LIMIT ?, ?");
private static final SelectStatement<Fight> getById = new SelectStatement<>(table, "SELECT f.*, (b.NodeId IS NULL OR b.Config & 2) AND (r.NodeId IS NULL OR r.Config & 2) AS ReplayAllowed FROM Fight f LEFT OUTER JOIN SchematicNode b ON f.BlueSchem = b.NodeId LEFT OUTER JOIN SchematicNode r ON f.RedSchem = r.NodeId WHERE FightId = ?");
private static final Statement insert = table.insertFields(true, "GameMode", "Server", "StartTime", "Duration", "BlueLeader", "RedLeader", "BlueSchem", "RedSchem", "Win", "WinCondition"); private static final Statement insert = table.insertFields(true, "GameMode", "Server", "StartTime", "Duration", "BlueLeader", "RedLeader", "BlueSchem", "RedSchem", "Win", "WinCondition");
private static final Statement updateReplayAvailable = table.update(Table.PRIMARY, "ReplayAvailable"); private static final Statement updateReplayAvailable = table.update(Table.PRIMARY, "ReplayAvailable");
@ -51,6 +52,10 @@ public class Fight {
return fights; return fights;
} }
public static Fight getById(int fightID) {
return getById.select(fightID);
}
public static int create(String gamemode, String server, Timestamp starttime, int duration, int blueleader, int redleader, Integer blueschem, Integer redschem, int win, String wincondition){ public static int create(String gamemode, String server, Timestamp starttime, int duration, int blueleader, int redleader, Integer blueschem, Integer redschem, int win, String wincondition){
return insert.insertGetKey(gamemode, server, starttime, duration, blueleader, redleader, blueschem, redschem, win, wincondition); return insert.insertGetKey(gamemode, server, starttime, duration, blueleader, redleader, blueschem, redschem, win, wincondition);
} }

View File

@ -23,8 +23,13 @@ import de.steamwar.sql.internal.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import javax.swing.plaf.nimbus.State;
import java.io.*; import java.io.*;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.Timestamp;
import java.time.Instant;
import java.util.List;
import java.util.Optional;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
@AllArgsConstructor @AllArgsConstructor
@ -40,26 +45,47 @@ public class NodeData {
private static final Table<NodeData> table = new Table<>(NodeData.class); private static final Table<NodeData> table = new Table<>(NodeData.class);
private static final Statement updateDatabase = new Statement("INSERT INTO NodeData(NodeId, NodeFormat, SchemData) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE NodeFormat = VALUES(NodeFormat), SchemData = VALUES(SchemData)"); private static final Statement updateDatabase = new Statement("INSERT INTO NodeData(NodeId, NodeFormat, SchemData) VALUES (?, ?, ?)", true);
private static final Statement selSchemData = new Statement("SELECT SchemData FROM NodeData WHERE NodeId = ?"); private static final Statement selSchemData = new Statement("SELECT SchemData FROM NodeData WHERE NodeId = ? AND CreatedAt = ?");
private static final Statement delete = table.delete(Table.PRIMARY);
private static final SelectStatement<NodeData> get = table.select(Table.PRIMARY); private static final SelectStatement<NodeData> get = new SelectStatement<>(table, "SELECT NodeId, CreatedAt, NodeFormat FROM NodeData WHERE NodeId = ? ORDER BY CreatedAt ");
private static final Statement getRevisions = new Statement("SELECT COUNT(DISTINCT CreatedAt) as CNT FROM NodeData WHERE NodeId = ?");
private static final SelectStatement<NodeData> getLatest = new SelectStatement<>(table, "SELECT NodeId, CreatedAt, NodeFormat FROM NodeData WHERE NodeId = ? ORDER BY CreatedAt DESC LIMIT 1");
public static NodeData get(SchematicNode node) { public static NodeData getLatest(SchematicNode node) {
if(node.isDir()) if (node.isDir()) throw new IllegalArgumentException("Node is dir");
throw new IllegalArgumentException("Node is a directory"); return Optional.ofNullable(getLatest.select(node)).orElseGet(() -> new NodeData(node.getId(), Timestamp.from(Instant.now()), SchematicFormat.MCEDIT));
return get.select(rs -> { }
public static List<NodeData> get(SchematicNode node) {
return get.listSelect(node);
}
public static NodeData get(SchematicNode node, int revision) {
return get.listSelect(node).get(revision - 1);
}
public static int getRevisions(SchematicNode node) {
return getRevisions.select(rs -> {
if (rs.next()) { if (rs.next()) {
return new NodeData(node.getId(), SchematicFormat.values()[rs.getInt("NodeFormat")]); return rs.getInt("CNT");
} else { } else {
return new NodeData(node.getId(), SchematicFormat.MCEDIT); return 0;
} }
}, node); }, node);
} }
public static void saveFromStream(SchematicNode node, InputStream blob, SchematicFormat format) {
updateDatabase.update(node.getId(), format, blob);
}
@Field(keys = {Table.PRIMARY}) @Field(keys = {Table.PRIMARY})
private final int nodeId; private final int nodeId;
@Field(keys = {Table.PRIMARY})
private Timestamp createdAt;
@Field @Field
private SchematicFormat nodeFormat; private SchematicFormat nodeFormat;
@ -84,15 +110,19 @@ public class NodeData {
} catch (IOException e) { } catch (IOException e) {
throw new SecurityException("SchemData is wrong", e); throw new SecurityException("SchemData is wrong", e);
} }
}, nodeId); }, nodeId, createdAt);
} catch (Exception e) { } catch (Exception e) {
throw new IOException(e); throw new IOException(e);
} }
} }
@Deprecated
public void saveFromStream(InputStream blob, SchematicFormat newFormat) { public void saveFromStream(InputStream blob, SchematicFormat newFormat) {
updateDatabase.update(nodeId, newFormat, blob); saveFromStream(SchematicNode.getSchematicNode(nodeId), blob, newFormat);
nodeFormat = newFormat; }
public void delete() {
delete.update(nodeId, createdAt);
} }
@AllArgsConstructor @AllArgsConstructor

View File

@ -42,13 +42,13 @@ public class SchematicNode {
TAB_CACHE.clear(); TAB_CACHE.clear();
} }
private static final String nodeSelector = "SELECT NodeId, NodeOwner, NodeOwner AS EffectiveOwner, NodeName, ParentNode, LastUpdate, NodeItem, NodeType, NodeRank, ReplaceColor, AllowReplay FROM SchematicNode "; private static final String nodeSelector = "SELECT NodeId, NodeOwner, NodeOwner AS EffectiveOwner, NodeName, ParentNode, LastUpdate, NodeItem, NodeType, NodeRank, Config FROM SchematicNode ";
private static final Table<SchematicNode> table = new Table<>(SchematicNode.class); private static final Table<SchematicNode> table = new Table<>(SchematicNode.class);
private static final Statement create = table.insertFields(true, "NodeOwner", "NodeName", "ParentNode", "NodeItem", private static final Statement create = table.insertFields(true, "NodeOwner", "NodeName", "ParentNode", "NodeItem",
"NodeType"); "NodeType");
private static final Statement update = table.update(Table.PRIMARY, "NodeName", "ParentNode", "NodeItem", private static final Statement update = table.update(Table.PRIMARY, "NodeName", "ParentNode", "NodeItem",
"NodeType", "NodeRank", "ReplaceColor", "AllowReplay"); "NodeType", "NodeRank", "Config");
private static final Statement delete = table.delete(Table.PRIMARY); private static final Statement delete = table.delete(Table.PRIMARY);
private static final SelectStatement<SchematicNode> byId = new SelectStatement<>(table, private static final SelectStatement<SchematicNode> byId = new SelectStatement<>(table,
@ -66,13 +66,13 @@ public class SchematicNode {
private static final SelectStatement<SchematicNode> all = new SelectStatement<>(table, private static final SelectStatement<SchematicNode> all = new SelectStatement<>(table,
"WITH RECURSIVE Nodes AS (SELECT NodeId, ParentId as ParentNode FROM NodeMember WHERE UserId = ? UNION SELECT NodeId, ParentNode FROM SchematicNode WHERE NodeOwner = ?), RSN AS ( SELECT NodeId, ParentNode FROM Nodes UNION SELECT SN.NodeId, SN.ParentNode FROM SchematicNode SN, RSN WHERE SN.ParentNode = RSN.NodeId ) SELECT SN.*, ? AS EffectiveOwner FROM RSN INNER JOIN SchematicNode SN ON RSN.NodeId = SN.NodeId"); "WITH RECURSIVE Nodes AS (SELECT NodeId, ParentId as ParentNode FROM NodeMember WHERE UserId = ? UNION SELECT NodeId, ParentNode FROM SchematicNode WHERE NodeOwner = ?), RSN AS ( SELECT NodeId, ParentNode FROM Nodes UNION SELECT SN.NodeId, SN.ParentNode FROM SchematicNode SN, RSN WHERE SN.ParentNode = RSN.NodeId ) SELECT SN.*, ? AS EffectiveOwner FROM RSN INNER JOIN SchematicNode SN ON RSN.NodeId = SN.NodeId");
private static final SelectStatement<SchematicNode> list = new SelectStatement<>(table, private static final SelectStatement<SchematicNode> list = new SelectStatement<>(table,
"SELECT SchematicNode.NodeId, NodeOwner, ? AS EffectiveOwner, NodeName, NM.ParentId AS ParentNode, LastUpdate, NodeItem, NodeType, NodeRank, ReplaceColor, AllowReplay FROM SchematicNode INNER JOIN NodeMember NM on SchematicNode.NodeId = NM.NodeId WHERE NM.ParentId " "SELECT SchematicNode.NodeId, NodeOwner, ? AS EffectiveOwner, NodeName, NM.ParentId AS ParentNode, LastUpdate, NodeItem, NodeType, NodeRank, Config FROM SchematicNode INNER JOIN NodeMember NM on SchematicNode.NodeId = NM.NodeId WHERE NM.ParentId "
+ Statement.NULL_SAFE_EQUALS + Statement.NULL_SAFE_EQUALS
+ "? AND NM.UserId = ? UNION ALL SELECT SchematicNode.NodeId, NodeOwner, ? AS EffectiveOwner, NodeName, ParentNode, LastUpdate, NodeItem, NodeType, NodeRank, ReplaceColor, AllowReplay FROM SchematicNode WHERE (? IS NULL AND ParentNode IS NULL AND NodeOwner = ?) OR (? IS NOT NULL AND ParentNode = ?) ORDER BY NodeName"); + "? AND NM.UserId = ? UNION ALL SELECT SchematicNode.NodeId, NodeOwner, ? AS EffectiveOwner, NodeName, ParentNode, LastUpdate, NodeItem, NodeType, NodeRank, Config FROM SchematicNode WHERE (? IS NULL AND ParentNode IS NULL AND NodeOwner = ?) OR (? IS NOT NULL AND ParentNode = ?) ORDER BY NodeName");
private static final SelectStatement<SchematicNode> byParentName = new SelectStatement<>(table, private static final SelectStatement<SchematicNode> byParentName = new SelectStatement<>(table,
"SELECT SchematicNode.NodeId, NodeOwner, ? AS EffectiveOwner, NodeName, NM.ParentId AS ParentNode, LastUpdate, NodeItem, NodeType, NodeRank, ReplaceColor, AllowReplay FROM SchematicNode INNER JOIN NodeMember NM on SchematicNode.NodeId = NM.NodeId WHERE NM.ParentId " "SELECT SchematicNode.NodeId, NodeOwner, ? AS EffectiveOwner, NodeName, NM.ParentId AS ParentNode, LastUpdate, NodeItem, NodeType, NodeRank, Config FROM SchematicNode INNER JOIN NodeMember NM on SchematicNode.NodeId = NM.NodeId WHERE NM.ParentId "
+ Statement.NULL_SAFE_EQUALS + Statement.NULL_SAFE_EQUALS
+ "? AND NM.UserId = ? AND SchematicNode.NodeName = ? UNION ALL SELECT SchematicNode.NodeId, NodeOwner, ? AS EffectiveOwner, NodeName, ParentNode, LastUpdate, NodeItem, NodeType, NodeRank, ReplaceColor, AllowReplay FROM SchematicNode WHERE ((? IS NULL AND ParentNode IS NULL AND NodeOwner = ?) OR (? IS NOT NULL AND ParentNode = ?)) AND NodeName = ?"); + "? AND NM.UserId = ? AND SchematicNode.NodeName = ? UNION ALL SELECT SchematicNode.NodeId, NodeOwner, ? AS EffectiveOwner, NodeName, ParentNode, LastUpdate, NodeItem, NodeType, NodeRank, Config FROM SchematicNode WHERE ((? IS NULL AND ParentNode IS NULL AND NodeOwner = ?) OR (? IS NOT NULL AND ParentNode = ?)) AND NodeName = ?");
private static final SelectStatement<SchematicNode> schematicAccessibleForUser = new SelectStatement<>(table, private static final SelectStatement<SchematicNode> schematicAccessibleForUser = new SelectStatement<>(table,
"WITH RECURSIVE Nodes AS (SELECT NodeId, ParentId as ParentNode FROM NodeMember WHERE UserId = ? UNION SELECT NodeId, ParentNode FROM SchematicNode WHERE NodeOwner = ?), RSN AS ( SELECT NodeId, ParentNode FROM Nodes UNION SELECT SN.NodeId, SN.ParentNode FROM SchematicNode SN, RSN WHERE SN.ParentNode = RSN.NodeId ) SELECT SN.*, ? AS EffectiveOwner FROM RSN INNER JOIN SchematicNode SN ON RSN.NodeId = SN.NodeId WHERE NodeId = ?"); "WITH RECURSIVE Nodes AS (SELECT NodeId, ParentId as ParentNode FROM NodeMember WHERE UserId = ? UNION SELECT NodeId, ParentNode FROM SchematicNode WHERE NodeOwner = ?), RSN AS ( SELECT NodeId, ParentNode FROM Nodes UNION SELECT SN.NodeId, SN.ParentNode FROM SchematicNode SN, RSN WHERE SN.ParentNode = RSN.NodeId ) SELECT SN.*, ? AS EffectiveOwner FROM RSN INNER JOIN SchematicNode SN ON RSN.NodeId = SN.NodeId WHERE NodeId = ?");
private static final SelectStatement<SchematicNode> accessibleByUserTypeInParent = new SelectStatement<>(table, private static final SelectStatement<SchematicNode> accessibleByUserTypeInParent = new SelectStatement<>(table,
@ -81,7 +81,7 @@ public class SchematicNode {
private static final SelectStatement<SchematicNode> accessibleByUserType = new SelectStatement<>(table, private static final SelectStatement<SchematicNode> accessibleByUserType = new SelectStatement<>(table,
"WITH RECURSIVE Nodes AS (SELECT NodeId, ParentId as ParentNode FROM NodeMember WHERE UserId = ? UNION SELECT NodeId, ParentNode FROM SchematicNode WHERE NodeOwner = ?), RSN AS ( SELECT NodeId, ParentNode FROM Nodes UNION SELECT SN.NodeId, SN.ParentNode FROM SchematicNode SN, RSN WHERE SN.ParentNode = RSN.NodeId ) SELECT SN.*, ? AS EffectiveOwner FROM RSN INNER JOIN SchematicNode SN ON RSN.NodeId = SN.NodeId WHERE NodeType = ?"); "WITH RECURSIVE Nodes AS (SELECT NodeId, ParentId as ParentNode FROM NodeMember WHERE UserId = ? UNION SELECT NodeId, ParentNode FROM SchematicNode WHERE NodeOwner = ?), RSN AS ( SELECT NodeId, ParentNode FROM Nodes UNION SELECT SN.NodeId, SN.ParentNode FROM SchematicNode SN, RSN WHERE SN.ParentNode = RSN.NodeId ) SELECT SN.*, ? AS EffectiveOwner FROM RSN INNER JOIN SchematicNode SN ON RSN.NodeId = SN.NodeId WHERE NodeType = ?");
private static final SelectStatement<SchematicNode> byIdAndUser = new SelectStatement<>(table, private static final SelectStatement<SchematicNode> byIdAndUser = new SelectStatement<>(table,
"SELECT NodeId, NodeOwner, ? AS EffectiveOwner, NodeName, ParentNode, LastUpdate, NodeItem, NodeType, NodeRank, ReplaceColor, AllowReplay FROM SchematicNode WHERE NodeId = ?"); "SELECT NodeId, NodeOwner, ? AS EffectiveOwner, NodeName, ParentNode, LastUpdate, NodeItem, NodeType, NodeRank, Config FROM SchematicNode WHERE NodeId = ?");
private static final SelectStatement<SchematicNode> allParentsOfNode = new SelectStatement<>(table, private static final SelectStatement<SchematicNode> allParentsOfNode = new SelectStatement<>(table,
"WITH RECURSIVE R AS (SELECT NodeId, ParentNode FROM EffectiveSchematicNode WHERE NodeId = ? AND EffectiveOwner = ? UNION SELECT E.NodeId, E.ParentNode FROM R, EffectiveSchematicNode E WHERE R.ParentNode = E.NodeId AND E.EffectiveOwner = ?) SELECT SN.NodeId, SN.NodeOwner, ? AS EffectiveOwner, SN.NodeName, R.ParentNode, SN.LastUpdate, SN.NodeItem, SN.NodeType, SN.NodeRank, SN.ReplaceColor, SN.AllowReplay FROM R INNER JOIN SchematicNode SN ON SN.NodeId = R.NodeId"); "WITH RECURSIVE R AS (SELECT NodeId, ParentNode FROM EffectiveSchematicNode WHERE NodeId = ? AND EffectiveOwner = ? UNION SELECT E.NodeId, E.ParentNode FROM R, EffectiveSchematicNode E WHERE R.ParentNode = E.NodeId AND E.EffectiveOwner = ?) SELECT SN.NodeId, SN.NodeOwner, ? AS EffectiveOwner, SN.NodeName, R.ParentNode, SN.LastUpdate, SN.NodeItem, SN.NodeType, SN.NodeRank, SN.ReplaceColor, SN.AllowReplay FROM R INNER JOIN SchematicNode SN ON SN.NodeId = R.NodeId");
@ -108,10 +108,8 @@ public class SchematicNode {
private SchematicType nodeType; private SchematicType nodeType;
@Field(def = "0") @Field(def = "0")
private int nodeRank; private int nodeRank;
@Field(def = "1") @Field
private boolean replaceColor; private int config;
@Field(def = "1")
private boolean allowReplay;
private String brCache; private String brCache;
@ -125,8 +123,7 @@ public class SchematicNode {
String nodeItem, String nodeItem,
SchematicType nodeType, SchematicType nodeType,
int nodeRank, int nodeRank,
boolean replaceColor, int config) {
boolean allowReplay) {
this.nodeId = nodeId; this.nodeId = nodeId;
this.nodeOwner = nodeOwner; this.nodeOwner = nodeOwner;
this.effectiveOwner = effectiveOwner; this.effectiveOwner = effectiveOwner;
@ -136,8 +133,7 @@ public class SchematicNode {
this.nodeType = nodeType; this.nodeType = nodeType;
this.lastUpdate = lastUpdate; this.lastUpdate = lastUpdate;
this.nodeRank = nodeRank; this.nodeRank = nodeRank;
this.replaceColor = replaceColor; this.config = config;
this.allowReplay = allowReplay;
} }
public static List<SchematicNode> getAll(SteamwarUser user) { public static List<SchematicNode> getAll(SteamwarUser user) {
@ -407,7 +403,7 @@ public class SchematicNode {
public String getFileEnding() { public String getFileEnding() {
if (isDir()) if (isDir())
throw new SecurityException("Node is Directory"); throw new SecurityException("Node is Directory");
return NodeData.get(this).getNodeFormat().getFileEnding(); return NodeData.getLatest(this).getNodeFormat().getFileEnding();
} }
public int getRank() { public int getRank() {
@ -441,24 +437,45 @@ public class SchematicNode {
} }
public boolean replaceColor() { public boolean replaceColor() {
return replaceColor; return getConfig(ConfigFlags.REPLACE_COLOR);
} }
public void setReplaceColor(boolean replaceColor) { public void setReplaceColor(boolean replaceColor) {
if (isDir()) if (isDir())
throw new SecurityException("Is Directory"); throw new SecurityException("Is Directory");
this.replaceColor = replaceColor; setConfig(ConfigFlags.REPLACE_COLOR, replaceColor);
updateDB();
} }
public boolean allowReplay() { public boolean allowReplay() {
return allowReplay; return getConfig(ConfigFlags.ALLOW_REPLAY);
} }
public void setAllowReplay(boolean allowReplay) { public void setAllowReplay(boolean allowReplay) {
if (isDir()) if (isDir())
throw new SecurityException("Is Directory"); throw new SecurityException("Is Directory");
this.allowReplay = allowReplay; setConfig(ConfigFlags.ALLOW_REPLAY, allowReplay);
}
public boolean isPrepared() {
return getConfig(ConfigFlags.IS_PREPARED);
}
public void setPrepared(boolean prepared) {
if (isDir())
throw new SecurityException("Is Directory");
setConfig(ConfigFlags.IS_PREPARED, prepared);
}
public boolean getConfig(ConfigFlags flag) {
return (config & (1 << flag.ordinal())) != 0;
}
public void setConfig(ConfigFlags flag, boolean value) {
if (value) {
config |= (1 << flag.ordinal());
} else {
config &= ~(1 << flag.ordinal());
}
updateDB(); updateDB();
} }
@ -486,7 +503,7 @@ public class SchematicNode {
private void updateDB() { private void updateDB() {
this.lastUpdate = Timestamp.from(Instant.now()); this.lastUpdate = Timestamp.from(Instant.now());
update.update(nodeName, parentNode, nodeItem, nodeType, nodeRank, replaceColor, allowReplay, nodeId); update.update(nodeName, parentNode, nodeItem, nodeType, nodeRank, config, nodeId);
TAB_CACHE.clear(); TAB_CACHE.clear();
} }
@ -608,4 +625,10 @@ public class SchematicNode {
TAB_CACHE.computeIfAbsent(user.getId(), integer -> new HashMap<>()).putIfAbsent(cacheKey, list); TAB_CACHE.computeIfAbsent(user.getId(), integer -> new HashMap<>()).putIfAbsent(cacheKey, list);
return list; return list;
} }
public static enum ConfigFlags {
REPLACE_COLOR,
ALLOW_REPLAY,
IS_PREPARED
}
} }

View File

@ -1,94 +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.sql;
import de.steamwar.sql.internal.Field;
import de.steamwar.sql.internal.SelectStatement;
import de.steamwar.sql.internal.Statement;
import de.steamwar.sql.internal.Table;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.List;
import java.util.stream.Collectors;
@AllArgsConstructor
public class Tutorial {
private static final Table<Tutorial> table = new Table<>(Tutorial.class);
private static final SelectStatement<Tutorial> by_popularity = new SelectStatement<>(table, "SELECT t.*, AVG(r.Stars) AS Stars FROM Tutorial t LEFT OUTER JOIN TutorialRating r ON t.TutorialID = r.TutorialID WHERE t.Released = ? GROUP BY t.TutorialID ORDER BY SUM(r.Stars) DESC LIMIT ?, ?");
private static final SelectStatement<Tutorial> own = new SelectStatement<>(table, "SELECT t.*, AVG(r.Stars) AS Stars FROM Tutorial t LEFT OUTER JOIN TutorialRating r ON t.TutorialID = r.TutorialID WHERE t.Creator = ? GROUP BY t.TutorialID ORDER BY t.TutorialID ASC LIMIT ?, ?");
private static final SelectStatement<Tutorial> by_creator_name = new SelectStatement<>(table, "SELECT t.*, AVG(r.Stars) AS Stars FROM Tutorial t LEFT OUTER JOIN TutorialRating r ON t.TutorialID = r.TutorialID WHERE t.Creator = ? AND t.Name = ? GROUP BY t.TutorialID");
private static final SelectStatement<Tutorial> by_id = new SelectStatement<>(table, "SELECT t.*, AVG(r.Stars) AS Stars FROM Tutorial t LEFT OUTER JOIN TutorialRating r ON t.TutorialID = r.TutorialID WHERE t.TutorialID = ? GROUP BY t.TutorialID");
private static final Statement rate = new Statement("INSERT INTO TutorialRating (TutorialID, UserID, Stars) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE Stars = VALUES(Stars)");
private static final Statement create = new Statement("INSERT INTO Tutorial (Creator, Name, Item) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE Item = VALUES(Item), Released = 0");
private static final Statement release = table.update(Table.PRIMARY, "released");
private static final Statement delete = table.delete(Table.PRIMARY);
public static List<Tutorial> getPage(int page, int elementsPerPage, boolean released) {
List<Tutorial> tutorials = by_popularity.listSelect(released, page * elementsPerPage, elementsPerPage);
SteamwarUser.batchCache(tutorials.stream().map(tutorial -> tutorial.creator).collect(Collectors.toSet()));
return tutorials;
}
public static List<Tutorial> getOwn(int user, int page, int elementsPerPage) {
return own.listSelect(user, page * elementsPerPage, elementsPerPage);
}
public static Tutorial create(int creator, String name, String item) {
create.update(creator, name, item);
return by_creator_name.select(creator, name);
}
public static Tutorial get(int id) {
return by_id.select(id);
}
@Getter
@Field(keys = {Table.PRIMARY}, autoincrement = true)
private final int tutorialId;
@Getter
@Field(keys = {"CreatorName"})
private final int creator;
@Getter
@Field(keys = {"CreatorName"})
private final String name;
@Getter
@Field(def = "'BOOK'")
private final String item;
@Getter
@Field(def = "0")
private final boolean released;
@Getter
@Field(def = "0") // Not really a field, but necessary for select generation
private final double stars;
public void release() {
release.update(1, tutorialId);
}
public void delete() {
delete.update(tutorialId);
}
public void rate(int user, int rating) {
rate.update(tutorialId, user, rating);
}
}

View File

@ -48,18 +48,19 @@ public enum UserPerm {
public static final Map<UserPerm, Prefix> prefixes; public static final Map<UserPerm, Prefix> prefixes;
public static final Prefix emptyPrefix; public static final Prefix emptyPrefix;
static { static {
// https://www.digminecraft.com/lists/color_list_pc.php
SqlTypeMapper.nameEnumMapper(UserPerm.class); SqlTypeMapper.nameEnumMapper(UserPerm.class);
Map<UserPerm, Prefix> p = new EnumMap<>(UserPerm.class); Map<UserPerm, Prefix> p = new EnumMap<>(UserPerm.class);
emptyPrefix = new Prefix("§7", ""); emptyPrefix = new Prefix("§7", "");
p.put(PREFIX_NONE, emptyPrefix); p.put(PREFIX_NONE, emptyPrefix);
p.put(PREFIX_YOUTUBER, new Prefix("§7", "YT")); p.put(PREFIX_YOUTUBER, new Prefix("§7", "YT"));
p.put(PREFIX_GUIDE, new Prefix("§a", "Guide")); p.put(PREFIX_GUIDE, new Prefix("§x§e§7§6§2§e§d", "Guide")); // E762ED
p.put(PREFIX_SUPPORTER, new Prefix("§6", "Sup")); p.put(PREFIX_SUPPORTER, new Prefix("§x§6§0§9§5§F§B", "Sup")); // 6095FB
p.put(PREFIX_MODERATOR, new Prefix("§6", "Mod")); p.put(PREFIX_MODERATOR, new Prefix("§x§F§F§A§2§5§C", "Mod")); // FFA25C
p.put(PREFIX_BUILDER, new Prefix("§e", "Arch")); p.put(PREFIX_BUILDER, new Prefix("§x§6§0§F§F§6§A", "Arch")); // 60FF6A
p.put(PREFIX_DEVELOPER, new Prefix("§e", "Dev")); p.put(PREFIX_DEVELOPER, new Prefix("§x§0§B§B§C§B§3", "Dev")); // 0BBCB3
p.put(PREFIX_ADMIN, new Prefix("§e", "Admin")); p.put(PREFIX_ADMIN, new Prefix("§x§F§F§2§B§2§4", "Admin")); // FF2B24
prefixes = Collections.unmodifiableMap(p); prefixes = Collections.unmodifiableMap(p);
} }

View File

@ -24,4 +24,5 @@ plugins {
dependencies { dependencies {
api(project(":CommonCore:SQL")) api(project(":CommonCore:SQL"))
api(project(":CommonCore:Network")) api(project(":CommonCore:Network"))
api(project(":CommonCore:Data"))
} }

View File

@ -145,6 +145,6 @@ public class WorldeditWrapper14 implements WorldeditWrapper {
throw new SecurityException(e); throw new SecurityException(e);
} }
new SchematicData(schem).saveFromBytes(outputStream.toByteArray(), NodeData.SchematicFormat.SPONGE_V2); SchematicData.saveFromBytes(schem, outputStream.toByteArray(), NodeData.SchematicFormat.SPONGE_V2);
} }
} }

View File

@ -25,6 +25,6 @@ public class CraftbukkitWrapper21 extends CraftbukkitWrapper18 {
@Override @Override
public float headRotation(Entity e) { public float headRotation(Entity e) {
return getEntity(e).bS(); return getEntity(e).getYHeadRot();
} }
} }

View File

@ -20,10 +20,7 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.NBTInputStream;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
@ -143,6 +140,6 @@ public class WorldeditWrapper8 implements WorldeditWrapper {
throw new SecurityException(e); throw new SecurityException(e);
} }
new SchematicData(schem).saveFromBytes(outputStream.toByteArray(), NodeData.SchematicFormat.MCEDIT); SchematicData.saveFromBytes(schem, outputStream.toByteArray(), NodeData.SchematicFormat.MCEDIT);
} }
} }

View File

@ -59,6 +59,7 @@ public class Config {
public static final Region RedExtendRegion; public static final Region RedExtendRegion;
public static final Region ArenaRegion; public static final Region ArenaRegion;
public static final Region PlayerRegion; public static final Region PlayerRegion;
public static final Region BlueInsetRegion;
public static final Location TeamBlueSpawn; public static final Location TeamBlueSpawn;
public static final Location TeamRedSpawn; public static final Location TeamRedSpawn;
@ -107,6 +108,7 @@ public class Config {
public static final boolean PercentEntern; public static final boolean PercentEntern;
public static final boolean PercentBlocksWhitelist; public static final boolean PercentBlocksWhitelist;
public static final Set<Material> PercentBlocks; public static final Set<Material> PercentBlocks;
public static final int TechKoTime;
//default kits //default kits
public static final String MemberDefault; public static final String MemberDefault;
@ -193,6 +195,11 @@ public class Config {
ReplaceWithBlockupdates = config.getBoolean("Schematic.ReplaceWithBlockupdates", false); ReplaceWithBlockupdates = config.getBoolean("Schematic.ReplaceWithBlockupdates", false);
UnlimitedPrepare = config.getBoolean("Schematic.UnlimitedPrepare", false); UnlimitedPrepare = config.getBoolean("Schematic.UnlimitedPrepare", false);
int schemInsetX = config.getInt("Schematic.Inset.x", 0);
int schemInsetZ = config.getInt("Schematic.Inset.z", 0);
int schemInsetBottom = config.getInt("Schematic.Inset.bottom", 0);
int schemInsetTop = config.getInt("Schematic.Inset.top", 0);
GameName = config.getString("GameName", "WarGear"); GameName = config.getString("GameName", "WarGear");
TeamChatDetection = config.getString("TeamChatPrefix", "+"); TeamChatDetection = config.getString("TeamChatPrefix", "+");
@ -203,6 +210,7 @@ public class Config {
PercentEntern = config.getBoolean("WinConditionParams.PercentEntern", true); PercentEntern = config.getBoolean("WinConditionParams.PercentEntern", true);
PercentBlocksWhitelist = config.getBoolean("WinConditionParams.BlocksWhitelist", false); PercentBlocksWhitelist = config.getBoolean("WinConditionParams.BlocksWhitelist", false);
PercentBlocks = Collections.unmodifiableSet(config.getStringList("WinConditionParams.Blocks").stream().map(Material::valueOf).collect(Collectors.toSet())); PercentBlocks = Collections.unmodifiableSet(config.getStringList("WinConditionParams.Blocks").stream().map(Material::valueOf).collect(Collectors.toSet()));
TechKoTime = config.getInt("WinConditionParams.TechKoTime", 90);
EnterStages = Collections.unmodifiableList(config.getIntegerList("EnterStages")); EnterStages = Collections.unmodifiableList(config.getIntegerList("EnterStages"));
AllowMissiles = config.getBoolean("Arena.AllowMissiles", !EnterStages.isEmpty()); AllowMissiles = config.getBoolean("Arena.AllowMissiles", !EnterStages.isEmpty());
@ -318,6 +326,8 @@ public class Config {
ArenaRegion = Region.withExtension(arenaMinX, blueCornerY, arenaMinZ, arenaMaxX - arenaMinX, schemsizeY, arenaMaxZ - arenaMinZ, 0, PreperationArea, 0); ArenaRegion = Region.withExtension(arenaMinX, blueCornerY, arenaMinZ, arenaMaxX - arenaMinX, schemsizeY, arenaMaxZ - arenaMinZ, 0, PreperationArea, 0);
PlayerRegion = new Region(arenaMinX, underBorder, arenaMinZ, arenaMaxX, world.getMaxHeight(), arenaMaxZ); PlayerRegion = new Region(arenaMinX, underBorder, arenaMinZ, arenaMaxX, world.getMaxHeight(), arenaMaxZ);
BlueInsetRegion = new Region(BluePasteRegion.getMinX() + schemInsetX, BluePasteRegion.getMinY() + schemInsetBottom, BluePasteRegion.getMinZ() + schemInsetZ, BluePasteRegion.getMaxX() - schemInsetX, BluePasteRegion.getMaxY() - schemInsetTop, BluePasteRegion.getMaxZ() - schemInsetZ);
int eventKampfID = Integer.parseInt(System.getProperty("fightID", "0")); int eventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
if(eventKampfID >= 1){ if(eventKampfID >= 1){
EventKampf = EventFight.get(eventKampfID); EventKampf = EventFight.get(eventKampfID);
@ -359,7 +369,7 @@ public class Config {
}else{ }else{
//No event //No event
TeamRedColor = config.getString("Red.Prefix", "§c"); TeamRedColor = config.getString("Red.Prefix", "§c");
TeamBlueColor = config.getString("Blue.Prefix", "§3"); TeamBlueColor = config.getString("Blue.Prefix", "§9");
TeamRedName = config.getString("Red.Name", "Rot"); TeamRedName = config.getString("Red.Name", "Rot");
TeamBlueName = config.getString("Blue.Name", "Blau"); TeamBlueName = config.getString("Blue.Name", "Blau");
OnlyPublicSchematics = config.getBoolean("Schematic.OnlyPublicSchematics", false); OnlyPublicSchematics = config.getBoolean("Schematic.OnlyPublicSchematics", false);

View File

@ -20,19 +20,17 @@
package de.steamwar.fightsystem; package de.steamwar.fightsystem;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.core.WorldEditRendererCUIEditor;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.fightsystem.commands.*; import de.steamwar.fightsystem.commands.*;
import de.steamwar.fightsystem.countdown.*; import de.steamwar.fightsystem.countdown.*;
import de.steamwar.fightsystem.event.HellsBells; import de.steamwar.fightsystem.event.*;
import de.steamwar.fightsystem.event.Meteor;
import de.steamwar.fightsystem.event.PersistentDamage;
import de.steamwar.fightsystem.event.TNTDistributor;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.fight.FightWorld; import de.steamwar.fightsystem.fight.FightWorld;
import de.steamwar.fightsystem.fight.HotbarKit; import de.steamwar.fightsystem.fight.HotbarKit;
import de.steamwar.fightsystem.listener.Shutdown;
import de.steamwar.fightsystem.listener.*; import de.steamwar.fightsystem.listener.*;
import de.steamwar.fightsystem.listener.Shutdown;
import de.steamwar.fightsystem.record.FileRecorder; import de.steamwar.fightsystem.record.FileRecorder;
import de.steamwar.fightsystem.record.FileSource; import de.steamwar.fightsystem.record.FileSource;
import de.steamwar.fightsystem.record.GlobalRecorder; import de.steamwar.fightsystem.record.GlobalRecorder;
@ -43,6 +41,7 @@ import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.*; import de.steamwar.fightsystem.utils.*;
import de.steamwar.fightsystem.winconditions.*; import de.steamwar.fightsystem.winconditions.*;
import de.steamwar.message.Message; import de.steamwar.message.Message;
import de.steamwar.sql.NodeData;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import lombok.Getter; import lombok.Getter;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -70,6 +69,11 @@ public class FightSystem extends JavaPlugin {
Core.setInstance(this); Core.setInstance(this);
TinyProtocol.init(); TinyProtocol.init();
} }
if (Config.SpectatePort != 0) {
Core.setServerName("Spectate");
} else if (Config.ReplayID != 0) {
Core.setServerName("Replay");
}
message = new Message("de.steamwar.fightsystem.FightSystem", FightSystem.class.getClassLoader()); message = new Message("de.steamwar.fightsystem.FightSystem", FightSystem.class.getClassLoader());
@ -109,6 +113,7 @@ public class FightSystem extends JavaPlugin {
new HotbarKit.HotbarKitListener(); new HotbarKit.HotbarKitListener();
new JoinRequestListener(); new JoinRequestListener();
new OneShotStateDependent(ArenaMode.All, FightState.PreSchemSetup, () -> Fight.playSound(SWSound.BLOCK_NOTE_PLING.getSound(), 100.0f, 2.0f)); new OneShotStateDependent(ArenaMode.All, FightState.PreSchemSetup, () -> Fight.playSound(SWSound.BLOCK_NOTE_PLING.getSound(), 100.0f, 2.0f));
new OneShotStateDependent(ArenaMode.Test, FightState.All, WorldEditRendererCUIEditor::new);
new EnterHandler(); new EnterHandler();
techHider = new TechHiderWrapper(); techHider = new TechHiderWrapper();
@ -127,6 +132,7 @@ public class FightSystem extends JavaPlugin {
new WinconditionPointsAirShip(); new WinconditionPointsAirShip();
new WinconditionTimeout(); new WinconditionTimeout();
new WinconditionTimeTechKO(); new WinconditionTimeTechKO();
new WinconditionTimedDamageTechKO();
new EventTeamOffWincondition(); new EventTeamOffWincondition();
new WinconditionComparisonTimeout(Winconditions.HEART_RATIO_TIMEOUT, "HeartTimeout", "WIN_MORE_HEALTH", FightTeam::getHeartRatio); new WinconditionComparisonTimeout(Winconditions.HEART_RATIO_TIMEOUT, "HeartTimeout", "WIN_MORE_HEALTH", FightTeam::getHeartRatio);
new WinconditionComparisonTimeout(Winconditions.PERCENT_TIMEOUT, "PercentTimeout", "WIN_LESS_DAMAGE", team -> -Wincondition.getPercentWincondition().getPercent(team)); new WinconditionComparisonTimeout(Winconditions.PERCENT_TIMEOUT, "PercentTimeout", "WIN_LESS_DAMAGE", team -> -Wincondition.getPercentWincondition().getPercent(team));
@ -136,6 +142,7 @@ public class FightSystem extends JavaPlugin {
new PersistentDamage(); new PersistentDamage();
new TNTDistributor(); new TNTDistributor();
new WinconditionAmongUs(); new WinconditionAmongUs();
new NoGravity();
new NoPlayersOnlineCountdown(); new NoPlayersOnlineCountdown();
new PreSchemCountdown(); new PreSchemCountdown();
@ -173,12 +180,11 @@ public class FightSystem extends JavaPlugin {
SchematicNode checkSchematicNode = SchematicNode.getSchematicNode(Config.CheckSchemID); SchematicNode checkSchematicNode = SchematicNode.getSchematicNode(Config.CheckSchemID);
Fight.getBlueTeam().setSchem(checkSchematicNode); Fight.getBlueTeam().setSchem(checkSchematicNode);
if (checkSchematicNode.getName().endsWith("-prepared")) { if (checkSchematicNode.isPrepared()) {
SchematicNode unpreparedSchematicNode = SchematicNode.getSchematicNode(checkSchematicNode.getOwner(), checkSchematicNode.getName().substring(0, checkSchematicNode.getName().length() - 9), checkSchematicNode.getParent()); Fight.getRedTeam().setSchem(checkSchematicNode, NodeData.getRevisions(checkSchematicNode) - 1);
if (unpreparedSchematicNode != null) {
Fight.getRedTeam().setSchem(unpreparedSchematicNode);
}
} }
new TechareaCommand();
}else if(Config.mode == ArenaMode.PREPARE) { }else if(Config.mode == ArenaMode.PREPARE) {
Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(Config.PrepareSchemID)); Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(Config.PrepareSchemID));
} }

View File

@ -76,6 +76,7 @@ KITSEARCH_TITLE=Search for kit
SCHEM_NO_ENEMY=§cNo schematic selection without an opponent SCHEM_NO_ENEMY=§cNo schematic selection without an opponent
SCHEM_TITLE={0} selection SCHEM_TITLE={0} selection
SCHEM_DIRT=§eDirt Block
SCHEM_PUBLIC=§ePublic {0} SCHEM_PUBLIC=§ePublic {0}
SCHEM_UNCHECKED=§eUnchecked {0} SCHEM_UNCHECKED=§eUnchecked {0}
SCHEM_PRIVATE=§ePrivate {0} SCHEM_PRIVATE=§ePrivate {0}
@ -190,6 +191,7 @@ BAR_POINTS_OF={0}§8/§7{1} §8Points
BAR_PERCENT={0}§8% BAR_PERCENT={0}§8%
BAR_CANNONS={0} §8Cannons BAR_CANNONS={0} §8Cannons
BAR_WATER={0} §8Water BAR_WATER={0} §8Water
BAR_SECONDS={0}§8s
# Winconditions # Winconditions

View File

@ -70,6 +70,7 @@ KITSEARCH_TITLE=Nach Kit suchen
SCHEM_NO_ENEMY=§cKeine Schematicwahl ohne Gegner SCHEM_NO_ENEMY=§cKeine Schematicwahl ohne Gegner
SCHEM_TITLE={0}-Auswahl SCHEM_TITLE={0}-Auswahl
SCHEM_DIRT=§eErdblock
SCHEM_PUBLIC=§eÖffentliches {0} SCHEM_PUBLIC=§eÖffentliches {0}
SCHEM_UNCHECKED=§eUngeprüftes {0} SCHEM_UNCHECKED=§eUngeprüftes {0}
SCHEM_PRIVATE=§ePrivates {0} SCHEM_PRIVATE=§ePrivates {0}

View File

@ -24,15 +24,14 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.ai.AIManager; import de.steamwar.fightsystem.ai.AIManager;
import de.steamwar.fightsystem.fight.*; import de.steamwar.fightsystem.fight.*;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.listener.PersonalKitCreator; import de.steamwar.fightsystem.listener.PersonalKitCreator;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.utils.ColorConverter; import de.steamwar.fightsystem.utils.ColorConverter;
import de.steamwar.inventory.*; import de.steamwar.inventory.*;
import de.steamwar.message.Message; import de.steamwar.message.Message;
import de.steamwar.sql.PersonalKit; import de.steamwar.sql.*;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SchematicType;
import de.steamwar.sql.SteamwarUser;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
@ -40,7 +39,10 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class GUI { public class GUI {
@ -206,6 +208,14 @@ public class GUI {
for (int i = 0; i < Config.SubTypes.size(); i++) { for (int i = 0; i < Config.SubTypes.size(); i++) {
setupSchemTypeRow(p, inv, Config.SubTypes.get(i), i + 1); setupSchemTypeRow(p, inv, Config.SubTypes.get(i), i + 1);
} }
if (!Config.test() && SteamwarUser.get(p.getUniqueId()).hasPerm(UserPerm.TEAM)) {
SchematicNode node = SchematicNode.getSchematicNode(-1, Config.GameName, (Integer) null);
if (node != null) {
inv.setItem(2, new SWItem(SWItem.getMaterial(node.getItem()), msg.parse("SCHEM_DIRT", p), click -> {
schemSelect(p, node);
}));
}
}
inv.setCallback(-999, (ClickType click) -> p.closeInventory()); inv.setCallback(-999, (ClickType click) -> p.closeInventory());
inv.open(); inv.open();
} }
@ -241,14 +251,18 @@ public class GUI {
private static void schemDialog(Player p, SchematicType type, boolean publicSchems, boolean unchecked){ private static void schemDialog(Player p, SchematicType type, boolean publicSchems, boolean unchecked){
SchematicSelector selector = new SchematicSelector(p, Config.test() ? SchematicSelector.selectSchematic() : SchematicSelector.selectSchematicType(unchecked ? type.checkType() : type), node -> { SchematicSelector selector = new SchematicSelector(p, Config.test() ? SchematicSelector.selectSchematic() : SchematicSelector.selectSchematicType(unchecked ? type.checkType() : type), node -> {
schemSelect(p, node);
});
selector.setPublicMode(publicSchems?SchematicSelector.PublicMode.PUBLIC_ONLY:SchematicSelector.PublicMode.PRIVATE_ONLY);
selector.open();
}
private static void schemSelect(Player p, SchematicNode node) {
FightTeam fightTeam = Fight.getPlayerTeam(p); FightTeam fightTeam = Fight.getPlayerTeam(p);
if(fightTeam == null) if(fightTeam == null)
return; return;
if(Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP) if(Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP)
fightTeam.pasteSchem(node); fightTeam.pasteSchem(node);
p.closeInventory(); p.closeInventory();
});
selector.setPublicMode(publicSchems?SchematicSelector.PublicMode.PUBLIC_ONLY:SchematicSelector.PublicMode.PRIVATE_ONLY);
selector.open();
} }
} }

View File

@ -0,0 +1,60 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.fightsystem.commands;
import de.steamwar.command.SWCommand;
import de.steamwar.entity.CWireframe;
import de.steamwar.entity.REntityServer;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class TechareaCommand extends SWCommand {
private final Map<UUID, REntityServer> servers = new HashMap<>();
public TechareaCommand() {
super("techarea");
Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> servers.forEach((uuid, rEntityServer) -> rEntityServer.tick()), 2, 2);
}
@Register
public void genericCommand(Player player) {
if (servers.containsKey(player.getUniqueId())) {
servers.get(player.getUniqueId()).close();
} else {
REntityServer server = new REntityServer();
CWireframe wireframe = new CWireframe(server);
wireframe.setPos1(Config.BlueInsetRegion.getMinLocation(Config.world));
wireframe.setPos2(Config.BlueInsetRegion.getMaxLocation(Config.world).subtract(1, 1, 1));
wireframe.setBlock(Material.RED_CONCRETE.createBlockData());
server.addPlayer(player);
servers.put(player.getUniqueId(), server);
}
}
}

View File

@ -34,6 +34,7 @@ import org.bukkit.command.CommandSender;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.Arrays; import java.util.Arrays;
import java.util.logging.Level;
public class TechhiderbugCommand implements CommandExecutor { public class TechhiderbugCommand implements CommandExecutor {
@ -45,6 +46,7 @@ public class TechhiderbugCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command cmd, String alias, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String alias, String[] args) {
StringWriter writer = new StringWriter(); StringWriter writer = new StringWriter();
try {
writer.append("ArenaMode: ").append(Config.mode.name()).append('\n'); writer.append("ArenaMode: ").append(Config.mode.name()).append('\n');
writer.append("FightState: ").append(FightState.getFightState().name()).append('\n'); writer.append("FightState: ").append(FightState.getFightState().name()).append('\n');
writer.append("TechHider enabled: ").append(FightState.getStateDependentFeatures().get(FightSystem.getTechHider()).toString()).append('\n'); writer.append("TechHider enabled: ").append(FightState.getStateDependentFeatures().get(FightSystem.getTechHider()).toString()).append('\n');
@ -62,8 +64,15 @@ public class TechhiderbugCommand implements CommandExecutor {
FightSystem.getTechHider().getHiddenRegion().forEach((p, r) -> writer.append(p.getName()).append(':').append(r.toString()).append(' ')); FightSystem.getTechHider().getHiddenRegion().forEach((p, r) -> writer.append(p.getName()).append(':').append(r.toString()).append(' '));
writer.append('\n'); writer.append('\n');
writer.append("TinyProtocol: ");
writer.append(TinyProtocol.instance.toString()).append('\n');
writer.append('\n').append("Netty pipelines:\n"); writer.append('\n').append("Netty pipelines:\n");
Bukkit.getOnlinePlayers().forEach(p -> writer.append(p.getName()).append(": ").append(String.join(" ", TinyProtocol.instance.getPlayerInterceptors().get(p).getChannel().pipeline().names())).append('\n')); Bukkit.getOnlinePlayers().forEach(p -> writer.append(p.getName()).append(": ").append(String.join(" ", TinyProtocol.instance.getPlayerInterceptors().get(p).getChannel().pipeline().names())).append('\n'));
} catch (Exception e) {
writer.append("Error while generating bug report: ").append(e.getMessage()).append('\n');
Bukkit.getLogger().log(Level.SEVERE, "Error while generating bug report", e);
}
SWException.log("Techhider-Bug reported by " + sender.getName() + ": " + Arrays.toString(args), writer.toString()); SWException.log("Techhider-Bug reported by " + sender.getName() + ": " + Arrays.toString(args), writer.toString());
return false; return false;

View File

@ -21,6 +21,7 @@ package de.steamwar.fightsystem.commands;
import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightWorld;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand; import de.steamwar.fightsystem.states.StateDependentCommand;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -39,7 +40,9 @@ public class WGCommand implements CommandExecutor {
if(!(sender instanceof Player)) { if(!(sender instanceof Player)) {
return false; return false;
} }
FightWorld.resetWorld();
Fight.getBlueTeam().pasteSchem(); Fight.getBlueTeam().pasteSchem();
Fight.getRedTeam().pasteSchem();
return false; return false;
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* 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) 2020 SteamWar.de-Serverteam
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Affero General Public License as published by
@ -17,24 +17,25 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.steamwar.tutorial.listener; package de.steamwar.fightsystem.event;
import org.bukkit.Bukkit; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.winconditions.Winconditions;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.entity.EntitySpawnEvent;
public class Joining extends BasicListener { public class NoGravity implements Listener {
@EventHandler public NoGravity() {
public void onJoin(PlayerJoinEvent event) { new StateDependentListener(Winconditions.NO_GRAVITY, FightState.All, this);
event.getPlayer().setOp(true);
} }
@EventHandler @EventHandler
public void onQuit(PlayerQuitEvent event) { public void onEntitySpawn(EntitySpawnEvent event) {
if (Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(event.getPlayer()))) { if (event.getEntityType() == EntityType.PLAYER) return;
Bukkit.shutdown(); event.getEntity().setGravity(false);
}
} }
} }

View File

@ -19,20 +19,14 @@
package de.steamwar.fightsystem.fight; package de.steamwar.fightsystem.fight;
import com.comphenix.tinyprotocol.TinyProtocol;
import com.mojang.authlib.GameProfile;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.core.ProtocolWrapper;
import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.record.GlobalRecorder; import de.steamwar.fightsystem.record.GlobalRecorder;
import lombok.Getter; import lombok.Getter;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;

View File

@ -31,6 +31,7 @@ import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.utils.ColorConverter; import de.steamwar.fightsystem.utils.ColorConverter;
import de.steamwar.fightsystem.utils.Region; import de.steamwar.fightsystem.utils.Region;
import de.steamwar.fightsystem.utils.WorldeditWrapper; import de.steamwar.fightsystem.utils.WorldeditWrapper;
import de.steamwar.fightsystem.winconditions.Winconditions;
import de.steamwar.sql.SchematicData; import de.steamwar.sql.SchematicData;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SchematicType; import de.steamwar.sql.SchematicType;
@ -51,20 +52,28 @@ public class FightSchematic extends StateDependent {
private final FightTeam team; private final FightTeam team;
private final Region region; private final Region region;
private final boolean rotate; private final boolean rotate;
@Getter
private boolean usedRotate;
@Getter @Getter
private Clipboard clipboard = null; private Clipboard clipboard = null;
private int schematic = 0; private int schematic = 0;
public FightSchematic(FightTeam team, boolean rotate) { public FightSchematic(FightTeam team, boolean usedRotate) {
super(ArenaMode.All, FightState.PostSchemSetup); super(ArenaMode.All, FightState.PostSchemSetup);
this.team = team; this.team = team;
this.region = team.getSchemRegion(); this.region = team.getSchemRegion();
this.rotate = rotate; this.rotate = usedRotate;
this.usedRotate = usedRotate;
register(); register();
} }
public void setChangeRotate(boolean rotate) {
this.usedRotate = this.rotate ^ rotate;
}
public boolean hasSchematic() { public boolean hasSchematic() {
return clipboard != null; return clipboard != null;
} }
@ -74,9 +83,13 @@ public class FightSchematic extends StateDependent {
} }
public void setSchematic(SchematicNode schem) { public void setSchematic(SchematicNode schem) {
setSchematic(schem, -1);
}
public void setSchematic(SchematicNode schem, int revision) {
schematic = schem.getId(); schematic = schem.getId();
try { try {
clipboard = new SchematicData(schem).load(); clipboard = new SchematicData(schem, revision).load();
if(schem.replaceColor()) if(schem.replaceColor())
replaceTeamColor(clipboard); replaceTeamColor(clipboard);
@ -119,10 +132,15 @@ public class FightSchematic extends StateDependent {
} }
if(ArenaMode.AntiReplay.contains(Config.mode)) { if(ArenaMode.AntiReplay.contains(Config.mode)) {
boolean changeRotation = false;
if (Config.ActiveWinconditions.contains(Winconditions.RANDOM_ROTATE)) {
changeRotation = new Random().nextBoolean();
usedRotate = rotate ^ changeRotation;
}
if(team.isBlue()) if(team.isBlue())
GlobalRecorder.getInstance().blueSchem(schematic); GlobalRecorder.getInstance().blueSchem(schematic, changeRotation);
else else
GlobalRecorder.getInstance().redSchem(schematic); GlobalRecorder.getInstance().redSchem(schematic, changeRotation);
} }
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::paste); Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::paste);
@ -148,8 +166,8 @@ public class FightSchematic extends StateDependent {
Config.PasteAligned && Config.BlueToRedX != 0 ? region.getSizeX()/2.0 - dims.getBlockX() : -dims.getBlockX()/2.0, Config.PasteAligned && Config.BlueToRedX != 0 ? region.getSizeX()/2.0 - dims.getBlockX() : -dims.getBlockX()/2.0,
Config.WaterDepth != 0 ? Config.WaterDepth - WorldeditWrapper.impl.getWaterDepth(clipboard) : 0, Config.WaterDepth != 0 ? Config.WaterDepth - WorldeditWrapper.impl.getWaterDepth(clipboard) : 0,
Config.PasteAligned && Config.BlueToRedZ != 0 ? region.getSizeZ()/2.0 - dims.getBlockZ() : -dims.getBlockZ()/2.0 Config.PasteAligned && Config.BlueToRedZ != 0 ? region.getSizeZ()/2.0 - dims.getBlockZ() : -dims.getBlockZ()/2.0
).add(new Vector(rotate ? 1 : 0, 0, rotate ? 1 : 0)), ).add(new Vector(usedRotate ? 1 : 0, 0, usedRotate ? 1 : 0)),
new AffineTransform().rotateY(rotate ? 180 : 0) new AffineTransform().rotateY(usedRotate ? 180 : 0)
); );
FightSystem.getHullHider().initialize(team); FightSystem.getHullHider().initialize(team);
team.getPlayers().forEach(fightPlayer -> fightPlayer.ifAI(ai -> ai.schematic(clipboard))); team.getPlayers().forEach(fightPlayer -> fightPlayer.ifAI(ai -> ai.schematic(clipboard)));

View File

@ -412,7 +412,11 @@ public class FightTeam {
} }
public void setSchem(SchematicNode schematic){ public void setSchem(SchematicNode schematic){
this.schematic.setSchematic(schematic); setSchem(schematic, -1);
}
public void setSchem(SchematicNode schematic, int revision){
this.schematic.setSchematic(schematic, revision);
broadcast("SCHEMATIC_CHOSEN", Config.GameName, schematic.getName()); broadcast("SCHEMATIC_CHOSEN", Config.GameName, schematic.getName());
} }
@ -458,6 +462,10 @@ public class FightTeam {
return schematic.getId(); return schematic.getId();
} }
public void setSchematicChangeRotate(boolean rotate) {
schematic.setChangeRotate(rotate);
}
public Clipboard getClipboard() { public Clipboard getClipboard() {
return schematic.getClipboard(); return schematic.getClipboard();
} }

View File

@ -29,11 +29,15 @@ import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.states.StateDependentTask; import de.steamwar.fightsystem.states.StateDependentTask;
import de.steamwar.fightsystem.utils.ItemBuilder; import de.steamwar.fightsystem.utils.ItemBuilder;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -107,6 +111,19 @@ public class HotbarKit extends Kit {
Player player = event.getPlayer(); Player player = event.getPlayer();
int slot = player.getInventory().getHeldItemSlot(); int slot = player.getInventory().getHeldItemSlot();
click(player, slot, event);
}
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
int slot = event.getSlot();
if (slot < 0 || slot >= HOTBAR_SIZE) return;
Player player = (Player) event.getWhoClicked();
click(player, slot, event);
}
private void click(Player player, int slot, Cancellable event) {
Kit activeKit = activeKits.get(player); Kit activeKit = activeKits.get(player);
if(!(activeKit instanceof HotbarKit) || PersonalKitCreator.inKitCreator(player) || activeKit.getInventory()[slot] == null) if(!(activeKit instanceof HotbarKit) || PersonalKitCreator.inKitCreator(player) || activeKit.getInventory()[slot] == null)
return; return;

View File

@ -83,10 +83,8 @@ public class PrepareSchem implements Listener {
return; return;
} }
if(schemExists(schem)) schem.setSchemtype(Config.SchematicType.checkType());
return; schem.setPrepared(true);
schem = SchematicNode.createSchematicNode(schem.getOwner(), preparedName(schem), schem.getParent(), Config.SchematicType.checkType().toDB(), schem.getItem());
try{ try{
WorldeditWrapper.impl.saveSchem(schem, region, minY); WorldeditWrapper.impl.saveSchem(schem, region, minY);
@ -116,20 +114,5 @@ public class PrepareSchem implements Listener {
FightState.setFightState(FightState.PRE_SCHEM_SETUP); FightState.setFightState(FightState.PRE_SCHEM_SETUP);
FightState.setFightState(FightState.POST_SCHEM_SETUP); FightState.setFightState(FightState.POST_SCHEM_SETUP);
} }
schemExists(SchematicNode.getSchematicNode(Config.PrepareSchemID));
}
private boolean schemExists(SchematicNode schem) {
if(SchematicNode.getSchematicNode(schem.getOwner(), preparedName(schem), schem.getParent()) != null) {
FightSystem.getMessage().broadcast("PREPARE_SCHEM_EXISTS");
Bukkit.shutdown();
return true;
}
return false;
}
private String preparedName(SchematicNode schem) {
return schem.getName() + "-prepared";
} }
} }

View File

@ -20,7 +20,6 @@
package de.steamwar.fightsystem.record; package de.steamwar.fightsystem.record;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.core.Core;
import de.steamwar.core.TrickyTrialsWrapper; import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.core.WorldEditWrapper; import de.steamwar.core.WorldEditWrapper;
import de.steamwar.entity.REntity; import de.steamwar.entity.REntity;
@ -144,6 +143,8 @@ public class PacketProcessor implements Listener {
packetDecoder[0xb2] = this::teams; packetDecoder[0xb2] = this::teams;
packetDecoder[0xb3] = () -> pasteEmbeddedSchem(Fight.getBlueTeam()); packetDecoder[0xb3] = () -> pasteEmbeddedSchem(Fight.getBlueTeam());
packetDecoder[0xb4] = () -> pasteEmbeddedSchem(Fight.getRedTeam()); packetDecoder[0xb4] = () -> pasteEmbeddedSchem(Fight.getRedTeam());
packetDecoder[0xb5] = () -> rotateSchem(Fight.getBlueTeam());
packetDecoder[0xb6] = () -> rotateSchem(Fight.getRedTeam());
packetDecoder[0xc0] = this::scoreboardTitle; packetDecoder[0xc0] = this::scoreboardTitle;
packetDecoder[0xc1] = this::scoreboardData; packetDecoder[0xc1] = this::scoreboardData;
packetDecoder[0xc2] = this::bossBar; packetDecoder[0xc2] = this::bossBar;
@ -529,6 +530,14 @@ public class PacketProcessor implements Listener {
execSync(() -> team.pasteSchem(schemId, clipboard)); execSync(() -> team.pasteSchem(schemId, clipboard));
} }
private void rotateSchem(FightTeam team) throws IOException {
boolean changeRotate = source.readBoolean();
execSync(() -> {
team.setSchematicChangeRotate(changeRotate);
});
}
private void teams() throws IOException { private void teams() throws IOException {
int blueId = source.readInt(); int blueId = source.readInt();
int redId = source.readInt(); int redId = source.readInt();

View File

@ -61,9 +61,9 @@ public interface Recorder {
default void enableTeam(FightTeam team){ default void enableTeam(FightTeam team){
if(FightState.Schem.contains(FightState.getFightState())){ if(FightState.Schem.contains(FightState.getFightState())){
if(team.isBlue()) if(team.isBlue())
blueSchem(team.getSchematic()); blueSchem(team.getSchematic(), false);
else else
redSchem(team.getSchematic()); redSchem(team.getSchematic(), false);
} }
if(FightState.AntiSpectate.contains(FightState.getFightState())){ if(FightState.AntiSpectate.contains(FightState.getFightState())){
@ -123,6 +123,8 @@ public interface Recorder {
* TeamIDPacket (0xb2) + int blueTeamId, redTeamId * TeamIDPacket (0xb2) + int blueTeamId, redTeamId
* BlueEmbeddedSchemPacket (0xb3) + int blueSchemId + gzipt NBT blob * BlueEmbeddedSchemPacket (0xb3) + int blueSchemId + gzipt NBT blob
* RedEmbeddedSchemPacket (0xb4) + int redSchemId + gzipt NBT blob * RedEmbeddedSchemPacket (0xb4) + int redSchemId + gzipt NBT blob
* BlueSchemRotatePacket (0xb5) + boolean changeRotate
* RedSchemRotatePacket (0xb6) + boolean changeRotate
* *
* DEPRECATED ScoreboardTitlePacket (0xc0) + String scoreboardTitle * DEPRECATED ScoreboardTitlePacket (0xc0) + String scoreboardTitle
* DEPRECATED ScoreboardDataPacket (0xc1) + String key + int value * DEPRECATED ScoreboardDataPacket (0xc1) + String key + int value
@ -259,14 +261,20 @@ public interface Recorder {
write(0xb2, blueTeamId, redTeamId); write(0xb2, blueTeamId, redTeamId);
} }
default void blueSchem(int schemId) { default void blueSchem(int schemId, boolean changeRotate) {
rotate(0xb5, changeRotate);
schem(0xb3, 0xb0, schemId); schem(0xb3, 0xb0, schemId);
} }
default void redSchem(int schemId) { default void redSchem(int schemId, boolean changeRotate) {
rotate(0xb6, changeRotate);
schem(0xb4, 0xb1, schemId); schem(0xb4, 0xb1, schemId);
} }
default void rotate(int packetId, boolean changeRotate) {
write(packetId, changeRotate);
}
default void schem(int embedId, int noEmbedId, int schemId){ default void schem(int embedId, int noEmbedId, int schemId){
if(schemId == 0) { if(schemId == 0) {
write(noEmbedId, schemId); write(noEmbedId, schemId);
@ -275,7 +283,7 @@ public interface Recorder {
ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ByteArrayOutputStream buffer = new ByteArrayOutputStream();
try{ try{
copy(NodeData.get(SchematicNode.getSchematicNode(schemId)).schemData(), buffer); copy(NodeData.getLatest(SchematicNode.getSchematicNode(schemId)).schemData(), buffer);
}catch (EOFException e) { }catch (EOFException e) {
Bukkit.getLogger().log(Level.INFO, "EOFException ignored"); Bukkit.getLogger().log(Level.INFO, "EOFException ignored");
} catch (IOException e) { } catch (IOException e) {
@ -339,6 +347,8 @@ public interface Recorder {
stream.writeShort((Short)o); stream.writeShort((Short)o);
else if(o instanceof Integer) else if(o instanceof Integer)
stream.writeInt((Integer)o); stream.writeInt((Integer)o);
else if(o instanceof Long)
stream.writeLong((Long)o);
else if(o instanceof Float) else if(o instanceof Float)
stream.writeFloat((Float)o); stream.writeFloat((Float)o);
else if(o instanceof Double) else if(o instanceof Double)

View File

@ -33,6 +33,8 @@ import de.steamwar.fightsystem.states.OneShotStateDependent;
import de.steamwar.fightsystem.winconditions.Wincondition; import de.steamwar.fightsystem.winconditions.Wincondition;
import de.steamwar.network.NetworkSender; import de.steamwar.network.NetworkSender;
import de.steamwar.network.packets.common.FightEndsPacket; import de.steamwar.network.packets.common.FightEndsPacket;
import de.steamwar.sql.EventFight;
import de.steamwar.sql.EventRelation;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import lombok.Getter; import lombok.Getter;
@ -70,14 +72,23 @@ public class FightStatistics {
} }
private void setEventResult() { private void setEventResult() {
if (FightSystem.getLastWinner() == null) if (FightSystem.getLastWinner() == null) {
Config.EventKampf.setErgebnis(0); Config.EventKampf.setErgebnis(0);
else if (FightSystem.getLastWinner().isBlue()) } else if (FightSystem.getLastWinner().isBlue()) {
Config.EventKampf.setErgebnis(1); Config.EventKampf.setErgebnis(1);
else } else {
Config.EventKampf.setErgebnis(2); Config.EventKampf.setErgebnis(2);
} }
Config.EventKampf.getDependents().forEach(EventRelation::apply);
Config.EventKampf.getGroup().ifPresent(group -> {
if (group.getLastFight().map(EventFight::getFightID).orElse(-1) == Config.EventKampf.getFightID() && !group.needsTieBreak()) {
group.getDependents().forEach(EventRelation::apply);
}
});
}
private void disable() { private void disable() {
FightTeam winner = FightSystem.getLastWinner(); FightTeam winner = FightSystem.getLastWinner();
String windescription = FightSystem.getLastWinreason(); String windescription = FightSystem.getLastWinreason();

View File

@ -23,6 +23,7 @@ import de.steamwar.techhider.ProtocolUtils;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import java.util.function.ObjIntConsumer; import java.util.function.ObjIntConsumer;
@ -77,6 +78,14 @@ public class Region {
return ProtocolUtils.posToChunk(maxZ); return ProtocolUtils.posToChunk(maxZ);
} }
public Location getMinLocation(World world) {
return new Location(world, minX, minY, minZ);
}
public Location getMaxLocation(World world) {
return new Location(world, maxX, maxY, maxZ);
}
public boolean chunkOutside(int cX, int cZ) { public boolean chunkOutside(int cX, int cZ) {
return getMinChunkX() > cX || cX > getMaxChunkX() || return getMinChunkX() > cX || cX > getMaxChunkX() ||
getMinChunkZ() > cZ || cZ > getMaxChunkZ(); getMinChunkZ() > cZ || cZ > getMaxChunkZ();

View File

@ -84,6 +84,9 @@ public class WinconditionBlocks extends Wincondition implements PrintableWincond
} }
private void check() { private void check() {
// Edge Case for DirtBlock
if (blocks.isEmpty()) return;
blocks.removeIf(block -> !isOfType.test(block)); blocks.removeIf(block -> !isOfType.test(block));
if(blocks.isEmpty()) if(blocks.isEmpty())
win(Fight.getOpposite(team), "WIN_TECHKO", team.getColoredName()); win(Fight.getOpposite(team), "WIN_TECHKO", team.getColoredName());

View File

@ -78,6 +78,7 @@ public class WinconditionPercent extends Wincondition implements PrintableWincon
private int totalBlocks = 0; private int totalBlocks = 0;
private int currentBlocks = 0; private int currentBlocks = 0;
private boolean countAnyBlock = false;
private TeamPercent(FightTeam team, Winconditions wincondition) { private TeamPercent(FightTeam team, Winconditions wincondition) {
this.team = team; this.team = team;
@ -98,7 +99,7 @@ public class WinconditionPercent extends Wincondition implements PrintableWincon
} }
event.blockList().forEach(block -> { event.blockList().forEach(block -> {
if (Config.PercentBlocks.contains(block.getType()) == Config.PercentBlocksWhitelist) { if (countAnyBlock || Config.PercentBlocks.contains(block.getType()) == Config.PercentBlocksWhitelist) {
currentBlocks--; currentBlocks--;
} }
}); });
@ -108,10 +109,16 @@ public class WinconditionPercent extends Wincondition implements PrintableWincon
private void enable() { private void enable() {
totalBlocks = 0; totalBlocks = 0;
countAnyBlock = false;
team.getSchemRegion().forEach((x, y, z) -> { team.getSchemRegion().forEach((x, y, z) -> {
if (Config.PercentBlocks.contains(Config.world.getBlockAt(x, y, z).getType()) == Config.PercentBlocksWhitelist) if (Config.PercentBlocks.contains(Config.world.getBlockAt(x, y, z).getType()) == Config.PercentBlocksWhitelist)
totalBlocks++; totalBlocks++;
}); });
// Edge Case for DirtBlock
if (totalBlocks == 0) {
totalBlocks = team.getSchemRegion().volume();
countAnyBlock = true;
}
currentBlocks = totalBlocks; currentBlocks = totalBlocks;
postEnable.accept(team); postEnable.accept(team);
} }

View File

@ -20,6 +20,7 @@
package de.steamwar.fightsystem.winconditions; package de.steamwar.fightsystem.winconditions;
import de.steamwar.core.TrickyTrialsWrapper; import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.countdown.Countdown; import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FightTeam;
@ -30,7 +31,6 @@ import de.steamwar.fightsystem.states.StateDependentTask;
import de.steamwar.fightsystem.utils.Message; import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound; import de.steamwar.fightsystem.utils.SWSound;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
@ -41,8 +41,7 @@ import java.util.Map;
public class WinconditionTimeTechKO extends Wincondition implements Listener { public class WinconditionTimeTechKO extends Wincondition implements Listener {
private static final int TECH_KO_TIME_IN_S = 90; private static final int TECH_KO_HALF_TIME = Config.TechKoTime/2;
private static final int TECH_KO_HALF_TIME = TECH_KO_TIME_IN_S/2;
private final Map<Integer, FightTeam> spawnLocations = new HashMap<>(); private final Map<Integer, FightTeam> spawnLocations = new HashMap<>();
private final Map<FightTeam, TechKOCountdown> countdowns = new HashMap<>(); private final Map<FightTeam, TechKOCountdown> countdowns = new HashMap<>();

View File

@ -0,0 +1,115 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 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.fightsystem.winconditions;
import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import org.bukkit.Location;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import java.util.HashMap;
import java.util.Map;
public class WinconditionTimedDamageTechKO extends Wincondition implements PrintableWincondition, Listener {
private final Map<FightTeam, TechKOCountdown> countdowns = new HashMap<>();
public WinconditionTimedDamageTechKO() {
super("TechKO");
new StateDependentListener(Winconditions.TIMED_DAMAGE_TECH_KO, FightState.Running, this);
new StateDependent(Winconditions.TIMED_DAMAGE_TECH_KO, FightState.Running) {
@Override
public void enable() {
Fight.teams().forEach(team -> {
TechKOCountdown countdown = new TechKOCountdown(team, Config.TechKoTime);
countdowns.put(team, countdown);
countdown.enable();
});
}
@Override
public void disable() {
countdowns.values().forEach(Countdown::disable);
countdowns.clear();
}
}.register();
}
@Override
public Message getDisplay(FightTeam team) {
return new Message("BAR_SECONDS", team.getPrefix() + countdowns.get(team).getTimeLeft());
}
@EventHandler
public void onExplode(EntityExplodeEvent e) {
if (e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
return;
Location location = e.getLocation();
TechKOCountdown countdown = null;
FightTeam fightTeam = null;
for (FightTeam team : Fight.teams()) {
FightTeam current = Fight.getOpposite(team);
if (current.getExtendRegion().inRegion(location)) {
fightTeam = current;
countdown = countdowns.get(team);
break;
}
}
if (fightTeam == null) {
return;
}
FightTeam finalFightTeam = fightTeam;
TechKOCountdown finalCountdown = countdown;
e.blockList().forEach(block -> {
if (block.isEmpty()) return;
if (finalFightTeam.getExtendRegion().inRegion(block)) {
finalCountdown.disable();
finalCountdown.enable();
}
});
}
private class TechKOCountdown extends Countdown {
private final FightTeam team;
public TechKOCountdown(FightTeam team, int countdownTime) {
super(countdownTime, new Message("TECHKO_COUNTDOWN", team.getColoredName()), SWSound.BLOCK_NOTE_PLING, false);
this.team = team;
}
@Override
public void countdownFinished() {
win(Fight.getOpposite(team), "WIN_TECHKO", team.getColoredName());
}
}
}

Some files were not shown because too many files have changed in this diff Show More