401 Commits

Author SHA1 Message Date
7971350ad9 Update SimulatorPreviewTNT
All checks were successful
SteamWarCI Build successful
2025-07-08 20:46:02 +02:00
71409c9023 Update SimulatorPreviewTNT
All checks were successful
SteamWarCI Build successful
2025-07-04 16:53:58 +02:00
1e37fbe558 Update SimulatorPreviewTNT
All checks were successful
SteamWarCI Build successful
2025-07-04 16:09:09 +02:00
1fe8c79f51 Add some of the collision code
All checks were successful
SteamWarCI Build successful
2025-07-04 09:16:49 +02:00
0edf4d73bd Update SimulatorPreviewTNT
All checks were successful
SteamWarCI Build successful
2025-07-03 21:50:39 +02:00
c6dfbb5f6f Add SimulatorPreview and SimulatorPreviewTNT
All checks were successful
SteamWarCI Build successful
2025-07-03 21:48:44 +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
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
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
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
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
147e34c0d6 Fix TNTClickListener
All checks were successful
SteamWarCI Build successful
2025-04-21 11:47:00 +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
313b22cb44 Optimize SimulatorStabGenerator
All checks were successful
SteamWarCI Build successful
2025-04-20 18:30:30 +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
230ac09b61 Hotfix for disabled things
All checks were successful
SteamWarCI Build successful
2025-04-20 08:12:22 +02:00
48ea88e1a7 Merge pull request 'BauSystem/SimulatorStabGenerator' (#47) from BauSystem/SimulatorStabGenerator into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #47
2025-04-19 23:21:45 +02:00
05dc42355d Update and improve SimulatorStabGenerator
All checks were successful
SteamWarCI Build successful
2025-04-19 23:04:19 +02:00
17704487c9 Add SimulatorStabGenerator 2025-04-19 17:58:40 +02:00
76bbfd0381 Merge pull request 'Add TNTClickListener.TNT_CLICK_DETAILS as a toggle' (#46) from BauSystem/TNTClickDetails into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #46
2025-04-18 21:52:29 +02:00
ae9166528d Add TNTClickListener.TNT_CLICK_DETAILS as a toggle
All checks were successful
SteamWarCI Build successful
2025-04-18 21:49:59 +02:00
119fae4b51 Merge pull request 'Add ActiveMonths to ArenaMode for rotating modes' (#45) from VelocityCore/ActiveMonthsForRotatingGameModes into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #45
2025-04-18 18:38:41 +02:00
43621b18b4 Fix TypeMappers.arenaMapTypeMapper
All checks were successful
SteamWarCI Build successful
2025-04-18 16:57:35 +02:00
e5bdbac3c7 Change isNotActive to isActive
All checks were successful
SteamWarCI Build successful
2025-04-18 16:50:16 +02:00
fd738f539a Add 3 new PluginMessage channel
All checks were successful
SteamWarCI Build successful
2025-04-18 14:17:59 +02:00
b4c7576433 Merge pull request 'TNTLeague/BiggerCoins' (#12) from TNTLeague/BiggerCoins into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #12
Reviewed-by: Chaoscaot <max@chaoscaot.de>
2025-04-18 12:36:29 +02:00
8204e2ad21 Fix MWTeam.leave not distributing items correctly
All checks were successful
SteamWarCI Build successful
2025-04-18 12:30:22 +02:00
684a74b60d Fix SmartPlaceListener not updating Comparator or Repeater
All checks were successful
SteamWarCI Build successful
2025-04-18 12:14:43 +02:00
1f58b51af6 Fix NoteBlock turning off on redstone destroy under or up to 2 blocks beside it
All checks were successful
SteamWarCI Build successful
2025-04-18 12:07:31 +02:00
c9cfb48c4e Final fix for GlobalListener
All checks were successful
SteamWarCI Build successful
2025-04-18 10:14:08 +02:00
ace567ba33 Add chat system to TowerRun
All checks were successful
SteamWarCI Build successful
2025-04-18 10:07:42 +02:00
2094120150 Remove prefix. Cannot merge them together because of 'ChatListener.sendChat'
All checks were successful
SteamWarCI Build successful
2025-04-18 09:32:35 +02:00
e143268caa Fix DiscordBot.serverTeamChat sending to discord if received from discord!
All checks were successful
SteamWarCI Build successful
2025-04-18 09:30:26 +02:00
7802fdd7d9 Add ActiveMonths to ArenaMode for rotating modes
All checks were successful
SteamWarCI Build successful
2025-04-18 09:13:23 +02:00
7fb3d3d137 Hotfix DiscordBot.ingameChat going to broadcast instead of globalChat
All checks were successful
SteamWarCI Build successful
2025-04-17 21:38:35 +02:00
61d84492dc Merge branch 'main' into TNTLeague/BiggerCoins
All checks were successful
SteamWarCI Build successful
2025-04-17 21:18:40 +02:00
f74780d395 Hotfix IngameListener
All checks were successful
SteamWarCI Build successful
2025-04-17 16:47:23 +02:00
62dac000d4 Merge pull request 'Add general Melting of Blocks' (#43) from TowerRun/GeneralMeltingOfBlocks into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #43
2025-04-17 16:32:28 +02:00
424c80ec81 Add general Melting of Blocks
All checks were successful
SteamWarCI Build successful
2025-04-17 16:09:29 +02:00
ae7d394ae2 Enable clicking 'Ready' in inventory
All checks were successful
SteamWarCI Build successful
2025-04-17 15:45:25 +02:00
306444356c Update & Fix Spelling on Chaos Messages
All checks were successful
SteamWarCI Build successful
2025-04-17 01:28:06 +02:00
29dff8dce6 Fix PunishmentCommand sending double prefix
All checks were successful
SteamWarCI Build successful
2025-04-16 21:07:05 +02:00
cbaacd4e85 Merge pull request 'Improve and fix the discord rate limit warnings' (#37) from VelocityCore/ImproveDiscordChannel into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #37
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-04-16 20:16:52 +02:00
e24dada435 Trigger rebuild
All checks were successful
SteamWarCI Build successful
2025-04-16 18:13:58 +02:00
d04ffd5cf6 Fix some stuff for 1.21 BauSystem
Some checks failed
SteamWarCI Build failed
2025-04-16 18:12:50 +02:00
9da1de9b6c Fix MsgCommand being able to /r to offline players
All checks were successful
SteamWarCI Build successful
2025-04-16 13:42:31 +02:00
866c376ee5 Fix DevCommand not working when version switching without trying to connect in between when no server is running
All checks were successful
SteamWarCI Build successful
2025-04-16 10:20:10 +02:00
0b14a216d9 Fix SmartPlaceListener updating block under repeater/comparator
All checks were successful
SteamWarCI Build successful
2025-04-14 10:04:57 +02:00
b2853b9dec Fix RCommand being able to send offline players
All checks were successful
SteamWarCI Build successful
2025-04-14 10:01:50 +02:00
df5c363fb7 Fix FreezeListener
All checks were successful
SteamWarCI Build successful
2025-04-14 09:57:31 +02:00
5b3c3f36b4 Fix comment
All checks were successful
SteamWarCI Build successful
2025-04-14 09:16:06 +02:00
e1bcdd59ba Move 'maxNumberOfWebhooks' constructor parameter to end of list
All checks were successful
SteamWarCI Build successful
2025-04-14 09:14:04 +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
c9e4b57f12 Fix: Explicitly cast null to Integer in DownloadCommand
All checks were successful
SteamWarCI Build successful
2025-04-12 19:10:18 +02:00
fdcd248ba6 Merge branch 'main' of https://git.steamwar.de/SteamWar/SteamWar
Some checks failed
SteamWarCI Build failed
2025-04-12 19:04:11 +02:00
f573771355 Hotfix: Double Creation of //copy Schematics in //download command 2025-04-12 19:03:32 +02:00
80078cd8e2 Merge pull request 'Fix spectator handling' (#38) from spectator-improvements into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #38
Reviewed-by: Chaoscaot <max@chaoscaot.de>
2025-04-12 14:46:41 +02:00
76fc468d89 Merge pull request 'Refactors SchematicNode queries for efficiency' (#39) from improve-search-querry into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #39
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-04-12 14:40:34 +02:00
1304048509 Refactors SchematicNode queries for efficiency
All checks were successful
SteamWarCI Build successful
2025-04-11 00:07:53 +02:00
cf4ac95c2f Bugfix after testing
All checks were successful
SteamWarCI Build successful
2025-04-09 21:04:28 +02:00
4a816696ec Update the message limits
All checks were successful
SteamWarCI Build successful
2025-04-09 09:10:30 +02:00
038f54c3b3 Make it buildable and reduce complexity
All checks were successful
SteamWarCI Build successful
2025-04-09 09:03:07 +02:00
f2d8c9c02b Only AntiTest
All checks were successful
SteamWarCI Build successful
2025-04-08 21:34:41 +02:00
2405c5e620 Fix spectator handling
All checks were successful
SteamWarCI Build successful
2025-04-08 21:31:47 +02:00
d9493c7474 Dont show bedrock players and send an error for getting your own skull as a bedrock player
All checks were successful
SteamWarCI Build successful
2025-04-08 20:58:23 +02:00
2ccb240ef5 Merge remote-tracking branch 'origin/main'
All checks were successful
SteamWarCI Build successful
2025-04-08 20:54:54 +02:00
d1d1679c0a Add /skull shorthand for own skull 2025-04-08 20:54:48 +02:00
4c6ab2c1a0 Improve and fix the discord rate limit warnings
Some checks failed
SteamWarCI Build failed
2025-04-08 20:52:54 +02:00
62002e44d7 Merge pull request 'Add techhiderbug command.' (#36) from FightSystem/techhiderbug into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #36
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-04-07 21:22:39 +02:00
9c3f7526ff Add techhiderbug command.
All checks were successful
SteamWarCI Build successful
2025-04-07 19:37:23 +02:00
eefe17e5f7 Merge pull request 'Use combinedIds to hide in TechHider.iBlockDataHidden' (#35) from hotfix/TechHider into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #35
Reviewed-by: Chaoscaot <max@chaoscaot.de>
2025-04-05 18:12:54 +02:00
812e78d277 Make it 1.8 compatible
All checks were successful
SteamWarCI Build successful
2025-04-05 18:02:48 +02:00
fd220d7fd4 Fix maven url
All checks were successful
SteamWarCI Build successful
2025-04-04 13:57:09 +02:00
446cd5deae Fixup ChecklistChannel
All checks were successful
SteamWarCI Build successful
2025-04-04 11:23:51 +02:00
a6c46d0270 Use combinedIds to hide in TechHider.iBlockDataHidden
All checks were successful
SteamWarCI Build successful
2025-04-04 11:21:54 +02:00
2686ab285b Improve WaitTime in ChecklistChannel
All checks were successful
SteamWarCI Build successful
2025-04-04 11:16:12 +02:00
57ea1470e2 Fix for real!
All checks were successful
SteamWarCI Build successful
2025-04-04 10:54:21 +02:00
bfdc9c118a Hopefully fix it
All checks were successful
SteamWarCI Build successful
2025-04-04 10:52:37 +02:00
dafe838a8a Improve DiscordChannel on discord!
All checks were successful
SteamWarCI Build successful
2025-04-04 10:49:01 +02:00
13bd154383 Merge remote-tracking branch 'origin/main'
All checks were successful
SteamWarCI Build successful
2025-04-03 17:56:22 +02:00
9248c9fa51 Remove first second and third in master rank 2025-04-03 17:56:19 +02:00
764dec99f4 Remove display name cleansing in direct tablist handling
All checks were successful
SteamWarCI Build successful
2025-04-02 19:05:31 +02:00
c9a1528dfe Update UserElo for better distribution
All checks were successful
SteamWarCI Build successful
2025-04-02 10:21:03 +02:00
8c37466312 Revert "Add Alu-Hut"
All checks were successful
SteamWarCI Build successful
This reverts commit b37ded3a8d.
2025-04-02 08:58:42 +02:00
3b7e38aceb Revert "Fix Realtime"
This reverts commit 87f0765506.
2025-04-02 08:58:42 +02:00
e7c4c998a0 Revert "Allow edit of Lobby"
This reverts commit 1dcd2f102c.
2025-04-02 08:58:42 +02:00
5907648462 Revert "Allow edit of Lobby"
This reverts commit f62af55d39.
2025-04-02 08:58:42 +02:00
b32d6e9c69 Revert "Update difficulty"
This reverts commit 47c8cb1701.
2025-04-02 08:58:42 +02:00
f533e85007 Revert "Update difficulty"
This reverts commit 81c310c946.
2025-04-02 08:58:42 +02:00
81c310c946 Update difficulty
All checks were successful
SteamWarCI Build successful
2025-04-01 23:32:32 +02:00
47c8cb1701 Update difficulty
All checks were successful
SteamWarCI Build successful
2025-04-01 23:19:24 +02:00
f62af55d39 Allow edit of Lobby
All checks were successful
SteamWarCI Build successful
2025-04-01 20:58:10 +02:00
1dcd2f102c Allow edit of Lobby
All checks were successful
SteamWarCI Build successful
2025-04-01 20:56:33 +02:00
87f0765506 Fix Realtime
All checks were successful
SteamWarCI Build successful
2025-03-31 22:44:01 +02:00
b37ded3a8d Add Alu-Hut
All checks were successful
SteamWarCI Build successful
2025-03-31 22:37:55 +02:00
c4e9f80315 Fix leader not changeable during events
All checks were successful
SteamWarCI Build successful
2025-03-31 19:56:36 +02:00
19e14f787a Merge pull request 'feat(BauSystem): add tracer lua-lib' (#24) from BauSystem/tracer-lua-lib into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #24
Reviewed-by: Chaoscaot <max@chaoscaot.de>
Reviewed-by: Lixfel <lixfel@noreply.localhost>
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-03-30 17:33:29 +02:00
0f629a6387 Merge pull request 'Feature(BauSystem): Add example hotkey script' (#31) from BauSystem/add-example-scipt into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #31
Reviewed-by: Lixfel <lixfel@noreply.localhost>
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-03-30 17:32:42 +02:00
1a356da6e0 Trigger Rebuild
All checks were successful
SteamWarCI Build successful
2025-03-30 11:17:27 +02:00
f6a18dffcc Trigger Rebuild
All checks were successful
SteamWarCI Build successful
2025-03-30 11:14:20 +02:00
98cc09a7d3 Trigger Rebuild
All checks were successful
SteamWarCI Build successful
2025-03-30 11:11:01 +02:00
4c8a03ac9c Add 30 seconds EndCountdown for TowerRun
All checks were successful
SteamWarCI Build successful
2025-03-29 19:53:09 +01:00
16f2eaad52 fixed Script ordering
All checks were successful
SteamWarCI Build successful
2025-03-25 22:03:59 +01:00
90d2e70a6e Merge branch 'main' into BauSystem/add-example-scipt
All checks were successful
SteamWarCI Build successful
2025-03-25 21:55:04 +01:00
d22b01f5e6 Updated copyright
All checks were successful
SteamWarCI Build successful
2025-03-25 21:54:03 +01:00
71522973a7 Refactor schematic checks to handle unseen notifications
All checks were successful
SteamWarCI Build successful
2025-03-24 16:50:39 +01:00
0da3ebfbcc Merge pull request 'SpigotCore/RDisplay' (#23) from SpigotCore/RDisplay into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #23
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-03-23 18:30:29 +01:00
923142d0cb Merge branch 'main' into SpigotCore/RDisplay
All checks were successful
SteamWarCI Build successful
2025-03-23 18:29:09 +01:00
eca9963653 Add example hotkey script
All checks were successful
SteamWarCI Build successful
2025-03-21 18:49:49 +01:00
9467291020 Add license header to tracer lib
All checks were successful
SteamWarCI Build successful
2025-03-18 21:33:34 +01:00
e14c7321c2 Merge branch 'main' into BauSystem/tracer-lua-lib 2025-03-18 21:31:39 +01:00
50b6947312 Hotfix DiscordChatRoom
All checks were successful
SteamWarCI Build successful
2025-03-13 17:14:17 +01:00
9eca9ab990 Add DepthCommand to toggle Depth Counter
All checks were successful
SteamWarCI Build successful
2025-03-13 17:04:59 +01:00
34e4cd7060 Add click on SimulatorMaterialGui to change material
All checks were successful
SteamWarCI Build successful
2025-03-13 16:53:37 +01:00
30cb09c127 Hotfix ELO on leave
All checks were successful
SteamWarCI Build successful
2025-03-13 16:36:34 +01:00
c94d67660a Fixed doc
All checks were successful
SteamWarCI Build successful
2025-03-12 19:13:47 +01:00
522cd850a2 Add copyright and usage note!
All checks were successful
SteamWarCI Build successful
2025-03-12 08:45:01 +01:00
394591f302 First impl
All checks were successful
SteamWarCI Build successful
2025-03-11 22:58:03 +01:00
3016ad31fa Merge branch 'main' into SpigotCore/RDisplay
All checks were successful
SteamWarCI Build successful
2025-03-11 21:49:27 +01:00
1d293b446c Hotfix WhoisCommand for Developers not showing the User ID
All checks were successful
SteamWarCI Build successful
2025-03-11 18:31:31 +01:00
3b41cc4ac5 Improved tracer Lib
All checks were successful
SteamWarCI Build successful
2025-03-10 22:17:05 +01:00
a71f3f6c66 Merge pull request 'Update Bossbar of FightSystem' (#22) from FightSystem/UpdatedBossBar into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #22
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-03-09 18:27:27 +01:00
2225b811fa Update Bossbar of FightSystem
All checks were successful
SteamWarCI Build successful
2025-03-09 18:18:13 +01:00
96c25687b6 Hotfix SendCommand
All checks were successful
SteamWarCI Build successful
2025-03-08 22:16:39 +01:00
82723e4c31 Hotfix ShieldPrinting pasting AIR, it should not
All checks were successful
SteamWarCI Build successful
2025-03-08 18:34:22 +01:00
17eaefe3d0 Hotfix ShieldPrinting pasting AIR, it should not
All checks were successful
SteamWarCI Build successful
2025-03-08 17:51:41 +01:00
911a08a156 Merge remote-tracking branch 'origin/main'
All checks were successful
SteamWarCI Build successful
2025-03-08 17:44:55 +01:00
b60111e717 Hotfix ShieldPrinting pasting AIR, it should not 2025-03-08 17:44:46 +01:00
644cc9da84 Fix /arena bugs with event arenas
All checks were successful
SteamWarCI Build successful
2025-03-08 15:58:54 +01:00
29cb1cc5da Implemented first tracer lib version
All checks were successful
SteamWarCI Build successful
2025-03-08 01:11:24 +01:00
9bc1f8b328 Refactor password check and add cache clearance.
All checks were successful
SteamWarCI Build successful
2025-03-04 21:05:01 +01:00
f38b85f9cb Fix TPSSystem in 1.21 and beyond
All checks were successful
SteamWarCI Build successful
2025-03-03 11:27:46 +01:00
600c24441c Fix final things
All checks were successful
SteamWarCI Build successful
2025-03-03 10:09:54 +01:00
f3b5a45f62 Fix final things
All checks were successful
SteamWarCI Build successful
2025-03-03 10:05:08 +01:00
caee70c07e Hotfix some exceptions
All checks were successful
SteamWarCI Build successful
2025-03-03 10:01:56 +01:00
5f73395b63 Hotfix some exceptions
All checks were successful
SteamWarCI Build successful
2025-03-03 09:56:12 +01:00
b4eab65757 Hotfix xsome exceptions
All checks were successful
SteamWarCI Build successful
2025-03-03 09:42:39 +01:00
0a60654a28 Add some of the Easter Particles
All checks were successful
SteamWarCI Build successful
2025-03-03 09:35:42 +01:00
85c0db873c Final Hotfix of Send Command!
All checks were successful
SteamWarCI Build successful
2025-03-02 19:09:59 +01:00
f0beb22856 Hotfix the "to" back in
All checks were successful
SteamWarCI Build successful
2025-03-02 18:54:59 +01:00
af55c946a6 Remove player length constraint
All checks were successful
SteamWarCI Build successful
2025-03-02 18:51:01 +01:00
8b49b8a736 Add player respawn handling with custom spawn location
All checks were successful
SteamWarCI Build successful
2025-03-02 15:31:33 +01:00
6d4ae9593d Refine eventFight ID check in TNTLeagueConfig initialization.
All checks were successful
SteamWarCI Build successful
2025-03-02 15:14:10 +01:00
2fad352f62 Fix event initialization check in TNTLeagueConfig
All checks were successful
SteamWarCI Build successful
2025-03-02 15:02:11 +01:00
2d28cc6182 Fix isEvent function to correctly check eventFightId
All checks were successful
SteamWarCI Build successful
2025-03-02 14:58:26 +01:00
b0bd719627 Backend Fixes
All checks were successful
SteamWarCI Build successful
2025-03-02 09:08:49 +01:00
284c4acd4b Merge pull request 'Add event count to Team info' (#21) from VelocityCore/TeamInfoEventCount into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #21
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-03-01 21:45:06 +01:00
96a4168f37 Add event count to Team info
All checks were successful
SteamWarCI Build successful
2025-03-01 21:40:54 +01:00
c77b8f57ce Merge pull request 'Configurable techhider interaction suppression' (#19) from config-techhider-interaction-suppression into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #19
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-03-01 08:34:05 +01:00
e3c02cfb60 Revert "Update VV dependency version"
All checks were successful
SteamWarCI Build successful
This reverts commit 9f108a7cea.
2025-03-01 08:33:15 +01:00
ade9a1b5eb Allow TNT in shulker boxes
All checks were successful
SteamWarCI Build successful
2025-03-01 08:32:19 +01:00
ce907389df Refactor SQL query to remove schema qualifiers.
All checks were successful
SteamWarCI Build successful
2025-02-25 22:46:54 +01:00
d9b58d7170 Merge pull request 'Authentication v2' (#17) from Backend/new-auth into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #17
2025-02-25 22:40:09 +01:00
3db327eb84 Merge branch 'main' into Backend/new-auth
All checks were successful
SteamWarCI Build successful
2025-02-25 22:39:59 +01:00
fd82707414 Update webpassword command and clean up deprecated logic
All checks were successful
SteamWarCI Build successful
2025-02-23 17:27:29 +01:00
a2b3661605 Refactor V2 Auth
All checks were successful
SteamWarCI Build successful
2025-02-23 17:24:14 +01:00
b045f16160 Remove deprecated configureAuthRoutes function call
All checks were successful
SteamWarCI Build successful
2025-02-20 22:40:18 +01:00
dea0d33185 Refactor token generation and remove unused endpoints.
All checks were successful
SteamWarCI Build successful
2025-02-20 22:13:13 +01:00
11cf0b6c54 Merge pull request 'Add LegacyBauSystem with adaptions to current SpigotCore' (#20) from legacy-bau-system into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #20
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-02-20 06:46:06 +01:00
593ca9f0cf Merge pull request 'VelocityCore/SendCommand2.0' (#18) from VelocityCore/SendCommand2.0 into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #18
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-02-19 21:22:11 +01:00
7f5b57516e Reduce access token duration and enhance auth endpoints
All checks were successful
SteamWarCI Build successful
2025-02-17 18:28:43 +01:00
8ec12603b6 Add password reset URL generation and backend validation
All checks were successful
SteamWarCI Build successful
2025-02-17 17:48:26 +01:00
ef029eb420 Add LegacyBauSystem with adaptions to current SpigotCore
All checks were successful
SteamWarCI Build successful
2025-02-16 19:40:18 +01:00
9f108a7cea Update VV dependency version
Some checks failed
SteamWarCI Build failed
2025-02-16 17:25:18 +01:00
b516d1d569 Configurable techhider interaction suppression
All checks were successful
SteamWarCI Build successful
2025-02-16 17:14:55 +01:00
56e1abca7e Kick player on Channel injection failure
All checks were successful
SteamWarCI Build successful
2025-02-16 17:09:27 +01:00
5420c19b39 Add SCRIPT.md and sw.def.lua
All checks were successful
SteamWarCI Build successful
2025-02-14 20:34:49 +01:00
dd9467fa36 Hotfix TeamPlayer.onPlayerInteractEntity
All checks were successful
SteamWarCI Build successful
2025-02-14 16:53:26 +01:00
ccbac9f7fb Merge branch 'main' into VelocityCore/SendCommand2.0
All checks were successful
SteamWarCI Build successful
2025-02-13 20:40:16 +01:00
6aeecd444e Authentication v2
All checks were successful
SteamWarCI Build successful
2025-02-04 21:47:29 +01:00
ec43e7eba8 Trigger rebuild
All checks were successful
SteamWarCI Build successful
2025-02-02 16:29:10 +01:00
fbea45fb0f Merge pull request 'Add server shutdown if less than 2 players after 5 minutes' (#15) from TNTLeague/auto-shutdown into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #15
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-02-02 16:15:52 +01:00
abbbf7d3cb Merge branch 'main' into TNTLeague/auto-shutdown
All checks were successful
SteamWarCI Build successful
2025-02-02 16:14:25 +01:00
1dc0c0d8a8 Merge pull request 'Add ReadyCommand' (#16) from TNTLeague/add-ready-command into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #16
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-02-02 16:14:20 +01:00
25cf1ab314 Add ReadyCommand
All checks were successful
SteamWarCI Build successful
2025-02-02 16:11:02 +01:00
1715fdccdf Remove unused imports in TNTLeague classes
All checks were successful
SteamWarCI Build successful
2025-02-02 16:07:24 +01:00
e39db5978b Add server shutdown if less than 2 players after 5 minutes
All checks were successful
SteamWarCI Build successful
2025-02-02 16:06:48 +01:00
b4baef321f Trigger rebuild
All checks were successful
SteamWarCI Build successful
2025-02-02 15:28:33 +01:00
93ab1a50f3 Fix team auto-assign logic in lobby state
All checks were successful
SteamWarCI Build successful
Replaced `members.add` with `join` to correctly integrate new players into teams during the lobby phase. This ensures proper team setup and adherence to game mechanics.
2025-02-02 14:12:25 +01:00
c6a7107ec2 Merge pull request 'Make TNTLeague Event System Capable' (#13) from TNTLeague/add-event into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #13
Reviewed-by: Lixfel <lixfel@noreply.localhost>
2025-02-02 13:03:02 +01:00
8ac5fe44ef Merge pull request 'Make TowerRun Event System Capable' (#14) from TowerRun/event into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #14
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-02-02 12:55:26 +01:00
414bd20eb9 Make TowerRun Event System Capable
All checks were successful
SteamWarCI Build successful
2025-02-01 22:58:49 +01:00
482282f913 Make TNTLeague Event System Capable
All checks were successful
SteamWarCI Build successful
2025-02-01 22:00:36 +01:00
3d153d49b5 Make TNTLeague Event System Capable
All checks were successful
SteamWarCI Build successful
2025-02-01 21:50:36 +01:00
20c90d9af5 Remove randomness
All checks were successful
SteamWarCI Build successful
2025-01-30 13:23:46 +01:00
c799046f43 Add bigger coins and remove TNT from spawning 2025-01-30 13:23:43 +01:00
90666e2d20 Merge pull request 'Add teamsOnSameLine for Arena Monochrome' (#5) from TNTLeague/TeamsOnSameLine into main
All checks were successful
SteamWarCI Build successful
Reviewed-on: #5
Reviewed-by: Chaoscaot <max@chaoscaot.de>
Reviewed-by: YoyoNow <yoyonow@noreply.localhost>
2025-01-29 21:20:19 +01:00
77c6f41f1a Merge branch 'main' into TNTLeague/TeamsOnSameLine
All checks were successful
SteamWarCI Build successful
2025-01-29 21:19:35 +01:00
315674ebd8 Merge branch 'main' into TNTLeague/TeamsOnSameLine
All checks were successful
SteamWarCI Build successful
2025-01-24 22:44:47 +01:00
658dcd024d Add teamsOnSameLine for Arena Monochrome 2025-01-20 01:04:09 +01:00
bfdf6471d2 Cleanup things and fix setting back to default
Some checks failed
SteamWarCI Build failed
2025-01-08 16:52:24 +01:00
e418109ab7 Reduce spawn packets to 0 if everything is default 2025-01-08 16:27:18 +01:00
82c73f9367 Fix packet count to at most 2 for the display entities at spawn 2025-01-08 12:24:17 +01:00
1f65121c68 Fixup postSpawn because of NPE/Not Initialized Exception 2025-01-07 18:41:50 +01:00
3c848389c9 Update structure 2025-01-07 18:41:50 +01:00
33f41869b6 Fix packets 2025-01-07 18:41:50 +01:00
3c1d46398d Add RDisplay, RBlockDisplay, RItemDisplay, RTextDisplay 2025-01-07 18:41:50 +01:00
9a8cb543e9 Update SendCommand
Some checks failed
SteamWarCI Build failed
2025-01-07 14:27:57 +01:00
55adb1a052 Improve SendCommand 2024-12-22 23:16:19 +01:00
378 changed files with 17336 additions and 2009 deletions

4
.gitignore vendored
View File

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

View File

@ -109,7 +109,7 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
@Override
public void setSelection(Player p, Point minPoint, Point maxPoint) {
WORLDEDIT_PLUGIN.getSession(p).setRegionSelector(BUKKITWORLD, new CuboidRegionSelector(BUKKITWORLD, toBlockVector3(minPoint), toBlockVector3(maxPoint)));
WORLDEDIT_PLUGIN.getSession(p).setRegionSelector(BUKKITWORLD, new CuboidRegionSelector(BUKKITWORLD, minPoint.toBlockVector3(), maxPoint.toBlockVector3()));
}
@Override
@ -178,9 +178,9 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
pastePoint.set(v);
if (pasteBuilder.isReset()) {
e.setBlocks(new CuboidRegion(toBlockVector3(pasteBuilder.getMinPoint()), toBlockVector3(pasteBuilder.getMaxPoint())), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
e.setBlocks(new CuboidRegion(pasteBuilder.getMinPoint().toBlockVector3(), pasteBuilder.getMaxPoint().toBlockVector3()), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
if (pasteBuilder.getWaterLevel() != 0) {
e.setBlocks(new CuboidRegion(toBlockVector3(pasteBuilder.getMinPoint()), toBlockVector3(pasteBuilder.getMaxPoint()).withY(pasteBuilder.getWaterLevel())), Objects.requireNonNull(BlockTypes.WATER).getDefaultState().toBaseBlock());
e.setBlocks(new CuboidRegion(pasteBuilder.getMinPoint().toBlockVector3(), pasteBuilder.getMaxPoint().toBlockVector3().withY(pasteBuilder.getWaterLevel())), Objects.requireNonNull(BlockTypes.WATER).getDefaultState().toBaseBlock());
}
}
Operations.completeBlindly(ch.createPaste(e).to(v).ignoreAirBlocks(pasteBuilder.isIgnoreAir()).build());
@ -193,7 +193,7 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
@Override
public Clipboard copy(Point minPoint, Point maxPoint, Point copyPoint) {
BukkitWorld bukkitWorld = new BukkitWorld(Bukkit.getWorlds().get(0));
CuboidRegion region = new CuboidRegion(bukkitWorld, toBlockVector3(minPoint), toBlockVector3(maxPoint));
CuboidRegion region = new CuboidRegion(bukkitWorld, minPoint.toBlockVector3(), maxPoint.toBlockVector3());
BlockArrayClipboard clipboard = new BlockArrayClipboard(region);
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(bukkitWorld, -1)) {
ForwardExtentCopy copy = new ForwardExtentCopy(
@ -204,7 +204,7 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
copy.setCopyingBiomes(false);
Operations.complete(copy);
clipboard.setOrigin(toBlockVector3(copyPoint));
clipboard.setOrigin(copyPoint.toBlockVector3());
return clipboard;
} catch (WorldEditException e) {
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e);
@ -224,10 +224,6 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
}
}
private BlockVector3 toBlockVector3(Point point) {
return BlockVector3.at(point.getX(), point.getY(), point.getZ());
}
@Override
public boolean inWater(org.bukkit.World world, Vector tntPosition) {
Block block = world.getBlockAt(tntPosition.getBlockX(), tntPosition.getBlockY(), tntPosition.getBlockZ());

View File

@ -21,41 +21,39 @@ package de.steamwar.bausystem.utils;
import de.steamwar.Reflection;
import de.steamwar.bausystem.features.util.NoClipCommand;
import net.minecraft.core.component.DataComponents;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.protocol.game.PacketPlayInSetCreativeSlot;
import net.minecraft.network.protocol.game.PacketPlayOutExplosion;
import net.minecraft.network.protocol.game.PacketPlayOutGameStateChange;
import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.PlayerInteractManager;
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 io.papermc.paper.datacomponent.DataComponentTypes;
import io.papermc.paper.datacomponent.item.ItemContainerContents;
import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
import net.minecraft.network.protocol.game.ClientboundExplodePacket;
import net.minecraft.network.protocol.game.ClientboundGameEventPacket;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.level.ServerPlayerGameMode;
import net.minecraft.world.entity.player.Abilities;
import net.minecraft.world.level.GameType;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_21_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_21_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerGameModeChangeEvent;
import org.bukkit.inventory.ItemStack;
import java.util.List;
import java.util.Optional;
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
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
public void setSlotToItemStack(Player player, Object o) {
PacketPlayInSetCreativeSlot packetPlayInSetCreativeSlot = (PacketPlayInSetCreativeSlot) o;
int index = packetPlayInSetCreativeSlot.b();
ClientboundContainerSetSlotPacket packetPlayInSetCreativeSlot = (ClientboundContainerSetSlotPacket) o;
int index = packetPlayInSetCreativeSlot.getSlot();
if (index >= 36 && index <= 44) {
index -= 36;
} else if (index > 44) {
@ -63,25 +61,23 @@ public class NMSWrapper21 implements NMSWrapper {
} else if (index <= 8) {
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);
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
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
public void setPlayerBuildAbilities(Player player) {
PlayerAbilities abilities = playerAbilities.get(((CraftPlayer) player).getHandle());
abilities.d = true;
abilities.e = true;
Abilities abilities = (((CraftPlayer) player).getHandle()).getAbilities();
abilities.mayBuild = true;
abilities.mayfly = true;
}
@Override
@ -93,49 +89,45 @@ public class NMSWrapper21 implements NMSWrapper {
@Override
public boolean checkItemStack(ItemStack item) {
net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
NBTTagCompound tag = nmsItem.a(DataComponents.b, CustomData.a).c();
if (tag.e("BlockEntityTag")) {
NBTTagCompound blockTag = tag.p("BlockEntityTag");
if (blockTag.e("Items")) {
return drillDown(blockTag.c("Items", 10), 0, 0) > threshold;
}
}
ItemContainerContents data = item.getData(DataComponentTypes.CONTAINER);
if (data == null) {
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;
int invalid = start;
for (NBTBase nbtBase : items) {
if (!(nbtBase instanceof NBTTagCompound slot))
for (int i = start; i < items.size(); i++) {
ItemStack item = items.get(i);
if (item.isEmpty()) continue;
invalid += item.getAmount();
ItemContainerContents data = item.getData(DataComponentTypes.CONTAINER);
if (data == null) {
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;
}
@Override
public Object resetExplosionKnockback(Object packet) {
PacketPlayOutExplosion explosion = (PacketPlayOutExplosion) packet;
ClientboundExplodePacket explosion = (ClientboundExplodePacket) packet;
return new PacketPlayOutExplosion(
explosion.b(),
return new ClientboundExplodePacket(
explosion.center(),
Optional.empty(),
explosion.f(),
explosion.g()
explosion.explosionParticle(),
explosion.explosionSound()
);
}
}

View File

@ -38,6 +38,7 @@ SCOREBOARD_TRACE_TICKS=Ticks
SCOREBOARD_TECHHIDER=TechHider§8: §aOn
SCOREBOARD_XRAY=XRay§8: §aOn
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_SERVERTEAM=Bau Lock§8: §eServer Team
SCOREBOARD_LOCK_NOBODY=Bau Lock§8: §cNobody
@ -406,6 +407,8 @@ BLOCK_COUNTER_MESSAGE_SECOND=§7Damage §8> §e{0} §7Blocks §e{1} §7TNT §e
BLOCK_COUNTER_ENABLE=§7BlockCounter activated
BLOCK_COUNTER_DISABLE=§7BlockCounter deactivated
# DepthCounter
DEPTH_COUNTER_DISABLE=§7Depth Counter disabled
DEPTH_COUNTER_ENABLE=§7Depth Counter enabled
DEPTH_COUNTER_MESSAGE=§7Depth §8> §7
DEPTH_COUNTER_COUNT={0}{1}§8×{2}{3}§8×{4}{5}
DEPTH_COUNTER_HOVER=§7X§8×§7Y§8×§7Z
@ -512,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_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_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_HOW_TO_START=§7Then, execute /§eloader start§7 to start the Loader
LOADER_ACTIVE=§7The Loader is now active.
@ -844,7 +847,7 @@ LAUFBAU_SETTINGS_INACTIVE=§cInactive
LAUFBAU_SETTINGS_MIXED=§e{0}§8/§e{1} §aActive
LAUFBAU_SETTINGS_GUI_BACK=§eBack
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_GRASS_PATH=§eGrass Path
LAUFBAU_BLOCK_SOUL_SAND=§eSoul Sand
@ -945,6 +948,9 @@ SPEED_TAB_NAME=Input speed
WORLDEDIT_WAND=WorldEdit Wand
WORLDEDIT_LEFTCLICK=Left click: select pos #1
WORLDEDIT_RIGHTCLICK=Right click: select pos #2
TNT_DETAILS_COMMAND=§8/§etntdetails §8-§7 Toggle information printed after clicking on a TNT
TNT_DETAILS_ON = §eTNTDetails §aactivated
TNT_DETAILS_OFF = §eTNTDetails §cdeactivated
TNT_CLICK_HEADER=§8---=== §eTNT §8===---
TNT_CLICK_ORDER=§eEntity Order§8: §e{0}
TNT_CLICK_FUSE_TIME=§eFuseTime§8: §e{0}

View File

@ -369,6 +369,8 @@ BLOCK_COUNTER_MESSAGE_SECOND=§7Schaden §8> §e{0} §7Blöcke §e{1} §7TNT
BLOCK_COUNTER_ENABLE=§7BlockCounter angemacht
BLOCK_COUNTER_DISABLE=§7BlockCounter ausgemacht
# DepthCounter
DEPTH_COUNTER_DISABLE=§7Depth Counter deaktiviert
DEPTH_COUNTER_ENABLE=§7Depth Counter aktiviert
DEPTH_COUNTER_MESSAGE=§7Tiefe §8> §7
# TPSLimit
TPSLIMIT_FREEZE_HELP=§8/§etpslimit 0 §8-§7 Friere TPS ein
@ -790,7 +792,7 @@ LAUFBAU_SETTINGS_INACTIVE=§cInaktiv
LAUFBAU_SETTINGS_MIXED=§e{0}§8/§e{1} §aAktiv
LAUFBAU_SETTINGS_GUI_BACK=§eBack
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_GRASS_PATH=§eGrass Path
LAUFBAU_BLOCK_SOUL_SAND=§eSoul Sand
@ -887,6 +889,9 @@ SPEED_TAB_NAME=Geschwindigkeit eingeben
WORLDEDIT_WAND=WorldEdit Wand
WORLDEDIT_LEFTCLICK=Left click: select pos #1
WORLDEDIT_RIGHTCLICK=Right click: select pos #2
TNT_DETAILS_COMMAND=§8/§etntdetails §8-§7 Aktiviert/Deaktiviert das senden von Details beim Klick auf TNT
TNT_DETAILS_ON = §eTNTDetails §aaktiviert
TNT_DETAILS_OFF = §eTNTDetails §cdeaktiviert
TNT_CLICK_HEADER=§8---=== §eTNT §8===---
TNT_CLICK_ORDER=§eEntity Order§8: §e{0}
TNT_CLICK_FUSE_TIME=§eFuseTime§8: §e{0}

View File

@ -19,6 +19,7 @@
package de.steamwar.bausystem;
import de.steamwar.core.WorldEditRendererCUIEditor;
import de.steamwar.bausystem.config.BauServer;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.bausystem.configplayer.ConfigConverter;
@ -206,6 +207,8 @@ public class BauSystem extends JavaPlugin {
TraceManager.instance.init();
TraceRecorder.instance.init();
new WorldEditRendererCUIEditor();
}
@Override

View File

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.cannon.depth;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
@ -65,7 +66,9 @@ public class Depth {
dimensions.setZ(Math.abs(dimensions.getZ()));
RegionUtils.message(region, player -> {
if (Config.getInstance().get(player).getPlainValueOrDefault("depth_message", true)) {
player.spigot().sendMessage(getMessage(player, dimensions.getBlockX() + 1, dimensions.getBlockY() + 1, dimensions.getBlockZ() + 1, tntCount));
}
});
}

View File

@ -0,0 +1,45 @@
/*
* 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.features.cannon.depth;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import org.bukkit.entity.Player;
@Linked
public class DepthCommand extends SWCommand {
public DepthCommand() {
super("depth");
}
@Register
public void toggle(Player player) {
if (Config.getInstance().get(player).getPlainValueOrDefault("depth_message", true)) {
Config.getInstance().get(player).put("depth_message", false);
BauSystem.MESSAGE.send("DEPTH_COUNTER_DISABLE", player);
} else {
Config.getInstance().get(player).put("depth_message", true);
BauSystem.MESSAGE.send("DEPTH_COUNTER_ENABLE", player);
}
}
}

View File

@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.gui.BauGUI;
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
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 -> {
}).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.getOpenInventory().setCursor(cursor == null ? new SWItem().getItemStack() : cursor);

View File

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.loader.elements;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWInventory;
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 -> {
backAction.run();
}));
}).setCustomModelData(CMDs.BACK));
listInv.setItem(50, new SWItem(Material.GHAST_SPAWN_EGG, "§7Insert another Setting", clickType -> {
elements.add(defaultSetting);
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));
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 -> {
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_GUI_COPY_TITLE", player), "1");
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.features.loader.elements.LoaderElement;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
@ -60,7 +61,7 @@ public class LoaderWait implements LoaderElement {
public void click(Player player, Runnable backAction) {
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"));
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 -> {
delay -= clickType.isShiftClick() ? 5 : 1;

View File

@ -11,8 +11,9 @@ import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.type.NoteBlock;
import org.bukkit.block.data.type.Switch;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -60,6 +61,24 @@ public class FreezeListener implements Listener, ScoreboardElement {
@EventHandler
public void onPhysicsEvent(BlockPhysicsEvent e) {
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
if (e.getSourceBlock().getType() == Material.NOTE_BLOCK) {
BlockState state = e.getSourceBlock().getState();
NoteBlock noteBlock = (NoteBlock) state.getBlockData();
if (noteBlock.isPowered()) {
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
state.update(true, false);
}, 1);
}
}
if (e.getBlock().getType() == Material.NOTE_BLOCK) {
BlockState state = e.getBlock().getState();
NoteBlock noteBlock = (NoteBlock) state.getBlockData();
if (noteBlock.isPowered()) {
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
state.update(true, false);
}, 1);
}
}
e.setCancelled(true);
}
}
@ -71,6 +90,105 @@ public class FreezeListener implements Listener, ScoreboardElement {
}
}
@EventHandler
public void onNotePlay(NotePlayEvent event) {
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=45, z=98},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=44, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=45, z=97},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=45, z=99},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=45, z=97},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=96},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=45, z=99},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-108, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=45, z=98},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-104, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=45, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=49, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
////[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=102},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-108, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-104, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
}
@EventHandler
public void onPistonRetract(BlockPistonRetractEvent e) {
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
@ -108,13 +226,13 @@ public class FreezeListener implements Listener, ScoreboardElement {
}
}
@EventHandler(priority = EventPriority.MONITOR)
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent e) {
if (Core.getVersion() < 19) return;
if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) return;
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
if (e.isCancelled()) return;
e.setCancelled(true);
e.getBlock().setType(Material.BARRIER, false);
e.getBlock().setType(Material.AIR, false);
}
}

View File

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

View File

@ -51,7 +51,7 @@ public class TpsLib implements LuaLib {
tpsLib.set("fiveMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES)));
tpsLib.set("tenMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES)));
tpsLib.set("current", getter(TPSWatcher::getTPS));
tpsLib.set("limit", getter(tpsSystem::getCurrentTPSLimit));
tpsLib.set("limit", getter(TPSSystem::getCurrentTPSLimit));
return tpsLib;
}
}

View File

@ -0,0 +1,113 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.script.lua.libs;
import de.steamwar.bausystem.features.tracer.TNTPoint;
import de.steamwar.bausystem.features.tracer.Trace;
import de.steamwar.bausystem.features.tracer.TraceManager;
import de.steamwar.linkage.Linked;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import org.luaj.vm2.LuaTable;
import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.ZeroArgFunction;
@Linked
public class TracerLib implements LuaLib {
@Override
public String name() {
return "tracer";
}
private static LuaTable convertTrace(Trace trace) {
LuaTable luaTrace = new LuaTable();
luaTrace.set("getRecords", new ZeroArgFunction() {
@Override
public LuaValue call() {
return LuaValue.listOf(
trace.getHistories()
.stream()
.map((history) -> LuaValue.listOf(history
.stream()
.map(TracerLib::convertTntPoint)
.toArray(LuaValue[]::new)))
.toArray(LuaValue[]::new));
}
});
luaTrace.set("getId", new ZeroArgFunction() {
@Override
public LuaValue call() {
return LuaValue.valueOf(trace.getUuid().toString());
}
});
return luaTrace;
}
private static LuaTable convertTntPoint(TNTPoint tntPoint) {
Location pointPos = tntPoint.getLocation();
LuaTable luaPos = LuaValue.tableOf(new LuaValue[]{
LuaValue.valueOf("x"), LuaValue.valueOf(pointPos.getX()),
LuaValue.valueOf("y"), LuaValue.valueOf(pointPos.getY()),
LuaValue.valueOf("z"), LuaValue.valueOf(pointPos.getZ()),
});
Vector pointVel = tntPoint.getVelocity();
LuaTable luaVel = LuaValue.tableOf(new LuaValue[]{
LuaValue.valueOf("x"), LuaValue.valueOf(pointVel.getX()),
LuaValue.valueOf("y"), LuaValue.valueOf(pointVel.getY()),
LuaValue.valueOf("z"), LuaValue.valueOf(pointVel.getZ()),
});
return LuaValue.tableOf(new LuaValue[]{
LuaValue.valueOf("pos"), luaPos,
LuaValue.valueOf("vel"), luaVel,
LuaValue.valueOf("ticksSinceStart"), LuaValue.valueOf(tntPoint.getTicksSinceStart()),
LuaValue.valueOf("fuse"), LuaValue.valueOf(tntPoint.getFuse()),
LuaValue.valueOf("isExplosion"), LuaValue.valueOf(tntPoint.isExplosion()),
LuaValue.valueOf("isInWater"), LuaValue.valueOf(tntPoint.isInWater()),
LuaValue.valueOf("hasDestroyedBuild"), LuaValue.valueOf(tntPoint.isDestroyedBuildArea()),
LuaValue.valueOf("hasDestroyedTestblock"), LuaValue.valueOf(tntPoint.isDestroyedTestBlock())
});
}
@Override
public LuaTable get(Player player) {
LuaTable rootTable = LuaValue.tableOf();
rootTable.set("getTraces", new ZeroArgFunction() {
@Override
public LuaValue call() {
return LuaValue.listOf(TraceManager.instance.getAll()
.stream()
.map(TracerLib::convertTrace)
.toArray(LuaValue[]::new));
}
}
);
return rootTable;
}
}

View File

@ -160,6 +160,11 @@ public class ShieldPrinting implements Listener {
private void paste(Map<Material, BlockDataConfiguration<?>[]> stateConfiguration) {
for (Map.Entry<Vector, BlockData> entry : shieldData.entrySet()) {
BlockData copied = entry.getValue();
if (copied.getMaterial().isAir()) {
continue;
}
Block block = entry.getKey().toLocation(WORLD).getBlock();
if (entry.getValue().getMaterial() != block.getType()) {
block.setBlockData(entry.getValue(), false);
@ -171,12 +176,11 @@ public class ShieldPrinting implements Listener {
BlockDataConfiguration[] stateConfigurations = stateConfiguration.get(entry.getValue().getMaterial());
if (stateConfigurations == null) {
block.setBlockData(entry.getValue(), false);
continue;
}
BlockData worldOriginal = block.getBlockData();
BlockData copied = entry.getValue().clone();
copied = copied.clone();
for (BlockDataConfiguration blockDataConfiguration : stateConfigurations) {
if (blockDataConfiguration == null) continue;
blockDataConfiguration.apply(copied, worldOriginal);

View File

@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.execute.SimulatorExecutor;
import de.steamwar.bausystem.features.simulator.preview.SimulatorPreviewCalculator;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper;
@ -30,6 +31,7 @@ import de.steamwar.command.TypeValidator;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import de.steamwar.linkage.MinVersion;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -76,7 +78,7 @@ public class SimulatorCommand extends SWCommand {
@Register(value = "start", description = "SIMULATOR_START_HELP")
public void start(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator) {
SimulatorExecutor.run(simulator);
SimulatorExecutor.run(simulator, () -> {});
}
@Register(value = "rename", description = "SIMULATOR_RENAME_HELP")
@ -90,6 +92,20 @@ public class SimulatorCommand extends SWCommand {
}
}
@Register(value = "test")
public void test(Player player) {
for (int i = 0; i < 1; i++) {
SimulatorPreviewCalculator data = new SimulatorPreviewCalculator(null);
data.spawnTNT(0, 166, 0);
data.calculate(simulatorPreviewResult -> {
simulatorPreviewResult.show(player);
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
simulatorPreviewResult.hide(player);
}, 100);
});
}
}
@ClassMapper(value = Simulator.class, local = true)
public TypeMapper<Simulator> allSimulators() {
return new TypeMapper<>() {

View File

@ -168,9 +168,19 @@ public class SimulatorCursor implements Listener {
}
return;
}
Simulator simulator = SimulatorStorage.getSimulator(player);
SimulatorWatcher.show(simulator, player);
Simulator simulator = SimulatorStorage.getSimulator(player);
if (simulator != null && simulator.getStabGenerator() != null) {
removeCursor(player);
SimulatorWatcher.show(null, player);
SWUtils.sendToActionbar(player, "§cGenerating Stab");
synchronized (calculating) {
calculating.remove(player);
}
return;
}
SimulatorWatcher.show(simulator, player);
List<REntity> entities = SimulatorWatcher.getEntitiesOfSimulator(simulator);
RayTraceUtils.RRayTraceResult rayTraceResult = RayTraceUtils.traceREntity(player, player.getLocation(), entities);
if (rayTraceResult == null) {
@ -357,7 +367,7 @@ public class SimulatorCursor implements Listener {
if (simulator == null) {
return;
}
SimulatorExecutor.run(simulator);
SimulatorExecutor.run(simulator, () -> {});
return;
}

View File

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.simulator.data;
import de.steamwar.bausystem.features.simulator.execute.SimulatorAction;
import de.steamwar.bausystem.features.simulator.execute.SimulatorStabGenerator;
import de.steamwar.inventory.InvCallback;
import de.steamwar.inventory.SWItem;
import lombok.Getter;
@ -30,13 +31,13 @@ import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
@Getter
@Setter
@RequiredArgsConstructor
public final class Simulator {
private SimulatorStabGenerator stabGenerator = null;
private Material material = Material.BARREL;
private final String name;
private boolean autoTrace = false;

View File

@ -60,6 +60,7 @@ public final class TNTPhase extends SimulatorPhase {
@Override
public void toSimulatorActions(Vector position, BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd) {
if (count <= 0) return;
tickStart.accept(tickOffset, new SimulatorAction(order, count) {
@Override
public void accept(World world) {

View File

@ -0,0 +1,34 @@
/*
* 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.features.simulator.execute;
import lombok.AllArgsConstructor;
import org.bukkit.util.Vector;
import java.util.function.Function;
@AllArgsConstructor
public enum Direction {
X(Vector::getBlockX),
Y(Vector::getBlockY),
Z(Vector::getBlockZ);
public final Function<Vector, Integer> component;
}

View File

@ -46,7 +46,7 @@ public class SimulatorExecutor implements Listener {
private static Map<Long, Map<Integer, List<SimulatorAction>>> tickStartActions = new HashMap<>();
private static Map<Long, List<SimulatorAction>> tickEndActions = new HashMap<>();
public static boolean run(Simulator simulator) {
public static boolean run(Simulator simulator, Runnable onEnd) {
if (currentlyRunning.contains(simulator)) return false;
currentlyRunning.add(simulator);
@ -69,7 +69,7 @@ public class SimulatorExecutor implements Listener {
public void accept(World world) {
currentlyRunning.remove(simulator);
if (simulator.isAutoTrace()) {
if (simulator.isAutoTrace() && onEnd == null) {
simulator.getGroups()
.stream()
.map(SimulatorGroup::getElements)
@ -82,10 +82,12 @@ public class SimulatorExecutor implements Listener {
TraceRecorder.instance.stopRecording(region);
});
}
onEnd.run();
}
});
if (simulator.isAutoTrace()) {
if (simulator.isAutoTrace() && onEnd == null) {
simulator.getGroups()
.stream()
.map(SimulatorGroup::getElements)

View File

@ -0,0 +1,45 @@
/*
* 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.features.simulator.execute;
import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.utils.bossbar.BossBarService;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class SimulatorStabGenerator {
private final StabData stabData;
public SimulatorStabGenerator(Region region, Simulator simulator, TNTElement tntElement, int depthLimit) {
stabData = new StabData(region, simulator, tntElement, tntElement.getPhases(), depthLimit);
new StabSetup(stabData);
}
public void cancel() {
stabData.cancel = true;
stabData.simulator.setStabGenerator(null);
for (Player player : Bukkit.getOnlinePlayers()) {
BossBarService.instance.remove(player, stabData.region, "simulator_stab_generator");
}
}
}

View File

@ -0,0 +1,52 @@
/*
* 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.features.simulator.execute;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
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.TNTPhase;
import de.steamwar.bausystem.region.Region;
import lombok.RequiredArgsConstructor;
import java.util.List;
import java.util.logging.Level;
@RequiredArgsConstructor
public class StabData {
protected static final int MAX_RECORDINGS = 5;
protected static final int MAX_TICK_DIFFERENCE = 3;
protected static final Level LEVEL = Level.INFO;
protected static final int TNT_INCREASE = 10;
protected static final int MIN_BLOCK_TO_COUNT_AS_DEPTH = 20;
protected final Region region;
protected final Simulator simulator;
protected final TNTElement tntElement;
protected final List<TNTPhase> phases;
protected final int depthLimit;
protected Clipboard clipboard;
protected boolean cancel = false;
protected Direction direction = null;
protected int currentDepth = 0;
}

View File

@ -0,0 +1,103 @@
/*
* 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.features.simulator.execute;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.block.BlockTypes;
import de.steamwar.bausystem.features.simulator.data.SimulatorPhase;
import de.steamwar.bausystem.features.tracer.TNTPoint;
import de.steamwar.bausystem.features.tracer.Trace;
import de.steamwar.bausystem.features.tracer.TraceManager;
import de.steamwar.bausystem.features.tracer.TraceRecorder;
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
import org.bukkit.Bukkit;
import org.bukkit.util.Vector;
import java.util.List;
import java.util.Objects;
public class StabDirection extends StabStep {
public StabDirection(StabData data) {
super(data);
}
@Override
protected void start() {
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorlds().get(0)), -1)) {
e.setBlocks((com.sk89q.worldedit.regions.Region) new CuboidRegion(data.region.getMinPointTestblockExtension().toBlockVector3(), data.region.getMaxPointTestblockExtension().toBlockVector3()), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
}
Trace trace = TraceRecorder.instance.startRecording(data.region);
runSimulator(() -> {
TraceRecorder.instance.stopRecording(data.region);
calculateDirection(trace);
});
}
private void calculateDirection(Trace trace) {
long tickSinceStart = -1;
List<TNTPoint> points = null;
for (List<TNTPoint> current : trace.getHistories()) {
long ticks = current.get(0).getTicksSinceStart();
if (points == null || ticks > tickSinceStart) {
tickSinceStart = ticks;
points = current;
} else if (ticks == tickSinceStart && points.get(0).getTntId() < current.get(0).getTntId()) {
points = current;
}
}
TraceManager.instance.remove(trace);
if (points == null) {
stop();
return;
}
TNTPoint current = points.getLast();
Vector velocity = current.getVelocity();
if (velocity.getX() < 0) velocity.setX(-velocity.getX());
if (velocity.getY() < 0) velocity.setY(-velocity.getY());
if (velocity.getZ() < 0) velocity.setZ(-velocity.getZ());
if (velocity.getX() > velocity.getY() && velocity.getX() > velocity.getZ()) {
data.direction = Direction.X;
} else if (velocity.getY() > velocity.getX() && velocity.getY() > velocity.getZ()) {
data.direction = Direction.Y;
} else if (velocity.getZ() > velocity.getX() && velocity.getZ() > velocity.getY()) {
data.direction = Direction.Z;
} else {
stop();
return;
}
Bukkit.getLogger().log(StabData.LEVEL, "Direction: {0}", data.direction);
data.phases.getFirst().setOrder(SimulatorPhase.ORDER_LIMIT);
data.phases.getFirst().setCount(StabData.TNT_INCREASE);
new StabGenerator(data);
}
@Override
protected void bossbar(BauSystemBossbar bossbar, boolean finished) {
bossbar.setProgress(0);
bossbar.setTitle("§eCalculating Stab Direction");
}
}

View File

@ -0,0 +1,61 @@
/*
* 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.features.simulator.execute;
import de.steamwar.bausystem.features.tracer.Trace;
import de.steamwar.bausystem.features.tracer.TraceRecorder;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.utils.PasteBuilder;
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
public class StabFinalizer extends StabStep {
public StabFinalizer(StabData data) {
super(data);
}
@Override
protected void start() {
try {
PasteBuilder.ClipboardProvider clipboardProvider = new PasteBuilder.ClipboardProviderImpl(data.clipboard);
PasteBuilder pasteBuilder = new PasteBuilder(clipboardProvider)
.color(data.region.getPlain(Flag.COLOR, ColorMode.class).getColor());
data.region.reset(pasteBuilder, RegionType.TESTBLOCK, RegionExtensionType.EXTENSION);
} catch (SecurityException e) {
stop();
throw e;
}
TraceRecorder.instance.startRecording(data.region);
runSimulator(() -> {
TraceRecorder.instance.stopRecording(data.region);
stop();
});
}
@Override
protected void bossbar(BauSystemBossbar bossbar, boolean stopped) {
bossbar.setProgress(Math.min(data.currentDepth / (double) data.depthLimit, 1.0));
bossbar.setTitle("§e" + data.currentDepth + "§8/§7" + data.depthLimit);
}
}

View File

@ -0,0 +1,250 @@
/*
* 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.features.simulator.execute;
import de.steamwar.bausystem.features.simulator.data.tnt.TNTPhase;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.utils.PasteBuilder;
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import java.util.*;
import java.util.stream.Collectors;
import static de.steamwar.bausystem.features.simulator.execute.Direction.Y;
public class StabGenerator extends StabStep implements Listener {
private int recordings = 0;
private List<Integer> currentDepths = new ArrayList<>();
private int lastDepth = 0;
private int retries = 0;
private final Map<Integer, Set<Location>> destroyedBlocksPerSlice = new HashMap<>();
private Set<Integer> gabStart = new HashSet<>();
private Set<TNTPhase> failedAtLeastOnce = new HashSet<>();
@EventHandler
public void onEntityExplode(EntityExplodeEvent event) {
if (Region.getRegion(event.getEntity().getLocation()) == data.region) {
event.blockList().forEach(block -> {
if (!data.region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) return;
int component = data.direction.component.apply(block.getLocation().toVector());
destroyedBlocksPerSlice.computeIfAbsent(component, __ -> new HashSet<>())
.add(block.getLocation());
});
}
}
public StabGenerator(StabData data) {
super(data);
}
@Override
protected void start() {
try {
PasteBuilder.ClipboardProvider clipboardProvider = new PasteBuilder.ClipboardProviderImpl(data.clipboard);
PasteBuilder pasteBuilder = new PasteBuilder(clipboardProvider)
.color(data.region.getPlain(Flag.COLOR, ColorMode.class).getColor());
data.region.reset(pasteBuilder, RegionType.TESTBLOCK, RegionExtensionType.EXTENSION);
} catch (SecurityException e) {
stop();
throw e;
}
if (data.cancel) {
HandlerList.unregisterAll(this);
return;
}
runSimulator(this::calculateStab);
}
private void calculateStab() {
TNTPhase lastPhase = data.phases.getLast();
List<Map.Entry<Integer, Set<Location>>> locations = destroyedBlocksPerSlice.entrySet()
.stream()
.sorted(Comparator.comparingInt(Map.Entry::getKey))
.collect(Collectors.toList());
int depth = 0;
for (int i = 0; i < locations.size(); i++) {
if (data.direction != Y && i > 0 && Math.abs(locations.get(i - 1).getKey() - locations.get(i).getKey()) > 3) {
if (gabStart.add(locations.get(i).getKey())) {
Bukkit.getLogger().log(StabData.LEVEL, "Increasing tnt count by {0} because of gap", StabData.TNT_INCREASE);
lastPhase.setCount(lastPhase.getCount() + StabData.TNT_INCREASE);
recordings = 0;
currentDepths.clear();
run();
return;
}
}
if (i == 0 || i == locations.size() - 1) {
if (locations.get(i).getValue().size() > StabData.MIN_BLOCK_TO_COUNT_AS_DEPTH) {
depth++;
}
} else {
depth++;
}
}
if (depth > 0) {
Bukkit.getLogger().log(StabData.LEVEL, "{0} {1} {2}", new Object[]{depth, destroyedBlocksPerSlice.size(), destroyedBlocksPerSlice.values().stream().map(Set::size).collect(Collectors.toList())});
destroyedBlocksPerSlice.clear();
currentDepths.add(depth);
} else {
destroyedBlocksPerSlice.clear();
lastPhase.setTickOffset(lastPhase.getTickOffset() + 1);
Bukkit.getLogger().log(StabData.LEVEL, "No dimension - Increasing tickOffset to: {0}", lastPhase.getTickOffset());
lastPhase.setOrder(0);
if (lastPhase.getTickOffset() > 80) {
stop();
} else {
run();
}
return;
}
int minDepth = currentDepths.stream().min(Integer::compareTo).orElse(0);
int maxDepth = currentDepths.stream().max(Integer::compareTo).orElse(0);
data.currentDepth = maxDepth;
int countWithoutLast = 0;
for (int i = 0; i < data.phases.size() - 1; i++) {
countWithoutLast += data.phases.get(i).getCount();
}
countWithoutLast -= gabStart.size();
boolean moreTNTNeeded = maxDepth - countWithoutLast >= lastPhase.getCount() - 5;
if (moreTNTNeeded) {
Bukkit.getLogger().log(StabData.LEVEL, "Increasing tnt count by {0}", StabData.TNT_INCREASE);
lastPhase.setCount(lastPhase.getCount() + StabData.TNT_INCREASE);
recordings = 0;
currentDepths.clear();
run();
return;
}
if (recordings++ < StabData.MAX_RECORDINGS) {
run();
return;
}
recordings = 0;
currentDepths.clear();
if (maxDepth - minDepth > lastPhase.getCount()) {
Bukkit.getLogger().log(StabData.LEVEL, "Stab failed at least once. Adding one tnt to {0}", minDepth - 3);
int current = 0;
TNTPhase last = null;
for (TNTPhase phase : data.phases) {
if (current < minDepth - 3) {
current += phase.getCount();
last = phase;
continue;
}
if (failedAtLeastOnce.add(last)) {
last = null;
break;
}
if (last != null) {
last.setCount(last.getCount() + 1);
Bukkit.getLogger().log(StabData.LEVEL, "Added to phase {0} now has {1} tnt", new Object[]{data.phases.indexOf(last), last.getCount()});
}
break;
}
if (last != null) {
run();
return;
}
}
Bukkit.getLogger().log(StabData.LEVEL, "No more TNT needed on phase adjusting - {0} new count; {1} current count", new Object[]{maxDepth - countWithoutLast, lastPhase.getCount()});
lastPhase.setCount(maxDepth - countWithoutLast);
if (lastPhase.getCount() <= 0) {
Bukkit.getLogger().log(StabData.LEVEL, "Count was 0 or negative - removing last phase");
data.phases.removeLast();
}
if (maxDepth > data.depthLimit) {
Bukkit.getLogger().log(StabData.LEVEL, "Depth is greater than {0} - finished", data.depthLimit);
new StabFinalizer(data);
return;
}
if (maxDepth <= lastDepth) {
if (lastPhase.getCount() <= 0) {
retries++;
}
if (lastPhase.getCount() > 0 || retries > StabData.MAX_TICK_DIFFERENCE) {
Bukkit.getLogger().log(StabData.LEVEL, "Depth is equal to last depth recorded {0} - finished", maxDepth);
new StabFinalizer(data);
return;
}
}
lastDepth = maxDepth;
newPhase(data, lastPhase);
run();
}
public static void newPhase(StabData data, TNTPhase lastPhase) {
Bukkit.getLogger().log(StabData.LEVEL, "Adding new phase in next tick");
TNTPhase nextPhase = new TNTPhase();
nextPhase.setCount(StabData.TNT_INCREASE);
nextPhase.setTickOffset(lastPhase.getTickOffset() + 1);
nextPhase.setXJump(lastPhase.isXJump());
nextPhase.setYJump(lastPhase.isYJump());
nextPhase.setZJump(lastPhase.isZJump());
data.phases.add(nextPhase);
}
@Override
protected void bossbar(BauSystemBossbar bossbar, boolean finished) {
bossbar.setProgress(Math.min(data.currentDepth / (double) data.depthLimit, 1.0));
if (finished) {
bossbar.setTitle("§e" + data.currentDepth + "§8/§7" + data.depthLimit);
return;
}
StringBuilder st = new StringBuilder();
st.append("§7Direction §e").append(data.direction);
st.append(" §e").append(data.currentDepth).append("§8/§7").append(data.depthLimit);
if (recordings > 0) {
st.append(" §7Retries§8:§e ").append(recordings).append("§8/§7").append(StabData.MAX_RECORDINGS);
}
bossbar.setTitle(st.toString());
}
}

View File

@ -0,0 +1,85 @@
/*
* 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.features.simulator.execute;
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.TNTPhase;
import de.steamwar.bausystem.features.tracer.TraceRecorder;
import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
public class StabSetup extends StabStep {
public StabSetup(StabData data) {
super(data);
}
@Override
protected void start() {
TNTPhase tntPhase = data.simulator.getGroups().stream()
.filter(simulatorGroup -> !simulatorGroup.isDisabled())
.map(SimulatorGroup::getElements)
.flatMap(List::stream)
.filter(TNTElement.class::isInstance)
.map(TNTElement.class::cast)
.filter(tntElement -> !tntElement.isDisabled())
.filter(tntElement -> data.tntElement != tntElement)
.map(tntElement -> tntElement.getPhases().stream().max(Comparator.comparingInt(TNTPhase::getTickOffset)))
.filter(Optional::isPresent)
.map(Optional::get)
.peek(phase -> {
if (phase.getOrder() > TNTPhase.ORDER_LIMIT) {
phase.setOrder(TNTPhase.ORDER_LIMIT);
}
})
.filter(phase -> phase != data.phases.get(0))
.max(Comparator.comparingInt(TNTPhase::getTickOffset))
.orElse(null);
if (tntPhase == null) {
throw new SecurityException("");
}
TNTPhase phase = data.phases.get(0);
data.phases.clear();
data.phases.add(phase);
phase.setCount(1);
phase.setTickOffset(tntPhase.getTickOffset());
phase.setOrder(100);
TraceRecorder.instance.stopRecording(data.region);
if (TraceRecorder.instance.isAutoTraceEnabledInRegion(data.region)) {
TraceRecorder.instance.removeAutoTraceRegion(data.region);
}
data.clipboard = FlatteningWrapper.impl.copy(data.region.getMinPointTestblockExtension(), data.region.getMaxPointTestblockExtension(), data.region.getTestBlockPoint());
new StabDirection(data);
}
@Override
protected void bossbar(BauSystemBossbar bossbar, boolean finished) {
bossbar.setProgress(0);
bossbar.setTitle("§eSetting up Simulator");
}
}

View File

@ -0,0 +1,95 @@
/*
* 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.features.simulator.execute;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.simulator.SimulatorWatcher;
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
import de.steamwar.bausystem.utils.bossbar.BossBarService;
import org.bukkit.Bukkit;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarStyle;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
public abstract class StabStep {
protected final StabData data;
protected StabStep(StabData data) {
this.data = data;
run();
}
protected final void run() {
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
for (Player player : Bukkit.getOnlinePlayers()) {
BauSystemBossbar bossbar = BossBarService.instance.get(player, data.region, "simulator_stab_generator");
bossbar.setColor(BarColor.GREEN);
bossbar.setStyle(BarStyle.SEGMENTED_10);
bossbar(bossbar, false);
}
}, 1);
if (this instanceof Listener) {
Bukkit.getPluginManager().registerEvents((Listener) this, BauSystem.getInstance());
}
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), this::start, 20);
}
protected abstract void start();
protected final void runSimulator(Runnable onFinish) {
SimulatorExecutor.run(data.simulator, () -> {
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
if (this instanceof Listener) {
HandlerList.unregisterAll((Listener) this);
}
onFinish.run();
}, 20);
});
}
protected abstract void bossbar(BauSystemBossbar bossbar, boolean stopped);
protected final void stop() {
data.simulator.setStabGenerator(null);
SimulatorWatcher.update(data.simulator);
for (Player player : Bukkit.getOnlinePlayers()) {
BauSystemBossbar bossbar = BossBarService.instance.get(player, data.region, "simulator_stab_generator");
bossbar.setColor(BarColor.GREEN);
bossbar.setStyle(BarStyle.SEGMENTED_10);
bossbar(bossbar, true);
}
new Thread(() -> {
try {
Thread.sleep(4000);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
for (Player player : Bukkit.getOnlinePlayers()) {
BossBarService.instance.remove(player, data.region, "simulator_stab_generator");
}
}
}).start();
}
}

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.gui.base.SimulatorBaseGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -70,12 +71,12 @@ public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> {
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open();
}));
}).setCustomModelData(CMDs.BACK));
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
simulatorGroup.getElements().clear();
SimulatorWatcher.update(simulator);
}));
}).setCustomModelData(CMDs.Simulator.DELETE));
inventory.setItem(4, simulatorGroup.toItem(player, clickType -> {
if (simulatorGroup.getMaterial() == null) return;
@ -85,7 +86,7 @@ public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> {
inventory.setItem(48, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorGroupSettingsGui(player, simulator, simulatorGroup, this).open();
}));
}).setCustomModelData(CMDs.Simulator.SETTINGS));
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 -> {
if (simulatorGroup.getMaterial() == null) {
@ -96,7 +97,7 @@ public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> {
simulatorGroup.setDisabled(!disabled);
}
SimulatorWatcher.update(simulator);
}));
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
}
@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.gui.base.SimulatorAnvilGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.Arrays;
@ -58,7 +58,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
// Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open();
}));
}).setCustomModelData(CMDs.BACK));
// Material Chooser
inventory.setItem(4, simulatorGroup.toItem(player, clickType -> {
@ -69,10 +69,10 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
// Base Tick
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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
if (integer < 0) return false;
@ -83,14 +83,14 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
});
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
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) {
simulatorGroup.changeBaseTicks(-baseTicks);
} else {
simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
}
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
boolean allTNT = simulatorGroup.getElements().stream().allMatch(TNTElement.class::isInstance);
@ -163,10 +163,10 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
}
//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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> {
new SimulatorAnvilGui<>(player, "Relative X", "", Double::parseDouble, number -> {
if(!allTNT){
@ -177,16 +177,16 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
return true;
}, 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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> {
new SimulatorAnvilGui<>(player, "Relative Y", "", Double::parseDouble, number -> {
if(!allTNT){
@ -197,16 +197,16 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
return true;
}, 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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
//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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> {
new SimulatorAnvilGui<>(player, "Relative Z", "", Double::parseDouble, number -> {
if(!allTNT){
@ -217,9 +217,9 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
return true;
}, 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);
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.SimulatorGroup;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -50,7 +51,7 @@ public class SimulatorGui extends SimulatorPageGui<SimulatorGroup> {
}));
inventory.setItem(49, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorSettingsGui(player, simulator, this).open();
}));
}).setCustomModelData(CMDs.Simulator.SETTINGS));
}
@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.gui.base.SimulatorBaseGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -53,6 +54,16 @@ public class SimulatorMaterialGui extends SimulatorPageGui<Material> {
this.back = back;
}
@Override
public boolean shouldOpen() {
if (player.getItemOnCursor().getType().isAir()) {
return true;
}
change.accept(player.getItemOnCursor().getType());
SimulatorWatcher.update(simulator);
return false;
}
@Override
public String baseTitle() {
return "Material";
@ -65,7 +76,7 @@ public class SimulatorMaterialGui extends SimulatorPageGui<Material> {
}));
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open();
}));
}).setCustomModelData(CMDs.BACK));
}
@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.gui.base.SimulatorBaseGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -82,12 +83,12 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
}
}
}));
}).setCustomModelData(CMDs.BACK));
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
observer.getPhases().clear();
SimulatorWatcher.update(simulator);
}));
}).setCustomModelData(CMDs.Simulator.DELETE));
// Material Chooser
inventory.setItem(4, observer.toItem(player, clickType -> {
@ -97,18 +98,18 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
// Settings
inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorObserverSettingsGui(player, simulator, observer, this).open();
}));
}).setCustomModelData(CMDs.Simulator.SETTINGS));
// Enable/Disable
inventory.setItem(48, new SWItem(observer.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, observer.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
observer.setDisabled(!observer.isDisabled());
SimulatorWatcher.update(simulator);
}));
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
// Group chooser
inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> {
new SimulatorGroupChooserGui(player, simulator, observer, observer.getGroup(simulator), this).open();
}));
}).setCustomModelData(CMDs.Simulator.JOIN_GROUP));
}
@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 -> {
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}),
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
observer,
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)));
SimulatorWatcher.update(simulator);
}),
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> {
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[]{
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
addNewPhase(clickType.isShiftClick());
}),
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
new SWItem(Material.QUARTZ, "§eObserver§8:§a New Phase", clickType -> {
addNewPhase(false);
}),
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
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.SimulatorBaseGui;
import de.steamwar.core.Core;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
@ -62,7 +63,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
// Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open();
}));
}).setCustomModelData(CMDs.BACK));
// Material Chooser
inventory.setItem(4, observerElement.toItem(player, clickType -> {
@ -74,7 +75,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
observerElement.getPhases().remove(observer);
back.open();
SimulatorWatcher.update(simulator);
}));
}).setCustomModelData(CMDs.Simulator.DELETE));
int index = observerElement.getPhases().indexOf(observer);
int min;
@ -95,10 +96,10 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
//Tick Offset
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)));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> {
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)));
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)));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Order
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)));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
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 -> {
@ -136,10 +137,10 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
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)));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
// Update orientation
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.gui.base.SimulatorAnvilGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -56,7 +57,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
// Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open();
}));
}).setCustomModelData(CMDs.BACK));
// Material Chooser
inventory.setItem(4, observer.toItem(player, clickType -> {
@ -65,10 +66,10 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
// Base Tick
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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
if (integer < 0) return false;
@ -79,20 +80,20 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
});
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
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) {
observer.changeBaseTicks(-baseTicks);
} else {
observer.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
}
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + observer.getPosition().getBlockX(), clickType -> {
new SimulatorAnvilGui<>(player, "X", observer.getPosition().getBlockX() + "", Integer::parseInt, i -> {
observer.getPosition().setX(i);
@ -100,16 +101,16 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
return true;
}, 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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + observer.getPosition().getBlockY(), clickType -> {
new SimulatorAnvilGui<>(player, "Y", observer.getPosition().getBlockY() + "", Integer::parseInt, i -> {
observer.getPosition().setY(i);
@ -117,16 +118,16 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
return true;
}, 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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + observer.getPosition().getBlockZ(), clickType -> {
new SimulatorAnvilGui<>(player, "Z", observer.getPosition().getBlockZ() + "", Integer::parseInt, i -> {
observer.getPosition().setZ(i);
@ -134,9 +135,9 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
return true;
}, 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);
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.gui.base.SimulatorBaseGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import lombok.AllArgsConstructor;
import org.bukkit.Material;
@ -88,12 +89,12 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
}
}
}));
}).setCustomModelData(CMDs.BACK));
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
redstone.getPhases().clear();
SimulatorWatcher.update(simulator);
}));
}).setCustomModelData(CMDs.Simulator.DELETE));
// Material Chooser
inventory.setItem(4, redstone.toItem(player, clickType -> {
@ -103,18 +104,18 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
// Settings
inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorRedstoneSettingsGui(player, simulator, redstone, this).open();
}));
}).setCustomModelData(CMDs.Simulator.SETTINGS));
// Enable/Disable
inventory.setItem(48, new SWItem(redstone.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, redstone.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
redstone.setDisabled(!redstone.isDisabled());
SimulatorWatcher.update(simulator);
}));
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
// Group chooser
inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> {
new SimulatorGroupChooserGui(player, simulator, redstone, redstone.getGroup(simulator), this).open();
}));
}).setCustomModelData(CMDs.Simulator.JOIN_GROUP));
}
@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 -> {
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
SimulatorWatcher.update(simulator);
}),
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
redstone,
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)));
SimulatorWatcher.update(simulator);
}),
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> {
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[]{
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
addNewPhase(clickType.isShiftClick());
}),
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
new SWItem(Material.REDSTONE, "§eRedstone§8:§a New Phase", clickType -> {
addNewPhase(false);
}),
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
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.SimulatorBaseGui;
import de.steamwar.core.Core;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -60,7 +61,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
// Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open();
}));
}).setCustomModelData(CMDs.BACK));
// Material Chooser
inventory.setItem(4, redstoneElement.toItem(player, clickType -> {
@ -72,7 +73,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
redstoneElement.getPhases().remove(redstone);
back.open();
SimulatorWatcher.update(simulator);
}));
}).setCustomModelData(CMDs.Simulator.DELETE));
int index = redstoneElement.getPhases().indexOf(redstone);
int min;
@ -96,10 +97,10 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
//Tick Offset
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)));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> {
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)));
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)));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Lifetime
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)));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eActivation Time§8:§7 " + lifetime, clickType -> {
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)));
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)));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Order
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)));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
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 -> {
@ -160,9 +161,9 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
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)));
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.gui.base.SimulatorAnvilGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -55,7 +56,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
// Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open();
}));
}).setCustomModelData(CMDs.BACK));
// Material Chooser
inventory.setItem(4, redstone.toItem(player, clickType -> {
@ -64,10 +65,10 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
// Base Tick
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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
if (integer < 0) return false;
@ -78,20 +79,20 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
});
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
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) {
redstone.changeBaseTicks(-baseTicks);
} else {
redstone.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
}
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + redstone.getPosition().getBlockX(), clickType -> {
new SimulatorAnvilGui<>(player, "X", redstone.getPosition().getBlockX() + "", Integer::parseInt, i -> {
redstone.getPosition().setX(i);
@ -99,16 +100,16 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
return true;
}, 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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + redstone.getPosition().getBlockY(), clickType -> {
new SimulatorAnvilGui<>(player, "Y", redstone.getPosition().getBlockY() + "", Integer::parseInt, i -> {
redstone.getPosition().setY(i);
@ -116,16 +117,16 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
return true;
}, 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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + redstone.getPosition().getBlockZ(), clickType -> {
new SimulatorAnvilGui<>(player, "Z", redstone.getPosition().getBlockZ() + "", Integer::parseInt, i -> {
redstone.getPosition().setZ(i);
@ -133,9 +134,9 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
return true;
}, 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);
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.data.Simulator;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -47,7 +48,7 @@ public class SimulatorSettingsGui extends SimulatorBaseGui {
// Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open();
}));
}).setCustomModelData(CMDs.BACK));
// Material Chooser
inventory.setItem(4, simulator.toItem(player, clickType -> {
@ -61,39 +62,39 @@ public class SimulatorSettingsGui extends SimulatorBaseGui {
}));
//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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
}
}

View File

@ -24,8 +24,13 @@ import de.steamwar.bausystem.features.simulator.data.Simulator;
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.TNTPhase;
import de.steamwar.bausystem.features.simulator.execute.SimulatorStabGenerator;
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.SimulatorScrollGui;
import de.steamwar.bausystem.region.Region;
import de.steamwar.core.Core;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -78,12 +83,12 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
}
}
}));
}).setCustomModelData(CMDs.BACK));
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
tnt.getPhases().clear();
SimulatorWatcher.update(simulator);
}));
}).setCustomModelData(CMDs.Simulator.DELETE));
// Material Chooser
inventory.setItem(4, tnt.toItem(player, clickType -> {
@ -92,21 +97,31 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
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 -> {
tnt.setDisabled(!tnt.isDisabled());
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 -> {
new SimulatorAnvilGui<>(player, "Depth Limit", "", Integer::parseInt, depthLimit -> {
if (depthLimit <= 0) return false;
simulator.setStabGenerator(new SimulatorStabGenerator(Region.getRegion(player.getLocation()), simulator, tnt, depthLimit));
SimulatorWatcher.update(simulator);
return true;
}, 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 -> {
TNTElement tntElement = new TNTElement(tnt.getPosition().clone());
tntElement.add(new TNTPhase());
parent.add(tntElement);
new SimulatorGroupGui(player, simulator, parent, new SimulatorGui(player, simulator)).open();
SimulatorWatcher.update(simulator);
}));
}).setCustomModelData(CMDs.Simulator.MAKE_GROUP));
inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> {
new SimulatorGroupChooserGui(player, simulator, tnt, tnt.getGroup(simulator), this).open();
}));
}).setCustomModelData(CMDs.Simulator.JOIN_GROUP));
}
@Override
@ -125,15 +140,15 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
tntSetting.setCount(tntSetting.getCount() + (clickType.isShiftClick() ? 5 : 1));
SimulatorWatcher.update(simulator);
}),
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
tnt,
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)));
SimulatorWatcher.update(simulator);
}),
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
new SWItem(Material.ANVIL, "§eEdit Phase", clickType -> {
new SimulatorTNTPhaseSettingsGui(player, simulator, this.tnt, tntSetting, this).open();
}),
}).setCustomModelData(CMDs.Simulator.EDIT_ACTIVATION),
};
}
@ -142,12 +157,12 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
return new SWItem[]{
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
addNewPhase(clickType.isShiftClick());
}),
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
new SWItem(Material.GUNPOWDER, "§eTNT§8:§a New Phase", clickType -> {
addNewPhase(false);
}),
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
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.SimulatorBaseGui;
import de.steamwar.core.Core;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -60,7 +61,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
// Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open();
}));
}).setCustomModelData(CMDs.BACK));
// Material Chooser
inventory.setItem(4, tntElement.toItem(player, clickType -> {
@ -72,14 +73,14 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
tntElement.getPhases().remove(tnt);
back.open();
SimulatorWatcher.update(simulator);
}));
}).setCustomModelData(CMDs.Simulator.DELETE));
//Count
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));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem countItem = new SWItem(Material.TNT, "§eCount§8:§7 " + count, clickType -> {
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)));
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)));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Tick Offset
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));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> {
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)));
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)));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Lifetime
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));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eLifetime§8:§7 " + lifetime, clickType -> {
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)));
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)));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Order
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)));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
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 -> {
@ -163,10 +164,10 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
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)));
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
//Jump
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.gui.base.SimulatorAnvilGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.Arrays;
@ -58,7 +58,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
// Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open();
}));
}).setCustomModelData(CMDs.BACK));
// Material Chooser
List<String> lore = new ArrayList<>();
@ -74,10 +74,10 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
// Base Tick
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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
if (integer < 0) return false;
@ -88,14 +88,14 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
});
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
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) {
tnt.changeBaseTicks(-baseTicks);
} else {
tnt.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
}
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
// Subpixel Alignment
inventory.setItem(21, new SWItem(Material.SUNFLOWER, "§7Align§8: §eCenter", clickType -> {
@ -135,10 +135,10 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
inventory.setItem(30, positivXItem);
// 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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + tnt.getPosition().getX(), clickType -> {
new SimulatorAnvilGui<>(player, "X", tnt.getPosition().getX() + "", Double::parseDouble, d -> {
tnt.getPosition().setX(d);
@ -146,16 +146,16 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
return true;
}, 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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
// 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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + tnt.getPosition().getY(), clickType -> {
new SimulatorAnvilGui<>(player, "Y", tnt.getPosition().getY() + "", Double::parseDouble, d -> {
tnt.getPosition().setY(d);
@ -163,16 +163,16 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
return true;
}, 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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
// 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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + tnt.getPosition().getZ(), clickType -> {
new SimulatorAnvilGui<>(player, "Z", tnt.getPosition().getZ() + "", Double::parseDouble, d -> {
tnt.getPosition().setZ(d);
@ -180,9 +180,9 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
return true;
}, 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);
SimulatorWatcher.update(simulator);
});
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
}
}

View File

@ -44,7 +44,7 @@ public class SimulatorAnvilGui<T extends Number> {
if (error.get()) {
anvilInv.open();
} else {
back.open();
if (back != null) back.open();
}
error.set(false);
}, 0);

View File

@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.simulator.gui.base;
import de.steamwar.bausystem.features.simulator.SimulatorWatcher;
import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.core.Core;
import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
import org.bukkit.Bukkit;
@ -46,6 +45,8 @@ public abstract class SimulatorBaseGui {
}
public final void open() {
if (!shouldOpen()) return;
String newTitle = title();
String originalTitle = player.getOpenInventory().getTitle();
@ -62,7 +63,11 @@ public abstract class SimulatorBaseGui {
if (Core.getVersion() > 19) {
player.getOpenInventory().setTitle(title());
}
if (simulator != null && simulator.getStabGenerator() != null) {
populateStabGenerator();
} else {
populate();
}
if (player.getOpenInventory().getTopInventory() == inv) {
inventory.open();
SimulatorWatcher.watch(player, simulator, this::open);
@ -82,10 +87,25 @@ public abstract class SimulatorBaseGui {
});
SimulatorWatcher.watch(player, simulator, this::open);
if (simulator != null && simulator.getStabGenerator() != null) {
populateStabGenerator();
} else {
populate();
}
inventory.open();
}
private void populateStabGenerator() {
inventory.setItem(22, new SWItem(Material.BARRIER, "§cCancel Stab Generator", click -> {
simulator.getStabGenerator().cancel();
SimulatorWatcher.update(simulator);
}));
}
public boolean shouldOpen() {
return true;
}
private void setup() {
for (int i = 0; i < 9; i++) {
inventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§8", clickType -> {

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.core.Core;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.entity.Player;
@ -50,19 +51,19 @@ public abstract class SimulatorPageGui<T> extends SimulatorBaseGui {
headerAndFooter();
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) {
page--;
open();
}
});
}).setCustomModelData(CMDs.PREVIOUS_PAGE));
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) {
page++;
open();
}
});
}).setCustomModelData(CMDs.NEXT_PAGE));
int minElement = page * (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.core.Core;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.entity.Player;
@ -50,19 +51,19 @@ public abstract class SimulatorScrollGui<T> extends SimulatorBaseGui {
headerAndFooter();
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) {
scroll = Math.max(0, scroll - 9);
open();
}
});
}).setCustomModelData(CMDs.PREVIOUS_PAGE));
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) {
scroll = Math.min(scroll + 9, data.size() + 1 - 9);
open();
}
});
}).setCustomModelData(CMDs.NEXT_PAGE));
for (int i = 0; i < 9; i++) {
if (scroll + i < data.size()) {

View File

@ -0,0 +1,23 @@
/*
* 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.features.simulator.preview;
public class SimulatorPreview {
}

View File

@ -0,0 +1,76 @@
/*
* 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.features.simulator.preview;
import lombok.AllArgsConstructor;
import lombok.ToString;
import org.bukkit.util.BoundingBox;
import org.bukkit.util.VoxelShape;
import java.util.List;
import java.util.stream.Collectors;
@AllArgsConstructor
@ToString
public class SimulatorPreviewAABB {
public double minX;
public double minY;
public double minZ;
public double maxX;
public double maxY;
public double maxZ;
public SimulatorPreviewAABB copy() {
return new SimulatorPreviewAABB(minX, minY, minZ, maxX, maxY, maxZ);
}
public void expandTowards(double vx, double vy, double vz) {
if (vx < 0) {
minX += vx;
} else {
maxX += vx;
}
if (vy < 0) {
minY += vy;
} else {
maxY += vy;
}
if (vz < 0) {
minZ += vz;
} else {
maxZ += vz;
}
}
public void add(double vx, double vy, double vz) {
minX += vx;
minY += vy;
minZ += vz;
}
public boolean intersects(double x, double y, double z, BoundingBox boundingBox) {
return minX - (x + boundingBox.getMaxX()) < -1.0E-7 &&
maxX - (x + boundingBox.getMinX()) > 1.0E-7 &&
minY - (y + boundingBox.getMaxY()) < -1.0E-7 &&
maxY - (y + boundingBox.getMinY()) > 1.0E-7 &&
minZ - (z + boundingBox.getMaxZ()) < -1.0E-7 &&
maxZ - (z + boundingBox.getMinZ()) > 1.0E-7;
}
}

View File

@ -0,0 +1,114 @@
/*
* 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.features.simulator.preview;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.tracer.TNTPoint;
import de.steamwar.bausystem.features.tracer.Trace;
import lombok.RequiredArgsConstructor;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.util.Consumer;
import org.bukkit.util.Vector;
import org.bukkit.util.VoxelShape;
import java.util.*;
@RequiredArgsConstructor
public class SimulatorPreviewCalculator {
private static final World WORLD = Bukkit.getWorlds().get(0);
public final Simulator simulator;
public final List<SimulatorPreviewTNT> tnts = new ArrayList<>();
private int ticks = 0;
private final Set<SimulatorPreviewPos> air = new HashSet<>();
private final Map<SimulatorPreviewPos, BlockData> datas = new HashMap<>();
private final Map<SimulatorPreviewPos, VoxelShape> shapes = new HashMap<>();
public BlockData getBlockData(int x, int y, int z) {
SimulatorPreviewPos pos = new SimulatorPreviewPos(x, y, z);
if (air.contains(pos)) return null;
return datas.computeIfAbsent(pos, __ -> {
BlockData blockData = WORLD.getBlockData(x, y, z);
if (blockData.getMaterial().isAir()) {
air.add(pos);
return null;
}
return blockData;
});
}
public VoxelShape getBlockShape(int x, int y, int z) {
SimulatorPreviewPos pos = new SimulatorPreviewPos(x, y, z);
if (air.contains(pos)) return null;
return shapes.computeIfAbsent(pos, __ -> {
Block block = WORLD.getBlockAt(x, y, z);
if (block.getType().isAir()) {
air.add(pos);
return null;
}
return block.getCollisionShape();
});
}
public void setAir(int x, int y, int z) {
SimulatorPreviewPos pos = new SimulatorPreviewPos(x, y, z);
air.add(pos);
datas.remove(pos);
shapes.remove(pos);
}
public void spawnTNT(double x, double y, double z) {
tnts.add(new SimulatorPreviewTNT(this, x, y, z));
}
public void calculate(Consumer<SimulatorPreviewResult> result) {
List<TNTPoint> tntPoints = new ArrayList<>();
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), bukkitTask -> {
long time = System.currentTimeMillis();
while (!tnts.isEmpty()) {
if (System.currentTimeMillis() - time > 40) {
return;
}
tick(tntPoints);
}
bukkitTask.cancel();
System.out.println(tntPoints);
result.accept(new SimulatorPreviewResult(new Trace(null, tntPoints), air));
}, 1, 1);
}
private void tick(List<TNTPoint> tntPoints) {
System.out.println("TICK");
tnts.removeIf(simulatorPreviewTNT -> {
tntPoints.add(new TNTPoint(0, false, false, true, false, false, ticks, simulatorPreviewTNT.fuse, new Location(WORLD, simulatorPreviewTNT.x + 0.49, simulatorPreviewTNT.y, simulatorPreviewTNT.z + 0.49), new Vector(simulatorPreviewTNT.vx, simulatorPreviewTNT.vy, simulatorPreviewTNT.vz), tntPoints));
simulatorPreviewTNT.tick();
if (!simulatorPreviewTNT.removed) return false;
tntPoints.add(new TNTPoint(0, true, false, true, false, false, ticks, simulatorPreviewTNT.fuse, new Location(WORLD, simulatorPreviewTNT.x + 0.49, simulatorPreviewTNT.y, simulatorPreviewTNT.z + 0.49), new Vector(simulatorPreviewTNT.vx, simulatorPreviewTNT.vy, simulatorPreviewTNT.vz), tntPoints));
return true;
});
ticks++;
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.features.simulator.preview;
import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@EqualsAndHashCode
final class SimulatorPreviewPos {
public final int x;
public final int y;
public final int z;
}

View File

@ -0,0 +1,61 @@
/*
* 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.features.simulator.preview;
import de.steamwar.bausystem.features.tracer.Trace;
import de.steamwar.bausystem.features.tracer.rendering.BundleFilter;
import de.steamwar.bausystem.features.tracer.rendering.PlayerTraceShowData;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Player;
import java.util.Set;
@Getter
public class SimulatorPreviewResult {
private static final World WORLD = Bukkit.getWorlds().get(0);
private static final BlockData AIR = Material.AIR.createBlockData();
private final Trace trace;
private final Set<SimulatorPreviewPos> air;
public SimulatorPreviewResult(Trace trace, Set<SimulatorPreviewPos> air) {
this.trace = trace;
this.air = air;
}
public void show(Player player) {
trace.render(player, new PlayerTraceShowData(BundleFilter.DEFAULT));
air.forEach(simulatorPreviewPos -> {
player.sendBlockChange(new Location(WORLD, simulatorPreviewPos.x, simulatorPreviewPos.y, simulatorPreviewPos.z, 0, 0), AIR);
});
}
public void hide(Player player) {
trace.hide(player);
air.forEach(simulatorPreviewPos -> {
player.sendBlockChange(new Location(WORLD, simulatorPreviewPos.x, simulatorPreviewPos.y, simulatorPreviewPos.z, 0, 0), WORLD.getBlockData(simulatorPreviewPos.x, simulatorPreviewPos.y, simulatorPreviewPos.z));
});
}
}

View File

@ -0,0 +1,228 @@
/*
* 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.features.simulator.preview;
import org.bukkit.Axis;
import org.bukkit.util.BoundingBox;
import org.bukkit.util.Vector;
import org.bukkit.util.VoxelShape;
import java.util.Random;
public class SimulatorPreviewTNT {
private static final double size = 0.98;
private static final Random random = new Random();
private final SimulatorPreviewCalculator data;
private boolean gravity = true;
int fuse = 80;
double x;
double y;
double z;
double vx;
double vy;
double vz;
private SimulatorPreviewVec collide = new SimulatorPreviewVec();
private boolean onGround;
boolean removed = false;
public SimulatorPreviewTNT(SimulatorPreviewCalculator data, double x, double y, double z) {
this.data = data;
this.x = x;
this.y = y;
this.z = z;
double d = random.nextDouble() * Math.PI * 2;
this.vx = -Math.sin(d) * 0.02;
this.vy = 0.2;
this.vz = -Math.cos(d) * 0.02;
}
public void tick() {
System.out.println(x + " " + y + " " + z);
// TODO: Issue in movement still!
// System.out.println(x + " " + y + " " + z);
// Gravity
if (gravity) {
vy -= 0.04;
}
// Movement
move();
// TODO: EffectsFromOtherBlocks
// Velocity * 0.98
vx *= 0.98;
vy *= 0.98;
vz *= 0.98;
// OnGround Velocity * 0.7 -0.5 0.7
if (onGround) {
vx *= 0.7;
vy *= -0.5;
vz *= 0.7;
}
// Decrease Fuse
fuse--;
if (fuse <= 0) {
// Explode on zero Fuse
explode();
} else {
// TODO: or do water Movement!
}
}
public void move() {
collide();
double collisionLengthSquared = collide.lengthSquared();
if (collisionLengthSquared > 1.0E-7 || new Vector(vx, vy, vz).lengthSquared() - collisionLengthSquared < 1.0E-7) {
x += collide.x;
y += collide.y;
z += collide.z;
}
boolean xCollision = !equal(vx, collide.x);
boolean zCollision = !equal(vz, collide.z);
boolean horizontalCollision = xCollision || zCollision;
if (Math.abs(vy) > 0.0F) {
boolean verticalCollision = vy != collide.y;
onGround = verticalCollision && vy < (double) 0.0F;
}
if (horizontalCollision) {
if (xCollision) vx = 0;
if (zCollision) vz = 0;
}
vx = collide.x;
vy = collide.y;
vz = collide.z;
// TODO: Get Block -> updateEntityMovementAfterFallOn!
// TODO: Get BlockSpeedFactor multiply
}
public static boolean equal(double first, double second) {
return Math.abs(second - first) < (double) 1.0E-5F;
}
public void collide() {
boolean xZero = vx == 0;
boolean zZero = vz == 0;
if (xZero && vy == 0 && zZero) {
collide.x = 0;
collide.y = 0;
collide.z = 0;
return;
}
SimulatorPreviewAABB box = new SimulatorPreviewAABB(x, y, z, x + size, y + size, z + size);
double vx = this.vx;
double vy = this.vy;
double vz = this.vz;
if (vy != 0) {
vy = iterateBlocks(box.copy(), Axis.Y, vy);
if (vy != 0) box.add(0, vy, 0);
}
boolean xSmaller = Math.abs(vx) < Math.abs(vz);
if (xSmaller && vz != 0) {
vz = iterateBlocks(box.copy(), Axis.Z, vz);
if (vz != 0) box.add(0, 0, vz);
}
if (vx != 0) {
vx = iterateBlocks(box.copy(), Axis.X, vx);
if (vx != 0) box.add(vx, 0, 0);
}
if (!xSmaller && vz != 0) {
vz = iterateBlocks(box.copy(), Axis.Z, vz);
if (vz != 0) box.add(0, 0, vz);
}
collide.x = vx;
collide.y = vy;
collide.z = vz;
}
private double iterateBlocks(SimulatorPreviewAABB box, Axis axis, double v) {
switch (axis) {
case X -> box.expandTowards(v, 0, 0);
case Y -> box.expandTowards(0, v, 0);
case Z -> box.expandTowards(0, 0, v);
}
boolean negative = v < 0;
for (int x = floor(box.minX - 1.0E-7) - 1; x < floor(box.maxX + 1.0E-7) + 1; x++) {
for (int y = floor(box.minY - 1.0E-7) - 1; y < floor(box.maxY + 1.0E-7) + 1; y++) {
for (int z = floor(box.minZ - 1.0E-7) - 1; z < floor(box.maxZ + 1.0E-7) + 1; z++) {
VoxelShape shape = data.getBlockShape(x, y, z);
if (shape == null) continue;
for (BoundingBox other : shape.getBoundingBoxes()) {
switch (axis) {
case X -> {
if (box.intersects(x, y, z, other)) {
if (negative) {
v = Math.max(v, x + other.getMaxX() - this.x);
} else {
v = Math.min(v, x + other.getMinX() - this.x - size);
}
}
}
case Y -> {
if (box.intersects(x, y, z, other)) {
if (negative) {
v = Math.max(v, y + other.getMaxY() - this.y);
} else {
v = Math.min(v, y + other.getMinY() - this.y - size);
}
}
}
case Z -> {
if (box.intersects(x, y, z, other)) {
if (negative) {
v = Math.max(v, z + other.getMaxZ() - this.z);
} else {
v = Math.min(v, z + other.getMinZ() - this.z - size);
}
}
}
}
}
}
}
}
return v;
}
public static int floor(double value) {
int i = (int) value;
return value < (double) i ? i - 1 : i;
}
public void explode() {
removed = true;
// TODO: Implement
}
}

View File

@ -0,0 +1,30 @@
/*
* 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.features.simulator.preview;
public class SimulatorPreviewVec {
public double x;
public double y;
public double z;
public double lengthSquared() {
return x * x + y * y + z * z;
}
}

View File

@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.slaves.laufbau;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import org.bukkit.Material;
@ -59,7 +60,7 @@ public class LaufbauSettings {
open();
return;
}
if (clickType.isCreativeAction()) {
if (clickType.isLeftClick()) {
open(entry.getKey());
return;
}
@ -91,7 +92,7 @@ public class LaufbauSettings {
});
inv.setItem(49, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_GUI_BACK", p), clickType -> {
open();
}));
}).setCustomModelData(CMDs.BACK));
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.BlockTypes;
import de.steamwar.bausystem.utils.WorldEditUtils;
import de.steamwar.core.Core;
import lombok.Getter;
import lombok.SneakyThrows;
import org.bukkit.Location;
@ -56,7 +57,7 @@ public class Panzern {
private BaseBlock blockType;
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 airType = BlockTypes.AIR.getDefaultState().toBaseBlock();

View File

@ -19,8 +19,8 @@
package de.steamwar.bausystem.features.smartplace;
import de.steamwar.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.Reflection;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.configplayer.Config;
@ -57,6 +57,7 @@ public class SmartPlaceListener implements Listener {
static {
World world = Bukkit.getWorlds().get(0);
Block block = world.getBlockAt(0, 0, 0);
block.setType(Material.AIR);
BlockState state = block.getState();
for (Material material : Material.values()) {
if (material.isLegacy()) continue;
@ -68,6 +69,7 @@ public class SmartPlaceListener implements Listener {
} else if (blockData instanceof Stairs) {
CONTAINERS.add(material);
}
state.update(true, false);
}
CONTAINERS.add(Material.GRINDSTONE);
CONTAINERS.remove(Material.COMPARATOR);
@ -223,7 +225,7 @@ public class SmartPlaceListener implements Listener {
Block block = event.getBlock().getRelative(BlockFace.DOWN);
BlockState old = block.getState();
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
block.setType(Material.GLASS);
block.setType(Material.GLASS, true);
old.update(true, false);
}, 1);
}

View File

@ -42,16 +42,16 @@ public class TPSCommand extends SWCommand {
public void genericCommand(Player p, String... args) {
BauSystem.MESSAGE.sendPrefixless("OTHER_TPS_HEAD", p);
BauSystem.MESSAGE.sendPrefixless("OTHER_TPS_MESSAGE", p,
TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_SECOND),
TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_SECONDS),
TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_MINUTE),
TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES),
TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES)
TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.ONE_SECOND),
TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.TEN_SECONDS),
TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.ONE_MINUTE),
TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.FIVE_MINUTES),
TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.TEN_MINUTES)
);
}
@Register
public void genericCommand(Player p, TPSWatcher.TPSType type) {
BauSystem.MESSAGE.sendPrefixless("OTHER_TPS_SINGLE", p, tpsSystem.getTPS(type));
BauSystem.MESSAGE.sendPrefixless("OTHER_TPS_SINGLE", p, TPSWatcher.getTPSUnlimited(type));
}
}

View File

@ -38,6 +38,7 @@ import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWItem;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import de.steamwar.linkage.MaxVersion;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@ -51,14 +52,11 @@ import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
@Linked
@MaxVersion(20) // Hotfix for 1.21 tps limit! -> Backport coming later
public class TPSSystem implements Listener {
@Getter
private double currentTPSLimit = 20;
public double getTPS(TPSWatcher.TPSType tpsType) {
return TPSWatcher.getTPSUnlimited(tpsType);
}
private static double currentTPSLimit = 20;
public TPSSystem() {
if (TPSFreezeUtils.isCanFreeze()) {
@ -336,26 +334,26 @@ public class TPSSystem implements Listener {
} else if (TPSFreezeUtils.frozen()) {
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + BauSystem.MESSAGE.parse("SCOREBOARD_TPS_FROZEN", p);
} else {
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + tpsColor() + tpsSystem.getTPS(TPSWatcher.TPSType.ONE_SECOND) + tpsLimit();
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + tpsColor() + TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.ONE_SECOND) + tpsLimit();
}
}
private String tpsColor() {
double tps = tpsSystem.getTPS(TPSWatcher.TPSType.ONE_SECOND);
if (tps > tpsSystem.getCurrentTPSLimit() * 0.9) {
double tps = TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.ONE_SECOND);
if (tps > TPSSystem.getCurrentTPSLimit() * 0.9) {
return "§a";
}
if (tps > tpsSystem.getCurrentTPSLimit() * 0.5) {
if (tps > TPSSystem.getCurrentTPSLimit() * 0.5) {
return "§e";
}
return "§c";
}
private String tpsLimit() {
if (tpsSystem.getCurrentTPSLimit() == 20) {
if (TPSSystem.getCurrentTPSLimit() == 20) {
return "";
}
return "§8/§7" + tpsSystem.getCurrentTPSLimit();
return "§8/§7" + TPSSystem.getCurrentTPSLimit();
}
}

View File

@ -25,23 +25,18 @@ import de.steamwar.bausystem.region.utils.RegionType;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.TNTPrimed;
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.Optional;
/**
* Recording of a tnt at a specific tick
*/
@AllArgsConstructor(access = AccessLevel.PACKAGE)
@AllArgsConstructor
@Getter
public class TNTPoint{
/**

View File

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

View File

@ -57,19 +57,26 @@ public class TraceManager implements Listener {
if (traceFiles == null)
return;
boolean hasMetaFiles = false;
for (File traceFile : traceFiles) {
if (traceFile.getName().contains(".records"))
continue;
if (TraceRepository.getVersion(traceFile) == TraceRepository.SERIALISATION_VERSION) {
add(TraceRepository.readTrace(traceFile));
} else {
String uuid = traceFile.getName().replace(".meta", "");
new File(tracesFolder, uuid + ".records").deleteOnExit();
new File(tracesFolder, uuid + ".meta").deleteOnExit();
if (traceFile.getName().contains(".meta")) {
hasMetaFiles = true;
}
}
if (hasMetaFiles) {
for (File traceFile : traceFiles) {
traceFile.delete();
}
traceFiles = new File[0];
}
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)");
traces.remove(traceId);
trace.hide();
trace.getMetadataSaveFile().delete();
trace.getRecordsSaveFile().delete();
}
@ -172,7 +178,6 @@ public class TraceManager implements Listener {
tracesByRegion.getOrDefault(region, new HashMap<>())
.forEach((i, trace) -> {
if (trace.getRegion() != region) return;
trace.getMetadataSaveFile().delete();
trace.getRecordsSaveFile().delete();
});
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.region.Region;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import org.bukkit.Bukkit;
import org.bukkit.block.Block;
import org.bukkit.entity.TNTPrimed;
@ -31,7 +32,6 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.server.PluginEnableEvent;
import java.util.*;
import java.util.logging.Level;
@ -40,12 +40,9 @@ import java.util.logging.Logger;
@Linked
public class TraceRecorder implements Listener {
@LinkedInstance
public static TraceRecorder instance;
{
instance = this;
}
/**
* Map for all traces being actively recorded
*/
@ -102,11 +99,14 @@ public class TraceRecorder implements Listener {
*
* @param region region to be recorded
*/
public void startRecording(Region region) {
if (activeTraces.containsKey(region)) return;
public Trace startRecording(Region region) {
if (activeTraces.containsKey(region)) {
return activeTraces.get(region).getTrace();
}
TraceRecordingWrapper wrappedTrace = new TraceRecordingWrapper(region);
activeTraces.put(region, wrappedTrace);
return wrappedTrace.getTrace();
}
/**

View File

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

View File

@ -9,95 +9,125 @@ import org.bukkit.util.Vector;
import java.io.*;
import java.util.*;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
public class TraceRepository {
/**
* 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");
@SneakyThrows
protected static int getVersion(File metadataFile) {
public static Trace readTrace(File recordsFile) {
@Cleanup
ObjectInputStream reader = new ObjectInputStream(new FileInputStream(metadataFile));
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));
ObjectInputStream reader = new ObjectInputStream(new GZIPInputStream(new FileInputStream(recordsFile)));
UUID uuid = UUID.fromString(reader.readUTF());
Region region = Region.getREGION_MAP().get(reader.readUTF());
Date date = (Date) reader.readObject();
File recordsFile = new File(tracesFolder,uuid + ".records");
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
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.getRegion().getName());
outputStream.writeObject(trace.getDate());
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.close();
writeTraceRecords(trace.getRecordsSaveFile(), records);
}
@SneakyThrows
protected static void writeTraceRecords(File recordsFile, List<TNTPoint> records) {
DataOutputStream outputStream = new DataOutputStream(new FileOutputStream(recordsFile));
for (TNTPoint record : records) {
outputStream.writeInt(record.getTntId());
outputStream.writeBoolean(record.isExplosion());
outputStream.writeBoolean(record.isInWater());
outputStream.writeBoolean(record.isAfterFirstExplosion());
outputStream.writeBoolean(record.isDestroyedBuildArea());
outputStream.writeBoolean(record.isDestroyedTestBlock());
outputStream.writeLong(record.getTicksSinceStart());
outputStream.writeInt(record.getFuse());
Location location = record.getLocation();
private static void writeTNTPoint(ObjectOutputStream outputStream, TNTPoint tntPoint, boolean writeTickData) {
byte data = 0;
if (writeTickData) data |= WRITE_TICK_DATA;
if (tntPoint.isExplosion()) data |= EXPLOSION;
if (tntPoint.isInWater()) data |= IN_WATER;
if (tntPoint.isAfterFirstExplosion()) data |= AFTER_FIRST_EXPLOSION;
if (tntPoint.isDestroyedBuildArea()) data |= DESTROYED_BUILD_AREA;
if (tntPoint.isDestroyedTestBlock()) data |= DESTROYED_TEST_BLOCK;
outputStream.write(data);
if (writeTickData) {
outputStream.writeLong(tntPoint.getTicksSinceStart());
outputStream.writeInt(tntPoint.getFuse());
}
Location location = tntPoint.getLocation();
outputStream.writeDouble(location.getX());
outputStream.writeDouble(location.getY());
outputStream.writeDouble(location.getZ());
Vector velocity = record.getVelocity();
Vector velocity = tntPoint.getVelocity();
outputStream.writeDouble(velocity.getX());
outputStream.writeDouble(velocity.getY());
outputStream.writeDouble(velocity.getZ());
}
outputStream.flush();
outputStream.close();
}
@SneakyThrows
protected static TNTPoint readTraceRecord(DataInputStream objectInput) {
protected static TNTPoint readTraceRecord(int tntId, TNTPoint last, ObjectInputStream objectInput) {
int tntId = objectInput.readInt();
boolean explosion = objectInput.readBoolean();
boolean inWater = objectInput.readBoolean();
boolean afterFirstExplosion = objectInput.readBoolean();
boolean destroyedBuildArea = objectInput.readBoolean();
boolean destroyedTestBlock = objectInput.readBoolean();
long ticksSinceStart = objectInput.readLong();
int fuse = objectInput.readInt();
int data = objectInput.read();
boolean explosion = (data & EXPLOSION) > 0;
boolean inWater = (data & IN_WATER) > 0;
boolean afterFirstExplosion = (data & AFTER_FIRST_EXPLOSION) > 0;
boolean destroyedBuildArea = (data & DESTROYED_BUILD_AREA) > 0;
boolean destroyedTestBlock = (data & DESTROYED_TEST_BLOCK) > 0;
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 locY = objectInput.readDouble();
@ -116,21 +146,29 @@ public class TraceRepository {
protected static List<TNTPoint> readTraceRecords(Trace trace) {
File recordsFile = trace.getRecordsSaveFile();
@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<>();
for (int i = 0; i < trace.getRecordsCount(); i++) {
records.add(readTraceRecord(inputStream));
}
Map<Integer, List<TNTPoint>> histories = new HashMap<>();
for (TNTPoint record : records) {
int tntId = record.getTntId();
List<TNTPoint> history = histories.computeIfAbsent(tntId, id -> new ArrayList<>());
history.add(record);
record.setHistory(history);
}
for (int i = 0; i < trace.getTntIdCount(); i++) {
int tntId = inputStream.readInt();
int size = inputStream.readInt();
List<TNTPoint> points = histories.computeIfAbsent(tntId, id -> new ArrayList<>());
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;
}
}

View File

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.tracer.rendering;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.bausystem.features.tracer.TNTPoint;
import de.steamwar.bausystem.features.tracer.Trace;
import de.steamwar.bausystem.features.tracer.TraceManager;
@ -30,10 +31,13 @@ import net.md_5.bungee.api.chat.ClickEvent;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import yapion.hierarchy.types.YAPIONValue;
import java.util.List;
import java.util.stream.Collectors;
import static de.steamwar.bausystem.features.util.TNTClickListener.TNT_CLICK_DETAILS;
/**
* Wrapper for the rendering of a record bundle
*/
@ -66,6 +70,7 @@ public class TraceEntity extends RFallingBlockEntity {
* @param player the player the message should be printed for
*/
public void printIntoChat(Player player) {
if (!Config.getInstance().get(player).getOrSetDefault(TNT_CLICK_DETAILS, new YAPIONValue<>(true)).asBoolean().orElse(true)) return;
TNTPoint representative = records.get(0);
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_HEADER", player);

View File

@ -26,6 +26,7 @@ import de.steamwar.bausystem.shared.EnumDisplay;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
@ -202,9 +203,9 @@ public class MaterialCommand extends SWCommand implements Listener {
private void searchGUI(Player p) {
SWInventory swInventory = new SWInventory(p, 54, BauSystem.MESSAGE.parse("MATERIAL_SEARCH", 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);
}));
}).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 -> {
SWAnvilInv swAnvilInv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_NAME", p), search.name);
swAnvilInv.setCallback(s -> {

View File

@ -42,6 +42,15 @@ public class SkullCommand extends SWCommand {
super("skull", "head");
}
@Register
public void giveCommand(@Validator Player p) {
if (p.getName().startsWith(".")) {
BauSystem.MESSAGE.send("SKULL_INVALID", p);
return;
}
giveCommand(p, p.getName());
}
@Register(description = "SKULL_HELP")
public void giveCommand(@Validator Player p, @Mapper("player") @ErrorMessage("SKULL_INVALID") String skull) {
ItemStack is = SWItem.getPlayerSkull(skull).getItemStack();
@ -63,7 +72,7 @@ public class SkullCommand extends SWCommand {
@Override
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
return Bukkit.getOnlinePlayers().stream().map(Player::getName).filter(s1 -> !s1.endsWith("")).collect(Collectors.toList());
return Bukkit.getOnlinePlayers().stream().map(Player::getName).filter(s1 -> !s1.startsWith(".")).collect(Collectors.toList());
}
};
}

View File

@ -21,22 +21,46 @@ package de.steamwar.bausystem.features.util;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.EquipmentSlot;
import yapion.hierarchy.types.YAPIONObject;
import yapion.hierarchy.types.YAPIONValue;
@Linked
public class TNTClickListener implements Listener {
public class TNTClickListener extends SWCommand implements Listener {
public static final String TNT_CLICK_DETAILS = "tnt_click_details";
public TNTClickListener() {
super("tntdetails");
}
@Register(description = "TNT_DETAILS_COMMAND")
public void toggle(Player player) {
YAPIONObject yapionObject = Config.getInstance().get(player);
if (yapionObject.getOrSetDefault(TNT_CLICK_DETAILS, new YAPIONValue<>(true)).asBoolean().orElse(true)) {
yapionObject.put(TNT_CLICK_DETAILS, false);
BauSystem.MESSAGE.send("TNT_DETAILS_OFF", player);
} else {
yapionObject.put(TNT_CLICK_DETAILS, true);
BauSystem.MESSAGE.send("TNT_DETAILS_ON", player);
}
}
@EventHandler
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
if (event.getHand() != EquipmentSlot.HAND) return;
if (!Config.getInstance().get(event.getPlayer()).getOrSetDefault(TNT_CLICK_DETAILS, new YAPIONValue<>(true)).asBoolean().orElse(true)) return;
Entity entity = event.getRightClicked();
if (event.getRightClicked() instanceof TNTPrimed) {

View File

@ -36,7 +36,7 @@ public class Warp {
public static void enable() {
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);
warpMap.put("WorldSpawn", worldSpawn);
}

View File

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

View File

@ -179,7 +179,12 @@ public class SpectatorListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
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())) {
event.setCancelled(true);
event.setMessage("/");

View File

@ -73,4 +73,8 @@ public class Point {
public Location toLocation(Player player, double dx, double dy, double dz) {
return new Location(player.getWorld(), x + dx, y + dy, z + dz, player.getLocation().getYaw(), player.getLocation().getPitch());
}
public BlockVector3 toBlockVector3() {
return BlockVector3.at(this.x, this.y, this.z);
}
}

419
BauSystem/SCRIPT.md Normal file
View File

@ -0,0 +1,419 @@
# SteamWar.de - Script System
---
<!-- TOC -->
* [SteamWar.de - Script System](#steamwarde---script-system)
* [Einleitung](#einleitung)
* [Nutzung mit einer IDE](#nutzung-mit-einer-ide)
* [Basis-Apis](#basis-apis)
* [SteamWar.de-Api](#steamwarde-api)
* [player](#player)
* [random](#random)
* [region](#region)
* [tnt](#tnt)
* [trace](#trace)
* [server](#server)
* [tps](#tps)
* [storage](#storage)
* [inventory](#inventory)
* [SteamWar.de-Global-Api](#steamwarde-global-api)
* [Commands](#commands)
* [Hotkeys](#hotkeys)
* [Eventtypen](#eventtypen)
* [BlockEvent](#blockevent)
* [InteractEvent](#interactevent)
* [Position](#position)
* [Instabile APIs](#instabile-apis)
* [_worldedit](#worldedit)
* [Beispiele](#beispiele)
* [Hello, World!](#hello-world)
* [Code](#code)
* [Ausgabe](#ausgabe)
* [BauGUI on DoubleSwap](#baugui-on-doubleswap)
* [Code](#code-1)
* [SL Command](#sl-command)
* [Code](#code-2)
* [Paste Hotkey](#paste-hotkey)
* [Code](#code-3)
* [Inventory](#inventory-1)
* [Code](#code-4)
<!-- TOC -->
## Einleitung
Das Script System auf SteamWar.de basiert auf [Lua](https://www.lua.org/docs.html).
Der Code wird einfach in ein Minecraft Buch geschrieben und kann mit einem Links-Klick ausgeführt werden.
## Nutzung mit einer IDE
Im Repository liegen [Lua-Definitionen](sw.def.lua) für [Luanalysis](https://plugins.jetbrains.com/plugin/14698-luanalysis).
Diese können in der IDE genutzt werden, um die APIs zu nutzen.
Einfach die `sw.def.lua` in denselben Ordner wie das Script legen und die IDE sollte die APIs erkennen.
# Basis-Apis
Es werden folgende Standard-Apis zur Verfügung gestellt:
- [`math`](https://www.lua.org/manual/5.4/manual.html#6.7)
- [`string`](https://www.lua.org/manual/5.4/manual.html#6.4)
- [`table`](https://www.lua.org/manual/5.4/manual.html#6.6)
- [`bit32`](https://www.lua.org/manual/5.2/manual.html#6.7)
# SteamWar.de-Api
APIs, die mit einem `_` beginnen sind noch nicht stabil und können sich jederzeit ändern.
Sie sollten daher nicht verwendet werden, da sie sich noch in der Entwicklung befinden.
Diese können auch undokumentierte Funktionen enthalten, die nicht in der Dokumentation aufgeführt sind.
In den Scripten gibt es dazu noch folgende globale Variablen:
- [`player`](#player)
- [`random`](#random)
- [`region`](#region)
- [`server`](#server)
- [`storage`](#storage)
- [`inventory`](#inventory)
- `_worldedit`
Ohne eine Kategorie sind folgende Funktionen verfügbar, die nicht allgemein sind:
| Name | Signature | Beschreibung |
|-----------|-----------------------------------|-------------------------------------------------------------------------------------------------------------------|
| `print` | print(String...) | @see chat(String...) |
| `input` | input(String, Function\<String>) | Fragt den User nach einer Eingabe mit der Nachricht und called die zugehörige Funktion nach dieser |
| `delayed` | delayed(Number, Function\<Void>) | Wartet die angegebene Anzahl an Ticks und führt danach die zugehörige Funktion aus |
| `pos` | pos(Number, Number, Number) | Erstellt aus drei Zahlen eine Position-Table. Die Koordinaten sind unter den Namen `x`, `y` und `z` abgespeichert |
| `exec` | exec(String...) | Führt den angegebenen Befehl als Spieler aus |
| `length` | length(Any): Int | Gibt die Länge des Objekts zurück |
| `join` | length(String, String...): String | Füge die Texte mit den ersten Parameter zusammen |
### player
Das `player`-Modul stellt Funktionen zur Verfügung, die den Spieler betreffen.
Es gibt folgende Funktionen:
| Name | Signature | Beschreibung |
|------------------|--------------------------------|---------------------------------------------------------------------------------------------------------------------------|
| `name` | name(): String | Gibt den `displayName` des Spielers zurück |
| `chat` | chat(String...) | Sendet den Text in den Chat des Spielers |
| `actionbar` | actionbar(String...) | Sendet den Text in die ActionBar des Spielers |
| `x` | x(Number), x(): Number | Setzt oder gibt die X-Koordinate des Spielers |
| `y` | y(Number), y(): Number | Setzt oder gibt die Y-Koordinate des Spielers |
| `z` | z(Number), z(): Number | Setzt oder gibt die Z-Koordinate des Spielers |
| `yaw` | yaw(Number), yaw(): Number | Setzt oder gibt die Gierung des Spielers |
| `pitch` | pitch(Number), pitch(): Number | Setzt oder gibt die Steigung des Spielers |
| `sneaking` | sneaking(): Boolean | Wahr, wenn der Spieler am Sneaken ist |
| `sprinting` | sprinting(): Boolean | Wahr, wenn der Spieler am Sprinten ist |
| `slot` | slot(Number), slot(): Number | Setzt oder gibt den Slot des gehaltenden Items des Spielers [(Wiki)](https://minecraft.fandom.com/wiki/Slot#Java_Edition) |
| `item` | item(): String | Gibt den Itemtyp der Main-Hand zurück |
| `offHandItem` | offHandItem(): String | Gibt den Itemtyp der Off-Hand zurück |
| `closeInventory` | closeInventory() | Schließe das aktuell geöffnete Inventar des Spielers |
### random
Das `random`-Modul stellt Funktionen zur Verfügung, die Zufallszahlen betreffen.
Es gibt folgende Funktionen:
| Name | Signature | Beschreibung |
|------------|------------------------------------|-------------------------------------------------------------------------------|
| nextInt | nextInt(): Int | Gibt eine Zufallszahl zurück zwischen Integer.MIN_VALUE und Integer.MAX_VALUE |
| -"- | nextInt(Int): Int | Gibt eine Zufallszahl zurück zischen 0 und dem Argument |
| -"- | nextInt(Int, Int): Int | Gibt eine Zufallszahl zurück zwischen dem ersten und zweiten Argument |
| nextDouble | nextDouble(): Double | Gibt eine Zufallszahl zurück zwischen 0 und 1 |
| -"- | nextDouble(Double): Double | Gibt eine Zufallszahl zurück zwischen 0 und dem Argument |
| -"- | nextDouble(Double, Double): Double | Gibt eine Zufallszahl zurück zwischen ersten und zweiten Argument |
| nextBool | nextBool(): Boolean | Gibt true oder false zurück |
### region
Das `region`-Modul stellt Funktion zur Verfügung, die die Region des Spielers betreffen.
Es gibt folgende Funktionen:
| Name | Signature | Beschreibung |
|-----------|---------------------|------------------------------------------------------------------------------------------------------------|
| `name` | name(): String | Gibt den Regionsnamen |
| `type` | type(): String | Gibt den Regionstyp |
| `fire` | fire(): Boolean | Gibt den Fire-Modus der Region zurück |
| `freeze` | freeze(): Boolean | Gibt den Freeze-Modus der Region zurück |
| `protect` | protect(): Boolean | Gibt den Protect-Modus der Region zurück |
| `loader` | loader(): String | Gibt den Status des Loaders des Spielers zurück, die Werte sind: `OFF`, `SETUP`, `RUNNING`, `PAUSE`, `END` |
| `get` | get(String): Region | Gibt die Region mit dem Namen zurück. Die Region ist gleich aufgebaut wie das Regions-Modul |
| `list` | list(): Region[] | Gibt alle Region zurück. Die Region ist gleich aufgebaut wie das Regions-Modul |
Es gibt folgende weitere Module:
| Name | Beschreibung |
|---------|-----------------|
| `tnt` | [tnt](#tnt) |
| `trace` | [trace](#trace) |
#### tnt
Das `tnt`-Modul stellt Funktionen zur Verfügung, die den TNT-Modus in der Region des Spielers betreffen.
Es gibt folgende Funktionen:
| Name | Signature | Beschreibung |
|-------------|----------------------|-------------------------------------------------------------------------------------|
| `mode` | mode(): String | Gibt den Aktuellen TNT-Modus zurück, die werte sind: `ALLOW`, `DENY` oder `ONLY_TB` |
| `enabled` | enabled(): Boolean | Gibt zurück, ob der TNT-Modus in der Region des Spielers aktiviert ist oder nicht |
| `onlyTb` | onlyTb(): Boolean | Gibt zurück, ob der TNT-Modus auf Only-Tb ist |
| `onlyBuild` | onlyBuild(): Boolean | Gibt zurück, ob der TNT-Modus auf Only-Build ist |
#### trace
Das `trace`-Modul stellt Funktionen zur Verfügung, die den Status des Tracers der Region betreffen.
Es gibt folgende Funktionen:
| Name | Signature | Beschreibung |
|----------|-------------------|--------------------------------------------------------------------------------|
| `active` | active(): Boolean | Gibt zurück, ob der Tracer in der Region des Spielers aktiviert ist oder nicht |
| `auto` | auto(): Boolean | Gibt zurück, ob der Tracer in der Region ein Auto-Tracer ist |
| `status` | status(): String | Gibt den Status des Tracers zurück |
| `time` | time(): String | Gibt die Zeit des Tracers zurück |
## server
Das `server`-Modul stellt Funktionen zur Verfügung, die den Server betreffen.
Es gibt folgende Funktionen:
| Name | Signature | Beschreibung |
|--------------|-------------------------|---------------------------------------------------------------------|
| `time` | time(): String | Gibt die aktuelle Zeit im Format `HH:mm:ss` zurück |
| `ticks` | ticks(): Number | Gibt die Ticks seit start des Serverstarts zurück |
| `getBlockAt` | getBlockAt(Pos): String | Gibt das Material an der Position zurück |
| `setBlockAt` | setBlockAt(Pos, String) | Setzt das Material an der angegebenen Stelle (z.B. Stein = `STONE`) |
Es gibt folgende weitere Module:
| Name | Beschreibung |
|-------|--------------|
| `tps` | [tps](#tps) |
#### tps
Das `tps`-Modul stellt Funktionen zur Verfügung, die die TPS des Servers betreffen.
Es gibt folgende Funktionen:
| Name | Signature | Beschreibung |
|--------------|----------------------|-------------------------------------------------------------------|
| `current` | current(): Number | Gibt die aktuelle TPS zurück (Das selbe wie `oneSecound()`) |
| `oneSecond` | oneSecond(): Number | Gibt die durchschnittliche TPS über die letzte Sekunde zurück |
| `tenSecond` | tenSecond(): Number | Gibt die durchschnittliche TPS über die letzte 10 Sekunden zurück |
| `oneMinute` | oneMinute(): Number | Gibt die durchschnittliche TPS über die letzte Minute zurück |
| `fiveMinute` | fiveMinute(): Number | Gibt die durchschnittliche TPS über die letzte 5 Minuten zurück |
| `tenMinute` | tenMinute(): Number | Gibt die durchschnittliche TPS über die letzte 10 Minuten zurück |
| `limit` | limit(): Number | Gibt das TPS-Limit zurück |
## storage
Das `storage`-Modul stellt Funktionen zur Verfügung, mit welchen man Werte speichern kann.
Es gibt folgende Module:
| Name | Beschreibung |
|----------|---------------------|
| `player` | Spieler abhängig |
| `region` | Region des Spielers |
| `global` | Alle Skripte |
Alle Module haben folgende Funktionen:
| Name | Signature | Beschreibung |
|------------|----------------------------|--------------------------------------------------------|
| `get` | get(String): Any | Gibt den Wert des Schlüssels zurück |
| `set` | set(String, Any) | Setzt den Wert des Schlüssels auf den angegebenen Wert |
| `has` | has(String): Boolean | Prüft ob ein Wert vorhanden ist |
| `remove` | remove(String) | Löscht den Schlüssel |
| `accessor` | accessor(String): Accessor | Gibt einen Accessor zurück |
Ein Accessor ist ein Objekt, womit du direkt auf einen Wert zugreifen kannst und es ändern kannst.
Es geht wie folgt:
```lua
keyAccessor = storage.player.accessor("key")
keyAccessor("Hello World") -- Setzt den Wert auf "Hello World"
print(keyAccessor()) -- Gibt den Wert zurück
```
## inventory
Das `inventory`-Modul stellt Funktionen zur Verfügung, um ein Inventar zu öffnen.
Es gibt folgende Funktionen:
| Name | Signature | Beschreibung |
|----------|-----------------------------------|-------------------------------------------------------------------|
| `create` | create(String, Number): Inventory | Erstellt ein Inventar mit dem Title und der Anzahl an Zeilen |
Das `Inventory`-Objekt hat folgende Funktionen:
| Name | Signature | Beschreibung |
|-------------------|--------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `item` | item(Number, String, String, Function\<String>) | Setze ein Item mit dem Typen des ersten Strings an den Slot (Startet bei 0) mit dem Namen des zweiten Strings mit einem Klick-Handler der den Klick-Typen rein gibt (z.B. `LEFT`, `SHIFT_LEFT`, `RIGHT`, `SHIFT_RIGHT`) |
| -"- | item(Number, String, String, Function\<String>, List<String>) | Füge eine Lore an das Item hinzu |
| -"- | item(Number, String, String, Function\<String>, List<String>, Boolean) | Gebe an, ob das Item enchanted sein soll |
| -"- | item(Number, String, String, Function\<String>, List<String>, Boolean, Number) | Gebe die Anzahl der Items an |
| `setCloseHandler` | setCloseHandler(Function\<Void>) | Gebe einen Handler an, der beim schließen des Inventares ausgeführt wird |
| `open` | open() | Öffne das Inventar |
Siehe auch: [Inventory Beispiel](#inventory-1)
Siehe auch: [Liste an Materials](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html)
```
⚠️⚠️⚠️
Wenn eine Barrier statt des richtigen Items angezeigt wird, dann ist das angegebene Material nicht gültig.
⚠️⚠️⚠️
```
# SteamWar.de-Global-Api
Mit `/script` kann man Script-Bücher global abspeichern. Diese haben dann zugrif auf die `global`-Api.
Die `global`-Api stellt Funktionen zur Verfügung um auf Events, Commands und Hotkeys mit einem Script zu reagieren.
Es gibt folgende Funktionen:
| Name | Signature | Beschreibung |
|-----------|-----------------------------------|-----------------------------------------------------------------------------|
| `event` | event(EventType, Function(Any)) | Registriere einen Event Listener |
| `command` | command(String, Function(Args)) | Registriere einen Befehl |
| `hotkey` | hotkey(String, Function(Boolean)) | Registriere einen Hotkey, the function gets a boolean if the key is pressed |
Es gibt folgende Variablen:
| Name | Beschreibung |
|----------|----------------------------------|
| `events` | Siehe: [Event Type](#eventtypen) |
## Commands
Der Command Handler kriegt eine Liste aller angegeben argumenten. Die Argumente sind vom Typ `String`. Mit dem Wert gespeichert unter `args.alias` oder `args["alias"]` erhältst du, welcher command eingegeben wurde. Wenn ein handler für mehrere Befehle registriert wurde kannst du es hiermit erkennen.
Du kannst `args.hasShortFlag(String)` um herauszufinden ob eine Flag angegeben wurde wie zum Beispiel `-f`. Mit `args.removeShortFlag(String)` kannst du die Flag entfernen und erhältst ob sie angegeben wurde.
## Hotkeys
Hotkeys werden im folgenden Format angegeben: `MODIFIER+KEY`. Bei den Hotkey erstellung ist die Großschreibung egal. Es gibt folgende Modifier:
- `ctrl`
- `shift`
- `alt`
- `meta`
Es können auch mehrere Modifier angegeben werden, z.B. `ctrl+shift+alt+c`. Die Reihenfolge der Modifier und des Keys ist egal.
## Eventtypen
Einige Events sind auch abbrechbar, dazu muss die Funktion `setCancelled()` aufgerufen werden.
| Name | Wenn | Parameter | Abbrechbar |
|---------------------|-----------------------------------------------------|---------------------------------|------------|
| `DoubleSwap` | Beim Doppelten Drücken der Swap-Hands taste | NIL | false |
| `PlaceBlock` | Beim Platzieren von Blöcken | [BlockEvent](#blockevent) | true |
| `BreakBlock` | Beim Zerstören von Blöcken | [BlockEvent](#blockevent) | true |
| `RightClick` | Beim Rechtsklick | [InteractEvent](#interactevent) | true |
| `LeftClick` | Beim Linksklick | [InteractEvent](#interactevent) | true |
| `TNTSpawn` | Wenn ein TNT in der aktuellen Region spawnt | NIL | false |
| `TNTExplode` | Wenn ein TNT in der aktuellen Region explodiert | [Position](#position) | true |
| `TNTExplodeInBuild` | Wenn ein TNT in der aktuellen Bau Region explodiert | [Position](#position) | true |
| `SelfJoin` | Wenn man selbst den Server betritt | NIL | false |
| `SelfLeave` | Wenn man den Server verlässt | NIL | false |
| `DropItem` | Wenn man ein Item droppt | (type: Material) | true |
| `EntityDeath` | Wenn ein Entity stirbt | (type: Entity Type) | false |
### BlockEvent
Das übergebene Objekt an den Handler hat folgende Variablen:
| Name | Beschreibung |
|--------|-----------------------------|
| `x` | Die X-Koordinate des Blocks |
| `y` | Die Y-Koordinate des Blocks |
| `z` | Die Z-Koordinate des Blocks |
| `type` | Das Material des Blocks |
### InteractEvent
Das übergebene Objekt an den Handler hat folgende Variablen:
| Name | Beschreibung |
|------------|-------------------------------------------------------------------------------------------------------------------------------|
| `action` | Die Action die ausgeführt wurde, Mögliche Werte: `RIGHT_CLICK_BLOCK`, `RIGHT_CLICK_AIR`, `LEFT_CLICK_BLOCK`, `LEFT_CLICK_AIR` |
| `hand` | Die Hand die zum ausführen genutzt wird, Mögliche Werte: `HAND`, `OFF_HAND`, `null` |
| `block` | Der Typ des Items mit dem geklickt wurde |
| `hasBlock` | Wahr, wenn auf einen Block geklickt wurde |
Wenn `hasBlock` wahr ist, gibt es folgende Variablen:
| Name | Beschreibung |
|-------------|-----------------------------------------|
| `blockX` | Die X-Koordinate des Blocks |
| `blockY` | Die Y-Koordinate des Blocks |
| `blockZ` | Die Z-Koordinate des Blocks |
| `blockFace` | Die Seite des Blocks die geklickt wurde |
### Position
Die Position ist ein Objekt mit folgenden Variablen:
| Name | Beschreibung |
|------|------------------|
| `x` | Die X-Koordinate |
| `y` | Die Y-Koordinate |
| `z` | Die Z-Koordinate |
# Instabile APIs
Hier sind einige APIs aufgelistet, die nicht stabil sind und sich jederzeit ändern können.
## _worldedit
| Name | Signatur | Beschreibung |
|-------------|-----------------------------------------------------------|-----------------------------------|
| `selection` | selection(Liste\<Pos>), selection(): {min: Pos, max: Pos} | Die aktuelle auswahl des Spielers |
# Beispiele
## Hello, World!
Ein einfaches Hello, World!-Script.
#### Code
```lua
print("Hello, World!")
```
#### Ausgabe
```
Hello, World!
```
## BauGUI on DoubleSwap
Das Standardskript für das Öffnen des BauGUIs
#### Code
```lua
function handler(event)
exec("gui")
end
event(events.DoubleSwap, handler)
```
## SL Command
Ein einfacher Command Redefiner.
#### Code
```lua
function handler(args)
exec("stoplag")
end
command("sl", handler)
```
## Paste Hotkey
Ein Hotkey zum Pasten des Clipboard-Inhalts.
#### Code
```lua
function handler(pressed)
if pressed then
exec("/paste -o")
end
end
hotkey("ctrl+v", handler)
```
## Inventory
Ein Beispiel für ein Inventar.
#### Code
```lua
inv = inventory.create("Test Inv", 3)
inv.item(13, "STONE", "Ich bin ein Stein", function(e) player.chat(e) end, {"Die Lore", "Die Zweite Zeile"}, true)
inv.open()
```

View File

@ -34,3 +34,20 @@ dependencies {
implementation(project(":BauSystem:BauSystem_20"))
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"
}

87
BauSystem/hotkeys.lua Normal file
View File

@ -0,0 +1,87 @@
-- 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/>.
---
--- This serves both as an example and a quick start to the Stewamwar Script Api
---
function hotkeys_freeze(pressed)
if pressed then
exec("/freeze")
end
end
function hotkeys_rgc(pressed)
if pressed then
exec("/rgc")
end
end
function hotkeys_rgp(pressed)
if pressed then
exec("/rgp")
end
end
trace_cycle_counter = 0;
function hotkeys_cycle_trace_view(pressed)
if not pressed then
return
end
trace_cycle = (trace_cycle + 1) % 3
trace_commands = {"trace hide", "trace show", "trace show -e -c"}
exec(trace_commands[trace_cycle + 1])
end
function hotkeys_tick_step(pressed)
if pressed then
exec("tick step")
end
end
function hotkeys_tpslimit(pressed)
if not pressed then
return
end
if tps.limit() == 20 then
exec("tpslimit 200")
else
exec("tpslimit 20")
end
end
function hotkeys_tb(pressed)
if pressed then
exec("tb -e")
end
end
function hotkeys_trace_delete(pressed)
if pressed then
exec("trace delete")
end
end
hotkey("ctrl+g", hotkeys_freeze)
hotkey("ctrl+c", hotkeys_rgc)
hotkey("ctrl+v", hotkeys_rgp)
hotkey("ctrl+x", hotkeys_tick_step)
hotkey("shift+x", hotkeys_cycle_trace_view)
hotkey("ctrl+y", hotkeys_tb)
hotkey("ctrl+alt", hotkeys_trace_delete)
hotkey("ctrl+h", hotkeys_trace_delete)

432
BauSystem/sw.def.lua Normal file
View File

@ -0,0 +1,432 @@
-- This file is a part of the SteamWar software.
--
-- Copyright (C) 2021 SteamWar.de-Serverteam
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Affero General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Affero General Public License for more details.
--
-- You should have received a copy of the GNU Affero General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
---
--- This file contains the definitions for the SteamWar.de script API.
--- It is used by the IDE to provide code completion and type checking.
--- Created by Chaoscaot
---
inventory = {}
---@param title string
---@param size number
---@return Inventory
function inventory.create(title, size) return nil end
---@alias InventoryClick 'LEFT' | 'SHIFT_LEFT' | 'RIGHT' | 'SHIFT_RIGHT' | 'MIDDLE' | 'NUMBER_KEY'
---@class Inventory
local Inventory = {}
---@overload fun(slot: number, material: string, name: string, handler: fun(click: InventoryClick)): void
---@overload fun(slot: number, material: string, name: string, handler: fun(click: InventoryClick), lore: string[]): void
---@overload fun(slot: number, material: string, name: string, handler: fun(click: InventoryClick), lore: string[], enchanted: boolean): void
---@param slot number
---@param material string
---@param name string
---@param handler fun(click: InventoryClick): void
---@param lore string[]
---@param enchanted boolean
---@param amount number
---@return void
function Inventory.item(slot, material, name, handler, lore, enchanted, amount) end
---@param handler fun(): void
---@return void
function Inventory.setCloseHandler(handler) end
---@return void
function Inventory.open() end
player = {}
---@return string
---Get the name of the player.
function player.name() return "" end
---@return void
function player.chat(...) end
---@return void
---Send a message to the actionbar of the player.
function player.actionbar(...) end
---@overload fun(): number
---@param newX number
function player.x(newX) end
---@overload fun(): number
---@param newY number
function player.y(newY) end
---@overload fun(): number
---@param newZ number
function player.z(newZ) end
---@overload fun(): number
---@param newYaw number
function player.yaw(newYaw) end
---@overload fun(): number
---@param newPitch number
function player.pitch(newPitch) end
---@return boolean
function player.sneaking() return nil end
---@return boolean
function player.sprinting() return nil end
---@overload fun(): number
---@param newSlot number
function player.slot(newSlot) end
---@return string
function player.item() return nil end
---@return string
function player.offHandItem() return nil end
---@return void
function player.closeInventory() end
---@field nextBool fun(): boolean
random = {}
---@overload fun(): number
---@overload fun(bound: number): number
---@param origin number
---@param bound number
---@return number
function random.nextInt(origin, bound) return nil end
---@overload fun(): number
---@overload fun(bound: number): number
---@param origin number
---@param bound number
---@return number
function random.nextDouble(origin, bound) return nil end
---@return boolean
function random.nextBool() return nil end
---@alias RegionType 'wg' | 'mwg' | 'as' | 'ws' | 'ws_inner' | 'ws_rumpf' | 'ws_rahmen' | 'spawn'
---@class iregion
---@field tnt tnt
---@field trace trace
local iregion = {}
---@class region: iregion
region = {}
---@return string
function iregion.name() return nil end
---@return RegionType
function iregion.type() return nil end
---@return boolean
function iregion.fire() return nil end
---@return boolean
function iregion.freeze() return nil end
---@return boolean
function iregion.protect() return nil end
---@return string
function iregion.loader() return nil end
---@return Position
function iregion.copyPoint() return nil end
---@return Position
function iregion.minPointBuild() return nil end
---@return Position
function iregion.maxPointBuild() return nil end
---@return Position
function iregion.minPointBuildExtension() return nil end
---@return Position
function iregion.maxPointBuildExtension() return nil end
---@return Position
function iregion.testblockPoint() return nil end
---@return Position
function iregion.minPointTestblock() return nil end
---@return Position
function iregion.maxPointTestblock() return nil end
---@return Position
function iregion.minPointTestblockExtension() return nil end
---@return Position
function iregion.maxPointTestblockExtension() return nil end
---@alias TNTMode 'ALLOW' | 'DENY' | 'ONLY_TB'
---@class tnt
local tnt = {}
---@return TNTMode
function tnt.mode() return nil end
---@return boolean
function tnt.enabled() return nil end
---@return boolean
function tnt.onlyTb() return nil end
---@return boolean
function tnt.onlyBuild() return nil end
---@param name string
---@return iregion
function region.get(name) return nil end
---@return iregion[]
function region.list() return nil end
---@class tracerLib
tracer = {}
---@class TraceRecord
---@field pos Position
---@field vel Position
---@field ticksSinceStart number
---@field fuse number
---@field isExplosion boolean
---@field isInWater boolean
---@field hasDestroyedBuild boolean
---@field hasDestroyedTestblock boolean
---@class Tracer
---@field getId fun(): string
---@field getRecords fun(): {[number]: {[number]: TraceRecord}}
function tracer.getTraces() return nil end
---@class Position
---@field x number
---@field y number
---@field z number
---@class server
---@field tps tps
server = {}
---@return string
function server.time() return nil end
---@return number
function server.ticks() return nil end
---@param position Position
---@return string
function getBlockAt(position) return nil end
---@param position Position
---@param material string
---@return void
function setBlockAt(position, material) return nil end
---@class tps
local tps = {}
---@return number
function tps.oneSecond() return nil end
---@return number
function tps.tenSecond() return nil end
---@return number
function tps.oneMinute() return nil end
---@return number
function tps.fiveMinute() return nil end
---@return number
function tps.tenMinute() return nil end
---@return number
function tps.current() return nil end
---@return number
function tps.limit() return nil end
---@class storage
---@field global storageLib
---@field player storageLib
---@field region storageLib
storage = {}
---@class storageLib
---Any Primitive, Array or Table will be saved across restarts, everything else will be discarded
local storageLib = {}
---@param key string
---@return any
function storageLib.get(key) return nil end
---@param key string
---@param value any
---@return void
function storageLib.set(key, value) end
---@param key string
---@return boolean
function storageLib.has(key) return nil end
---@param key string
---@return void
function storageLib.remove(key) end
---@param key string
---@return Accessor
function storageLib.accessor(key) return nil end
---@class Accessor
---@overload fun(): any
---@overload fun(value: any)
---@class Selection
---@field max Position
---@field min Position
---@class _worldedit
_worldedit = {}
---@overload fun(pos: Position[]): void
---@return Selection
function _worldedit.selection() return nil end
---@param msg string
---@param callback fun(value: string): void
---@return void
function input(msg, callback) end
---@param ticks number
---@param callback fun(): void
---@return void
function delayed(ticks, callback) end
---@param x number
---@param y number
---@param z number
---@return Position
function pos(x, y, z) return nil end
---@return void
function exec(...) end
---@param obj any
---@return number
function length(obj) return 0 end
---@param separator string
---@param table any[]
---@return string
function join(separator, table) return "" end
---@class EventType
---@class events
---@field DoubleSwap EventType
---@field PlaceBlock EventType
---@field BreakBlock EventType
---@field RightClick EventType
---@field LeftClick EventType
---@field TNTSpawn EventType
---@field TNTExplode EventType
---@field TNTExplodeInBuild EventType
---@field SelfJoin EventType
---@field SelfLeave EventType
---@field DropItem EventType
---@field EntityDeath EventType
events = {}
---@param id EventType
---@param handler fun(params: any): void
---@return void
function event(id, handler) end
---@param command string
---@param handler fun(params: string[]): void
---@return void
function command(command, handler) end
---@param trigger string
---@param handler fun(pressed: boolean): void
---@return void
function hotkey(trigger, handler) end
---@class bossbar
bossbar = {}
---@alias BossBarColor 'PINK' | 'BLUE' | 'RED' | 'GREEN' | 'YELLOW' | 'PURPLE' | 'WHITE'
---@alias BossBarStyle 'SEGMENTED_6' | 'SEGMENTED_10' | 'SEGMENTED_12' | 'SEGMENTED_20' | 'SOLID'
---@alias BossBarFlag 'DARKEN_SKY' | 'PLAY_BOSS_MUSIC' | 'CREATE_FOG'
---@class BossBar
local BossBar = {}
---@param title string
---@param color BossBarColor
---@param style BossBarStyle
---@return BossBar
function bossbar.create(title, color, style) return nil end
---@return string
---@overload fun(title: string): void
function BossBar.title() end
---@return BossBarColor
---@overload fun(color: BossBarColor): void
function BossBar.color() end
---@return BossBarStyle
---@overload fun(style: BossBarStyle): void
function BossBar.style() end
---@return number
---@overload fun(progress: number): void
function BossBar.progress() end
---@return boolean
---@overload fun(visible: boolean): void
function BossBar.visible() end
---@return boolean
---@param flag BossBarFlag
function BossBar.hasFlag(flag) return nil end
---@return void
---@param flag BossBarFlag
function BossBar.addFlag(flag) end
---@return boolean
---@param flag BossBarFlag
function BossBar.removeFlag(flag) return nil end
---@return void
function BossBar.destroy() end

View File

@ -22,7 +22,4 @@ plugins {
}
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,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

@ -28,6 +28,7 @@ import lombok.Getter;
import java.sql.Timestamp;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@AllArgsConstructor
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 Statement insert = table.insertAll();
public static void create(int nodeId, String name, int owner, int validator, Timestamp startTime, Timestamp endTime, String reason){
insert.update(nodeId, owner, name, validator, startTime, endTime, reason);
}
private static final SelectStatement<CheckedSchematic> getUnseen = new SelectStatement<>(table, "SELECT * FROM CheckedSchematic WHERE Seen = 0 AND NodeOwner = ? ORDER BY StartTime DESC");
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){
create(node.getId(), node.getName(), node.getOwner(), validator, startTime, endTime, reason);
public static void create(SchematicNode node, int validator, Timestamp startTime, Timestamp endTime, String reason, boolean seen) {
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) {
@ -53,6 +53,10 @@ public class CheckedSchematic {
return nodeHistory.listSelect(node.getId());
}
public static List<CheckedSchematic> getUnseen(SteamwarUser owner) {
return getUnseen.listSelect(owner);
}
@Field(nullable = true)
private final Integer nodeId;
@Field
@ -71,6 +75,12 @@ public class CheckedSchematic {
@Getter
@Field
private final String declineReason;
@Getter
@Field
private boolean seen;
@Getter
@Field
private final String nodeType;
public int getNode() {
return nodeId;
@ -83,4 +93,9 @@ public class CheckedSchematic {
public int getSchemOwner() {
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 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> 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 setResult = table.update(Table.PRIMARY, "Ergebnis");
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 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);
@Getter
@ -54,6 +58,14 @@ public class EventFight implements Comparable<EventFight> {
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() {
fights.clear();
fights.addAll(allComing.listSelect());
@ -63,6 +75,19 @@ public class EventFight implements Comparable<EventFight> {
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) {
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;
@Getter
@Setter
@Field(nullable = true, def = "null")
private Integer groupId;
@Getter
@Setter
@Field
private Timestamp startTime;
@Getter
@ -98,11 +127,35 @@ public class EventFight implements Comparable<EventFight> {
@Field(nullable = true)
private Integer spectatePort;
@Getter
@Setter
@Field(def = "1")
private int bestOf;
@Getter
@Field(def = "0")
private int ergebnis;
@Field(nullable = true)
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) {
this.ergebnis = winner;
setResult.update(winner, fightID);
@ -114,6 +167,11 @@ public class EventFight implements Comparable<EventFight> {
setFight.update(fight, fightID);
}
public void setGroup(Integer group) {
setGroup.update(group, fightID);
this.groupId = group;
}
public boolean hasFinished() {
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

@ -30,7 +30,6 @@ import java.util.zip.GZIPInputStream;
@AllArgsConstructor
@Getter
public class NodeData {
static {
new SqlTypeMapper<>(PipedInputStream.class, "BLOB", (rs, identifier) -> { throw new SecurityException("PipedInputStream is write only datatype"); }, PreparedStatement::setBinaryStream);
new SqlTypeMapper<>(ByteArrayInputStream.class, "BLOB", (rs, identifier) -> { throw new SecurityException("ByteArrayInputStream is write only datatype"); }, PreparedStatement::setBinaryStream);

View File

@ -1,7 +1,7 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
* 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

View File

@ -31,10 +31,13 @@ public class SchematicNode {
static {
SchematicType.Normal.name(); // Ensure SchematicType is loaded.
new SqlTypeMapper<>(SchematicNode.class, null, (rs, identifier) -> { throw new SecurityException("SchematicNode cannot be used as type (recursive select)"); }, (st, index, value) -> st.setInt(index, value.nodeId));
new SqlTypeMapper<>(SchematicNode.class, null, (rs, identifier) -> {
throw new SecurityException("SchematicNode cannot be used as type (recursive select)");
}, (st, index, value) -> st.setInt(index, value.nodeId));
}
private static final Map<Integer, Map<String, List<String>>> TAB_CACHE = new HashMap<>();
public static void clear() {
TAB_CACHE.clear();
}
@ -42,24 +45,45 @@ public class SchematicNode {
private static final String nodeSelector = "SELECT NodeId, NodeOwner, NodeOwner AS EffectiveOwner, NodeName, ParentNode, LastUpdate, NodeItem, NodeType, NodeRank, ReplaceColor, AllowReplay FROM SchematicNode ";
private static final Table<SchematicNode> table = new Table<>(SchematicNode.class);
private static final Statement create = table.insertFields(true, "NodeOwner", "NodeName", "ParentNode", "NodeItem", "NodeType");
private static final Statement update = table.update(Table.PRIMARY, "NodeName", "ParentNode", "NodeItem", "NodeType", "NodeRank", "ReplaceColor", "AllowReplay");
private static final Statement create = table.insertFields(true, "NodeOwner", "NodeName", "ParentNode", "NodeItem",
"NodeType");
private static final Statement update = table.update(Table.PRIMARY, "NodeName", "ParentNode", "NodeItem",
"NodeType", "NodeRank", "ReplaceColor", "AllowReplay");
private static final Statement delete = table.delete(Table.PRIMARY);
private static final SelectStatement<SchematicNode> byId = new SelectStatement<>(table, nodeSelector + "WHERE NodeId = ?");
private static final SelectStatement<SchematicNode> byOwnerNameParent = new SelectStatement<>(table, nodeSelector + "WHERE NodeOwner = ? AND NodeName = ? AND ParentNode " + Statement.NULL_SAFE_EQUALS + "?");
private static final SelectStatement<SchematicNode> byParent = new SelectStatement<>(table, nodeSelector + "WHERE ParentNode" + Statement.NULL_SAFE_EQUALS + "? ORDER BY NodeName");
private static final SelectStatement<SchematicNode> dirsByParent = new SelectStatement<>(table, nodeSelector + "WHERE ParentNode" + Statement.NULL_SAFE_EQUALS + "? AND NodeType is NULL ORDER BY NodeName");
private static final SelectStatement<SchematicNode> byOwnerType = new SelectStatement<>(table, nodeSelector + "WHERE NodeOwner = ? AND NodeType = ? ORDER BY NodeName");
private static final SelectStatement<SchematicNode> byType = new SelectStatement<>(table, nodeSelector + "WHERE NodeType = ? ORDER BY NodeName");
private static final SelectStatement<SchematicNode> all = new SelectStatement<>(table, "SELECT * FROM EffectiveSchematicNode WHERE EffectiveOwner = ? ORDER BY NodeName");
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 " + 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");
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 " + 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 = ?");
private static final SelectStatement<SchematicNode> schematicAccessibleForUser = new SelectStatement<>(table, "SELECT COUNT(DISTINCT NodeId) FROM EffectiveSchematicNode WHERE EffectiveOwner = ? AND NodeId = ?");
private static final SelectStatement<SchematicNode> accessibleByUserTypeInParent = new SelectStatement<>(table, "WITH RECURSIVE RSASN AS(WITH RECURSIVE RSAN AS (WITH RSANH AS (WITH RECURSIVE RSA AS (SELECT SN.NodeId, NM.ParentId FROM SchematicNode SN LEFT JOIN NodeMember NM on SN.NodeId = NM.NodeId WHERE NM.UserId = ? UNION SELECT SN.NodeId, SN.ParentNode FROM SchematicNode SN INNER JOIN RSA ON RSA.NodeId = SN.ParentNode) SELECT * FROM RSA UNION SELECT NodeId, ParentNode FROM SchematicNode WHERE NodeOwner = ?) SELECT * FROM RSANH UNION SELECT SN.NodeId, SN.ParentNode FROM RSANH JOIN SchematicNode SN ON SN.ParentNode = RSANH.NodeId) SELECT RSAN.NodeId, RSAN.ParentId FROM RSAN JOIN SchematicNode SN ON SN.NodeId = RSAN.NodeId WHERE NodeType = ? UNION SELECT SN.NodeId, SN.ParentNode FROM SchematicNode SN JOIN RSASN ON SN.NodeId = RSASN.ParentId) SELECT SN.*, ? as EffectiveOwner, RSASN.ParentId AS ParentNode FROM RSASN JOIN SchematicNode SN ON SN.NodeId = RSASN.NodeId WHERE RSASN.ParentId" + Statement.NULL_SAFE_EQUALS + "? ORDER BY NodeName");
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 = ?");
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 = ?");
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");
private static final SelectStatement<SchematicNode> byId = new SelectStatement<>(table,
nodeSelector + "WHERE NodeId = ?");
private static final SelectStatement<SchematicNode> byOwnerNameParent = new SelectStatement<>(table,
nodeSelector + "WHERE NodeOwner = ? AND NodeName = ? AND ParentNode " + Statement.NULL_SAFE_EQUALS + "?");
private static final SelectStatement<SchematicNode> byParent = new SelectStatement<>(table,
nodeSelector + "WHERE ParentNode" + Statement.NULL_SAFE_EQUALS + "? ORDER BY NodeName");
private static final SelectStatement<SchematicNode> dirsByParent = new SelectStatement<>(table, nodeSelector
+ "WHERE ParentNode" + Statement.NULL_SAFE_EQUALS + "? AND NodeType is NULL ORDER BY NodeName");
private static final SelectStatement<SchematicNode> byOwnerType = new SelectStatement<>(table,
nodeSelector + "WHERE NodeOwner = ? AND NodeType = ? ORDER BY NodeName");
private static final SelectStatement<SchematicNode> byType = new SelectStatement<>(table,
nodeSelector + "WHERE NodeType = ? ORDER BY NodeName");
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");
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 "
+ 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");
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 "
+ 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 = ?");
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 = ?");
private static final SelectStatement<SchematicNode> accessibleByUserTypeInParent = new SelectStatement<>(table,
"WITH RECURSIVE RSASN AS(WITH RECURSIVE RSAN AS (WITH RSANH AS (WITH RECURSIVE RSA AS (SELECT SN.NodeId, NM.ParentId FROM SchematicNode SN LEFT JOIN NodeMember NM on SN.NodeId = NM.NodeId WHERE NM.UserId = ? UNION SELECT SN.NodeId, SN.ParentNode FROM SchematicNode SN INNER JOIN RSA ON RSA.NodeId = SN.ParentNode) SELECT * FROM RSA UNION SELECT NodeId, ParentNode FROM SchematicNode WHERE NodeOwner = ?) SELECT * FROM RSANH UNION SELECT SN.NodeId, SN.ParentNode FROM RSANH JOIN SchematicNode SN ON SN.ParentNode = RSANH.NodeId) SELECT RSAN.NodeId, RSAN.ParentId FROM RSAN JOIN SchematicNode SN ON SN.NodeId = RSAN.NodeId WHERE NodeType = ? UNION SELECT SN.NodeId, SN.ParentNode FROM SchematicNode SN JOIN RSASN ON SN.NodeId = RSASN.ParentId) SELECT SN.*, ? as EffectiveOwner, RSASN.ParentId AS ParentNode FROM RSASN JOIN SchematicNode SN ON SN.NodeId = RSASN.NodeId WHERE RSASN.ParentId"
+ Statement.NULL_SAFE_EQUALS + "? ORDER BY NodeName");
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 = ?");
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 = ?");
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");
static {
NodeMember.init();
@ -102,8 +126,7 @@ public class SchematicNode {
SchematicType nodeType,
int nodeRank,
boolean replaceColor,
boolean allowReplay
) {
boolean allowReplay) {
this.nodeId = nodeId;
this.nodeOwner = nodeOwner;
this.effectiveOwner = effectiveOwner;
@ -118,7 +141,7 @@ public class SchematicNode {
}
public static List<SchematicNode> getAll(SteamwarUser user) {
return all.listSelect(user);
return all.listSelect(user, user, user);
}
public static Map<Integer, List<SchematicNode>> getAllMap(SteamwarUser user) {
@ -130,7 +153,8 @@ public class SchematicNode {
}
public static SchematicNode byParentName(SteamwarUser user, Integer schematicId, String name) {
return byParentName.select(user, schematicId, user, name, user, schematicId, user, schematicId, schematicId, name);
return byParentName.select(user, schematicId, user, name, user, schematicId, user, schematicId, schematicId,
name);
}
public static List<SchematicNode> accessibleByUserType(SteamwarUser user, SchematicType type) {
@ -142,10 +166,11 @@ public class SchematicNode {
}
public static boolean schematicAccessibleForUser(SteamwarUser user, Integer schematicId) {
return schematicAccessibleForUser.select(user, schematicId) != null;
return schematicAccessibleForUser.select(user, user, user, schematicId) != null;
}
public static List<SchematicNode> accessibleByUserTypeParent(SteamwarUser user, SchematicType type, Integer parentId) {
public static List<SchematicNode> accessibleByUserTypeParent(SteamwarUser user, SchematicType type,
Integer parentId) {
return accessibleByUserTypeInParent.listSelect(user, user, type, user, parentId);
}
@ -160,7 +185,8 @@ public class SchematicNode {
private static Map<Integer, List<SchematicNode>> map(List<SchematicNode> in) {
Map<Integer, List<SchematicNode>> map = new HashMap<>();
for (SchematicNode effectiveSchematicNode : in) {
map.computeIfAbsent(effectiveSchematicNode.getOptionalParent().orElse(0), k -> new ArrayList<>()).add(effectiveSchematicNode);
map.computeIfAbsent(effectiveSchematicNode.getOptionalParent().orElse(0), k -> new ArrayList<>())
.add(effectiveSchematicNode);
}
return map;
}
@ -218,7 +244,8 @@ public class SchematicNode {
return byId.select(id);
}
public static List<SchematicNode> getAccessibleSchematicsOfTypeInParent(int owner, String schemType, Integer parent) {
public static List<SchematicNode> getAccessibleSchematicsOfTypeInParent(int owner, String schemType,
Integer parent) {
return accessibleByUserTypeParent(SteamwarUser.get(owner), SchematicType.fromDB(schemType), parent);
}
@ -283,10 +310,12 @@ public class SchematicNode {
}
if (s.contains("/")) {
String[] layers = s.split("/");
Optional<SchematicNode> currentNode = Optional.ofNullable(SchematicNode.byParentName(user, null, layers[0]));
Optional<SchematicNode> currentNode = Optional
.ofNullable(SchematicNode.byParentName(user, null, layers[0]));
for (int i = 1; i < layers.length; i++) {
int finalI = i;
Optional<SchematicNode> node = currentNode.map(effectiveSchematicNode -> SchematicNode.byParentName(user, effectiveSchematicNode.getId(), layers[finalI]));
Optional<SchematicNode> node = currentNode.map(effectiveSchematicNode -> SchematicNode
.byParentName(user, effectiveSchematicNode.getId(), layers[finalI]));
if (!node.isPresent()) {
return null;
} else {
@ -434,7 +463,8 @@ public class SchematicNode {
}
public SchematicNode getParentNode() {
if(parentNode == null) return null;
if (parentNode == null)
return null;
return SchematicNode.getSchematicNode(parentNode);
}
@ -499,7 +529,11 @@ public class SchematicNode {
builder.append(split);
}
while (currentNode.isPresent()) {
currentNode = currentNode.flatMap(schematicNode -> Optional.ofNullable(NodeMember.getNodeMember(schematicNode.getId(), effectiveOwner)).map(NodeMember::getParent).orElse(schematicNode.getOptionalParent())).map(SchematicNode::getSchematicNode);
currentNode = currentNode
.flatMap(schematicNode -> Optional
.ofNullable(NodeMember.getNodeMember(schematicNode.getId(), effectiveOwner))
.map(NodeMember::getParent).orElse(schematicNode.getOptionalParent()))
.map(SchematicNode::getSchematicNode);
currentNode.ifPresent(node -> builder.insert(0, split).insert(0, node.getName()));
}
return builder.toString();
@ -512,13 +546,18 @@ public class SchematicNode {
map.add(new AbstractMap.SimpleEntry<>(getName(), getId()));
}
while (currentNode.isPresent()) {
currentNode = currentNode.flatMap(schematicNode -> Optional.ofNullable(NodeMember.getNodeMember(schematicNode.getId(), effectiveOwner)).map(NodeMember::getParent).orElse(schematicNode.getOptionalParent())).map(SchematicNode::getSchematicNode);
currentNode = currentNode
.flatMap(schematicNode -> Optional
.ofNullable(NodeMember.getNodeMember(schematicNode.getId(), effectiveOwner))
.map(NodeMember::getParent).orElse(schematicNode.getOptionalParent()))
.map(SchematicNode::getSchematicNode);
currentNode.ifPresent(node -> map.add(0, new AbstractMap.SimpleEntry<>(node.getName(), node.getId())));
}
return map;
}
private static final List<String> FORBIDDEN_NAMES = Collections.unmodifiableList(Arrays.asList("public"));
public static boolean invalidSchemName(String[] layers) {
for (String layer : layers) {
if (layer.isEmpty()) {
@ -556,7 +595,8 @@ public class SchematicNode {
if (s.contains("/")) {
String preTab = s.substring(0, s.lastIndexOf("/") + 1);
SchematicNode pa = SchematicNode.getNodeFromPath(user, preTab);
if (pa == null) return new ArrayList<>();
if (pa == null)
return new ArrayList<>();
List<SchematicNode> nodes = SchematicNode.list(user, pa.getId());
String br = pa.generateBreadcrumbs();
nodes.forEach(node -> list.add((sws ? "/" : "") + br + node.getName() + (node.isDir() ? "/" : "")));

View File

@ -335,7 +335,7 @@ public class SteamwarUser {
public boolean verifyPassword(String password) {
try {
if (this.password == null) {
if (!hasPassword()) {
return false;
}

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

@ -75,15 +75,7 @@ public class UserElo {
public static void setElo(int userId, String gameMode, int elo) {
emblemCache.remove(userId);
int oldPlacement = getPlacement(getElo(userId, gameMode).orElse(0), gameMode);
int newPlacement = getPlacement(elo, gameMode);
gameModeUserEloCache.getOrDefault(gameMode, Collections.emptyMap()).remove(userId);
if (oldPlacement <= 3 || newPlacement <= 3) {
emblemCache.clear();
}
setElo.update(Season.getSeason(), gameMode, userId, elo);
}
@ -112,27 +104,17 @@ public class UserElo {
public static String getEmblemProgression(String gameMode, int userId) {
switch (getProgression(userId, gameMode)) {
case -1:
return "§f/ §8 ∧ ❂ III II I";
return "§8❱❱❱❱ ❂";
case 0:
return "§8/ §6 §8∧ ∧ ❂ III II I";
return "§e❱§8❱❱❱ ❂";
case 1:
return "§8/ §6∧ §8 ∧ ❂ III II I";
return "§e❱❱§8❱❱ ❂";
case 2:
return "§8/ ∧ §7 §8∧ ∧ ❂ III II I";
return "§e❱❱❱§8❱ ❂";
case 3:
return "§8/ §7∧ §8 ∧ ❂ III II I";
return "§e❱❱❱❱§8 ❂";
case 4:
return "§8/ ∧ §e §8∧ ❂ III II I";
case 5:
return "§8/ §e∧ §8❂ III II I";
case 6:
return "§8/ ∧ §5❂ §8III II I";
case 7:
return "§8/ ∧ ❂ §5III §8II I";
case 8:
return "§8/ ∧ ❂ III §5II §8I";
case 9:
return "§8/ ∧ ❂ III II §5I";
return "§8❱❱❱❱ §5❂";
default:
throw new SecurityException("Progression is not in range");
}
@ -142,19 +124,11 @@ public class UserElo {
int elo = getElo(userId, gameMode).orElse(-1);
if (elo < 0) return -1;
if (elo <= 100) return 0;
if (elo <= 200) return 1;
if (elo <= 400) return 2;
if (elo <= 600) return 3;
if (elo <= 900) return 4;
if (elo <= 1200) return 5;
int placement = getPlacement(elo, gameMode);
if (placement == 1) return 9;
if (placement == 2) return 8;
if (placement == 3) return 7;
return 6;
if (elo < 150) return 0;
if (elo < 350) return 1;
if (elo < 600) return 2;
if (elo < 900) return 3;
return 4;
}
public static String toEmblem(int progression) {
@ -162,25 +136,15 @@ public class UserElo {
case -1:
return "";
case 0:
return "§6 ";
return "§e❱ ";
case 1:
return "§6∧ ";
return "§e❱❱ ";
case 2:
return "§7 ";
return "§e❱❱❱ ";
case 3:
return "§7∧ ";
return "§e❱❱❱❱ ";
case 4:
return "§e ";
case 5:
return "§e∧ ";
case 6:
return "§5❂ ";
case 7:
return "§5III ";
case 8:
return "§5II ";
case 9:
return "§5I ";
default:
throw new SecurityException("Progression out of range");
}

View File

@ -48,18 +48,19 @@ public enum UserPerm {
public static final Map<UserPerm, Prefix> prefixes;
public static final Prefix emptyPrefix;
static {
// https://www.digminecraft.com/lists/color_list_pc.php
SqlTypeMapper.nameEnumMapper(UserPerm.class);
Map<UserPerm, Prefix> p = new EnumMap<>(UserPerm.class);
emptyPrefix = new Prefix("§7", "");
p.put(PREFIX_NONE, emptyPrefix);
p.put(PREFIX_YOUTUBER, new Prefix("§7", "YT"));
p.put(PREFIX_GUIDE, new Prefix("§a", "Guide"));
p.put(PREFIX_GUIDE, new Prefix("§a", "Guide")); // 55FF55
p.put(PREFIX_SUPPORTER, new Prefix("§6", "Sup"));
p.put(PREFIX_MODERATOR, new Prefix("§6", "Mod"));
p.put(PREFIX_BUILDER, new Prefix("§e", "Arch"));
p.put(PREFIX_DEVELOPER, new Prefix("§e", "Dev"));
p.put(PREFIX_ADMIN, new Prefix("§e", "Admin"));
p.put(PREFIX_SUPPORTER, new Prefix("§x§3§4§0§0§f§f", "Sup")); // 3400ff
p.put(PREFIX_MODERATOR, new Prefix("§x§c§7§5§e§2§2", "Mod")); // C75E22
p.put(PREFIX_BUILDER, new Prefix("§2", "Arch")); // 00AA00
p.put(PREFIX_DEVELOPER, new Prefix("§3", "Dev")); // 00AAAA
p.put(PREFIX_ADMIN, new Prefix("§x§F§2§2§8§2§4", "Admin")); // F22824
prefixes = Collections.unmodifiableMap(p);
}

View File

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

View File

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

View File

@ -20,10 +20,7 @@
package de.steamwar.fightsystem.utils;
import com.sk89q.jnbt.NBTInputStream;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;

View File

@ -29,4 +29,5 @@ dependencies {
compileOnly(libs.worldedit15)
compileOnly(libs.fastutil)
compileOnly(libs.authlib)
compileOnly(libs.netty)
}

View File

@ -59,6 +59,7 @@ public class Config {
public static final Region RedExtendRegion;
public static final Region ArenaRegion;
public static final Region PlayerRegion;
public static final Region BlueInsetRegion;
public static final Location TeamBlueSpawn;
public static final Location TeamRedSpawn;
@ -193,6 +194,11 @@ public class Config {
ReplaceWithBlockupdates = config.getBoolean("Schematic.ReplaceWithBlockupdates", 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");
TeamChatDetection = config.getString("TeamChatPrefix", "+");
@ -318,6 +324,8 @@ public class Config {
ArenaRegion = Region.withExtension(arenaMinX, blueCornerY, arenaMinZ, arenaMaxX - arenaMinX, schemsizeY, arenaMaxZ - arenaMinZ, 0, PreperationArea, 0);
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"));
if(eventKampfID >= 1){
EventKampf = EventFight.get(eventKampfID);
@ -359,7 +367,7 @@ public class Config {
}else{
//No event
TeamRedColor = config.getString("Red.Prefix", "§c");
TeamBlueColor = config.getString("Blue.Prefix", "§3");
TeamBlueColor = config.getString("Blue.Prefix", "§9");
TeamRedName = config.getString("Red.Name", "Rot");
TeamBlueName = config.getString("Blue.Name", "Blau");
OnlyPublicSchematics = config.getBoolean("Schematic.OnlyPublicSchematics", false);

View File

@ -20,19 +20,17 @@
package de.steamwar.fightsystem;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.core.WorldEditRendererCUIEditor;
import de.steamwar.core.Core;
import de.steamwar.fightsystem.commands.*;
import de.steamwar.fightsystem.countdown.*;
import de.steamwar.fightsystem.event.HellsBells;
import de.steamwar.fightsystem.event.Meteor;
import de.steamwar.fightsystem.event.PersistentDamage;
import de.steamwar.fightsystem.event.TNTDistributor;
import de.steamwar.fightsystem.event.*;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.fight.FightWorld;
import de.steamwar.fightsystem.fight.HotbarKit;
import de.steamwar.fightsystem.listener.Shutdown;
import de.steamwar.fightsystem.listener.*;
import de.steamwar.fightsystem.listener.Shutdown;
import de.steamwar.fightsystem.record.FileRecorder;
import de.steamwar.fightsystem.record.FileSource;
import de.steamwar.fightsystem.record.GlobalRecorder;
@ -97,6 +95,7 @@ public class FightSystem extends JavaPlugin {
new PrepareSchem();
new TestJoin();
new NormalJoin();
new Spectator();
new RunningWorldInteraction();
new PersonalKitCreator();
new ArrowStopper();
@ -108,6 +107,7 @@ public class FightSystem extends JavaPlugin {
new HotbarKit.HotbarKitListener();
new JoinRequestListener();
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();
techHider = new TechHiderWrapper();
@ -135,6 +135,7 @@ public class FightSystem extends JavaPlugin {
new PersistentDamage();
new TNTDistributor();
new WinconditionAmongUs();
new NoGravity();
new NoPlayersOnlineCountdown();
new PreSchemCountdown();
@ -156,6 +157,7 @@ public class FightSystem extends JavaPlugin {
new LockschemCommand();
new StateCommand();
new SkipCommand();
new TechhiderbugCommand();
new TPSWarpCommand();
new UnrankCommand();
new WinCommand();
@ -177,6 +179,8 @@ public class FightSystem extends JavaPlugin {
Fight.getRedTeam().setSchem(unpreparedSchematicNode);
}
}
new TechareaCommand();
}else if(Config.mode == ArenaMode.PREPARE) {
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_TITLE={0} selection
SCHEM_DIRT=§eDirt Block
SCHEM_PUBLIC=§ePublic {0}
SCHEM_UNCHECKED=§eUnchecked {0}
SCHEM_PRIVATE=§ePrivate {0}

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