Compare commits

..
Author SHA1 Message Date
Chaoscaot 0b689c90eb Add new Schematic reader 2025-01-08 12:49:17 +01:00
Chaoscaot da4aa0aef5 Add new Schematic reader 2025-01-07 16:59:36 +01:00
Lixfel 46fed25da4 Fix renaming for class name duplications 2025-01-07 16:38:40 +01:00
Lixfel d3fbbb9768 Merge pull request 'Mojang map reflections' (#89) from MojMapReflections into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/89
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2025-01-07 16:27:02 +01:00
Chaoscaot ed16de900e Merge pull request 'Fix /schem changetype schem type normal' (#99) from SchematicSystem/changetypenormal into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/99
Reviewed-by: Chaoscaot <chaos@chaoscaot.de>
2025-01-06 20:12:19 +01:00
Lixfel 66f4efb27f Fix /schem changetype schem type normal 2025-01-06 19:24:15 +01:00
Lixfel 9888700273 Migrate reflections to mojang mapped by default 2025-01-06 16:44:10 +01:00
Lixfel 94a1ed3569 More robust version detection. 2025-01-06 10:25:19 +01:00
Lixfel da148c0e9f Replace {nms} and {obc} tags 2025-01-06 10:15:48 +01:00
Lixfel ab34d86da4 Merge branch 'main' into MojMapReflections
# Conflicts:
#	SpigotCore/SpigotCore_8/src/de/steamwar/core/BountifulWrapper8.java
#	SpigotCore/SpigotCore_9/src/de/steamwar/core/BountifulWrapper9.java
#	SpigotCore/SpigotCore_Main/src/de/steamwar/core/events/PartialChunkFixer.java
2025-01-06 10:06:28 +01:00
Lixfel a3490b801e Fix server transfer failure after checkpoint restoration 2025-01-03 12:55:59 +01:00
Lixfel 856c79661b Merge pull request 'Move ViaVersion to Proxy' (#87) from ViaOnProxy into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/87
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2025-01-03 07:33:45 +01:00
Lixfel 9f0f11adeb Fix entity orientation 2025-01-02 17:24:37 +01:00
Lixfel 6b7825ead9 Fix version matching 2025-01-02 11:05:07 +01:00
Chaoscaot 025ec2a850 Hotfix: 1.20 Schematic Reader 2025-01-01 14:12:38 +01:00
Lixfel d7d6c2df7b Merge pull request 'VelocityCore/PrivateTicketLog' (#61) from VelocityCore/PrivateTicketLog into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/61
Reviewed-by: Lixfel <lixfel@steamwar.de>
2025-01-01 13:00:44 +01:00
Lixfel 55c3579e5c Merge pull request 'Add custom NPC Chats for specific players' (#93) from LobbySystem/NPCChats into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/93
Reviewed-by: Lixfel <lixfel@steamwar.de>
2025-01-01 12:58:12 +01:00
Lixfel d64e32eaa5 Cleanup code 2025-01-01 12:56:49 +01:00
Lixfel abb8ab2204 Merge pull request 'Fix Schematics Readers' (#72) from Schematics/1.21 into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/72
Reviewed-by: Lixfel <lixfel@steamwar.de>
2025-01-01 12:42:01 +01:00
YoyoNow c1dbce4648 Fix EventListener.onPlayerQuit 2024-12-31 18:56:42 +01:00
Chaoscaot 7dc5686389 Fixes... 2024-12-31 11:25:00 +01:00
TheBreadBeard f52cec0448 Add custom NPC Chats for TheBreadBeard 2024-12-28 22:58:35 +01:00
Chaoscaot add43b2f54 Merge pull request 'Remove anti pickaxe drop code' (#94) from TNTLeague/RemovePickaxeDropCode into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/94
Reviewed-by: Chaoscaot <chaos@chaoscaot.de>
2024-12-28 22:28:20 +01:00
YoyoNow ca0f82897e Remove anti pickaxe drop code 2024-12-28 18:26:04 +01:00
TheBreadBeard f111d55200 Add custom NPC Chats for specific players 2024-12-28 17:36:40 +01:00
YoyoNow 7eba9231d5 Fix build issues 2024-12-28 17:15:57 +01:00
YoyoNow e9ac198fcb Remove deop on TNTLeague join (mit Lixfel abgesprochen) 2024-12-26 22:42:07 +01:00
YoyoNow 3a47e348d0 Merge pull request 'Add LastOnline to WhoisCommand' (#90) from VelocityCore/LastOnlineTime into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/90
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-12-26 22:23:01 +01:00
YoyoNow a16e1e8cee Add LastOnline to WhoisCommand 2024-12-26 21:44:40 +01:00
Lixfel 0f73939bf0 Move and rename Reflection fields 2024-12-26 19:11:01 +01:00
Lixfel 30ac38ef53 Merge pull request 'Remove /leader command, allow for Leader promotion' (#86) from FightSystem/Leader into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/86
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-12-26 10:53:07 +01:00
Lixfel 22a8ca4aea Move ViaVersion to Proxy 2024-12-24 14:55:27 +01:00
Lixfel bd87221198 Add subcommand to reload gamemodes without full softreload 2024-12-23 13:12:57 +01:00
Lixfel fb0a653b0e Remove /leader command, allow for Leader promotion 2024-12-23 13:05:00 +01:00
Chaoscaot 9154077104 Fix TNT League Stage Names 2024-12-23 12:50:38 +01:00
Chaoscaot 4448eab877 Hotfix: Rework Pickaxe 2024-12-22 22:54:46 +01:00
Chaoscaot 180fb685bd Hotfix: SubMessage 2024-12-22 22:49:06 +01:00
Chaoscaot df1ec88f6c Hotfix: SubMessage 2024-12-22 22:46:00 +01:00
Chaoscaot 655b6cd15f Merge pull request 'Add Some Fixes and Improvements' (#83) from TNTLeague/fixes-and-improvements into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/83
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-12-22 22:38:03 +01:00
Chaoscaot 867091d210 Merge remote-tracking branch 'origin/TNTLeague/fixes-and-improvements' into TNTLeague/fixes-and-improvements 2024-12-22 22:27:45 +01:00
Chaoscaot 2f34369756 Fix SubMessage class 2024-12-22 22:27:30 +01:00
YoyoNow 89fe401b03 Cleanup DealerInventory and TNTLeagueConfig 2024-12-22 22:22:42 +01:00
Chaoscaot aaa808f90f Add Some Fixes and Improvements 2024-12-22 21:57:54 +01:00
Lixfel 1ea6bd61f8 Fix concurrent cipher usage 2024-12-22 16:17:58 +01:00
Lixfel 026b7bcc0e Fix SpectatePort 2024-12-22 16:02:52 +01:00
Lixfel 4da2307d50 Merge pull request 'TechHider refactoring, simple Blocktagging' (#82) from blocktagger into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/82
Reviewed-by: Chaoscaot <chaos@chaoscaot.de>
2024-12-22 07:18:41 +01:00
Lixfel 7d9996529e Add orientation pattern 2024-12-21 21:19:40 +01:00
YoyoNow a2710628a5 Update TechHiderWrapper and add orientation pattern 2024-12-21 19:47:40 +01:00
Chaoscaot ec5382316a Fixes 2024-12-21 19:33:23 +01:00
Chaoscaot 51fd5faa4d Merge branch 'main' into Schematics/1.21
# Conflicts:
#	VelocityCore/build.gradle.kts
2024-12-21 19:29:46 +01:00
Lixfel acbc5c5fd3 Cryptographically secure signature 2024-12-21 18:46:33 +01:00
Lixfel 793fc31b5c TechHider refactoring, simple Blocktagging 2024-12-21 16:53:49 +01:00
Chaoscaot 1b47700c19 Fix Event 2024-12-21 16:16:54 +01:00
Chaoscaot 06b0af5a16 Hotfix API EventFight Create 2024-12-21 15:42:27 +01:00
Chaoscaot d08ccc3a98 Fix Everything 2024-12-21 12:30:39 +01:00
Chaoscaot 336915dd96 Fix Schem Upload 2024-12-21 12:03:43 +01:00
Lixfel 8fac9cd37e Merge pull request 'Partial diagonal HullHider uncovering, performance improvement' (#79) from FIghtSystem/partialSides into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/79
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-12-21 11:21:45 +01:00
Lixfel 3b2ee668b2 Merge pull request 'Additional Pluginmessage classifications, Lunar refactoring' (#80) from VelocityCore/PluginMessages into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/80
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-12-21 11:21:21 +01:00
Lixfel c479d21cd2 Additional Pluginmessage classifications, Lunar refactoring 2024-12-21 11:09:16 +01:00
Lixfel 10e016c850 Partial diagonal HullHider uncovering, performance improvement 2024-12-21 10:52:41 +01:00
Chaoscaot 0e43c2a615 Hotfix: SW Survival 2024-12-17 20:02:12 +01:00
Chaoscaot 9eab15bfd5 Hotfix: Groups 2024-12-15 17:18:40 +01:00
Chaoscaot 2436340765 Fixes and Balances 2024-12-13 19:13:14 +01:00
Chaoscaot 7d9b3cd098 Merge remote-tracking branch 'origin/main' 2024-12-13 13:08:34 +01:00
Chaoscaot 85c6dcdc1e Add TNTLeague Auto-Stop 2024-12-13 13:08:28 +01:00
Lixfel 997a800c85 Fix Hullhider 1.15-, improve performance. 2024-12-13 11:26:19 +01:00
Lixfel a5ffddad66 Add AdminReplay line of sight tools. 2024-12-13 10:42:44 +01:00
Chaoscaot 61e8ba14ca Fixes 2024-12-13 10:22:01 +01:00
Chaoscaot 56c66b33b7 Fix Locations 2024-12-13 09:43:18 +01:00
Chaoscaot b90884ee1d Fix Locations 2024-12-13 09:31:15 +01:00
Chaoscaot e1d3e47845 Fixes and De-Spagetti Code 2024-12-12 16:09:25 +01:00
Chaoscaot b12846d011 Merge remote-tracking branch 'origin/main' 2024-12-11 15:05:02 +01:00
Chaoscaot 7488a4d063 Remove Stats 2024-12-11 15:04:54 +01:00
Lixfel 429e2f86aa Fix Hullhider. 2024-12-11 15:03:32 +01:00
Lixfel c308a06e6b Test if broadcasting apollo:json acceptance triggers ModList sending. 2024-12-11 14:48:32 +01:00
Chaoscaot 68c7cfed73 Hotfix: Allow ReplayMod on Devservers 2024-12-11 14:34:31 +01:00
Chaoscaot c3c4b94e3b Fix TNTLeague Sound 2024-12-11 14:20:38 +01:00
Chaoscaot f61c27804a Fix TNTLeague Sound 2024-12-11 14:11:39 +01:00
Chaoscaot b36c974f86 Fix TNTLeague Sound 2024-12-11 14:08:33 +01:00
Chaoscaot ae4d498694 Fix TNTLeague Sound 2024-12-11 14:04:06 +01:00
Lixfel e9f6b284eb Test if broadcasting apollo:json acceptance triggers ModList sending. 2024-12-11 13:26:12 +01:00
Lixfel 454cfecc0e Merge pull request 'Better Hull Hider Algorithm' (#76) from FightSystem/HullHiderAlgo_v2 into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/76
Reviewed-by: Chaoscaot <chaos@chaoscaot.de>
2024-12-11 13:16:39 +01:00
Chaoscaot bc217c16dd Merge pull request 'Finish TNTLeague' (#53) from TNTLeague/finish into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/53
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-12-11 10:53:39 +01:00
Chaoscaot d3f6075686 Add to CI 2024-12-11 10:53:17 +01:00
Lixfel a1e77e571b Fix entity hider. 2024-12-11 09:52:05 +01:00
Lixfel b31bd58e1a Handle additional recorded plugin channels. 2024-12-10 12:58:19 +01:00
Lixfel f81b95e39f Fix direction id. 2024-12-10 12:57:21 +01:00
Lixfel 7ce5e319b5 Reduce unnecessary branch propagation by early abort with primary direction visibility. 2024-12-10 11:08:44 +01:00
Lixfel c50bb64516 Performance improvements 2024-12-10 01:59:16 +01:00
Lixfel b1c0e36cee Remove diagonal diagonals, branch only in enemy direction 2024-12-10 00:44:26 +01:00
Lixfel be653754a7 Better Hull Hider Algorithm
Cardinal visibility with diagonal branching.
2024-12-10 00:01:47 +01:00
Chaoscaot 9c055ee929 Merge pull request 'Fix Schematic Punishment Messages' (#75) from SchematicSystem/fix-punishment into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/75
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-12-09 19:06:00 +01:00
Chaoscaot 80ab0eeda0 Fix 2024-12-09 19:05:36 +01:00
Chaoscaot 257f70cc6a Merge pull request 'Limit maximum number of sent in Schematics' (#74) from SchematicSystem/no-more-than-three into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/74
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-12-09 19:02:46 +01:00
Lixfel 970780b855 Reduce PluginMessage spam 2024-12-09 16:26:48 +01:00
Lixfel c0d9b9f89b Fix /historic hover 2024-12-09 16:20:21 +01:00
Chaoscaot 6d0fa6527e Fix Schematic Punishment Messages 2024-12-08 23:40:50 +01:00
Chaoscaot df4cd12d2a Unused Import 2024-12-08 23:29:57 +01:00
Chaoscaot 60dc00fd92 Limit maximum number of sent in Schematics 2024-12-08 23:29:13 +01:00
Chaoscaot 06eec10660 Fixes... 2024-12-08 23:18:32 +01:00
YoyoNow e1010f79e9 Merge pull request 'Fix color region reset' (#73) from BauSystem/resetColor into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/73
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-12-06 21:04:49 +01:00
Chaoscaot e93683842b Language 2024-12-06 18:36:59 +01:00
Lixfel cd17e625ca Remove debug output 2024-12-06 13:39:08 +01:00
Lixfel d21e50dadd Test fix DiscordAlert 2024-12-06 13:36:13 +01:00
Lixfel 19ea605784 Debug DiscordAlert 2024-12-06 13:32:37 +01:00
Lixfel 4c12148552 Fix color region reset 2024-12-06 13:22:02 +01:00
Lixfel da672a7506 Fix tablist after softreload 2024-12-06 13:07:21 +01:00
Lixfel 2f50c7acae Add debug output for DiscordAlert malfunction, add plugin messages 2024-12-06 12:50:09 +01:00
Lixfel ed276bf4ce Fix for delayed interaction replys, add plugin messages 2024-12-06 11:41:29 +01:00
Lixfel f5f8b3bd06 Test fix for delayed interaction replys 2024-12-06 11:23:54 +01:00
Lixfel f01f869479 Fix logging of WARN level in Exception table 2024-12-05 21:48:52 +01:00
Lixfel 3ce958778a Fix NPE 2024-12-05 16:03:21 +01:00
Lixfel c4849657df Deploy api backend 2024-12-05 13:28:46 +01:00
Lixfel 9a6dec6679 Merge pull request 'SubserverSystem-Refactoring' (#71) from SubserverSystem-Refactoring into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/71
Reviewed-by: Chaoscaot <chaos@chaoscaot.de>
2024-12-04 11:43:27 +01:00
Chaoscaot 0134ef1f61 Maybe, Fix Schematics Readers 2024-12-03 22:43:14 +01:00
Chaoscaot 19a4d0e93a Fixes 2024-12-03 17:17:29 +01:00
Chaoscaot 677eb4137a Merge branch 'main' into TNTLeague/finish 2024-12-03 17:07:56 +01:00
Lixfel 7b55e99be0 Fix arena start condition 2024-12-03 17:05:53 +01:00
Lixfel 3abba4ae35 Add /build stop command 2024-12-03 15:50:32 +01:00
Lixfel d2650ad97f Remove Servertype enum, fix starting multiple servers at once, 2024-12-03 15:42:57 +01:00
YoyoNow 57d4727f35 Hotfix CustomMap (die letzte) 2024-12-02 18:39:14 +01:00
YoyoNow a040448b5e Hotfix CustomMap 2024-12-02 18:36:38 +01:00
YoyoNow 79a993c8ec Hotfix CustomMap 2024-12-02 18:30:08 +01:00
YoyoNow bd95e95bc3 Revert "Remove ModifyCommand"
This reverts commit d93d7c95eb.
2024-12-02 18:25:47 +01:00
YoyoNow d93d7c95eb Remove ModifyCommand 2024-12-02 18:21:45 +01:00
YoyoNow f97cc2ca61 Hotfix CustomMap 2024-12-02 17:24:23 +01:00
Chaoscaot 990a59ae72 Hotfix: Fix 1.21 Schematic Writer (again?) 2024-12-01 23:44:08 +01:00
Chaoscaot 0153910402 Hotfix: Fix 1.21 Schematic Writer (again) 2024-12-01 23:39:00 +01:00
Chaoscaot e61466e390 Hotfix: Fix 1.21 Schematic Writer 2024-12-01 23:32:04 +01:00
Chaoscaot 2788670bbb Hotfix: Replays (Again Again Again!) 2024-12-01 22:46:44 +01:00
Chaoscaot 2ea8c93961 Hotfix: Replays (Again Again!) 2024-12-01 22:41:36 +01:00
Chaoscaot dfe7c389f6 Hotfix: Replays (Again!) 2024-12-01 22:36:12 +01:00
Chaoscaot 7140fbb1a0 Hotfix: Replays 2024-12-01 22:31:47 +01:00
Lixfel d57d73c488 Merge pull request 'Remove Now Unused Wrappers' (#66) from fixes into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/66
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-12-01 22:10:12 +01:00
Chaoscaot 66d417a210 Remove Now Unused Wrappers 2024-12-01 22:01:59 +01:00
Chaoscaot e16410fd65 Hotfix: Fix BountifulWrapper9 (hopefully) 2024-12-01 21:54:59 +01:00
Lixfel 4009f11871 Merge pull request 'Fixes for 1.21' (#65) from fixes into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/65
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-12-01 20:15:47 +01:00
Chaoscaot a009c841b1 Fix: getOpenInventory 2024-12-01 20:13:12 +01:00
Lixfel bf21d7ee90 Fix 1.20 Baus 2024-12-01 19:58:27 +01:00
Lixfel 851904beac Fix 1.20 Baus 2024-12-01 19:57:59 +01:00
Chaoscaot a4d5850555 Hotfix: SimulatorBaseGui InventoryView 2024-12-01 19:40:07 +01:00
Lixfel 116005c0c9 Fix Tablist gone after softreload 2024-12-01 19:22:48 +01:00
Lixfel 4dcfeb77b2 Unlock 21 BuilderCloud (and Bau) 2024-12-01 19:19:27 +01:00
Lixfel e24f108d90 Merge pull request 'Fix JsonParser.readString unavailable in 1.15-' (#62) from SpigotCore/JsonParser into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/62
Reviewed-by: Chaoscaot <chaos@chaoscaot.de>
2024-12-01 19:09:31 +01:00
Lixfel f4ef396d4e Merge pull request 'Update our Software to 1.21.3' (#60) from 1.21.3 into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/60
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-12-01 19:08:28 +01:00
Chaoscaot b041a50abb Remove Unused Replace 2024-12-01 18:56:21 +01:00
Chaoscaot f01cb66874 Add CraftbukkitWrapper21 for FightSystem 2024-12-01 17:20:24 +01:00
Chaoscaot 47cca70d95 Fix Particle 2024-12-01 17:12:48 +01:00
Chaoscaot 37072b1f49 Fixes... 2024-12-01 17:06:35 +01:00
YoyoNow f1154f3ea5 Fix messages of LobbySystem NPC Chat 2024-12-01 13:17:57 +01:00
Chaoscaot 7927a195d6 Fix REntity for 1.15.2-1.21.3
<1.15.2: Untested
2024-12-01 11:39:23 +01:00
YoyoNow fd791ea98d Update AdventCommand 2024-12-01 00:13:08 +01:00
Chaoscaot 41233b7710 Merge branch 'main' into 1.21.3
# Conflicts:
#	SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditWrapper.java
2024-11-30 21:37:45 +01:00
Lixfel 2032a0b642 Fix links in chat not clickable 2024-11-30 10:31:49 +01:00
Lixfel 996e4932d7 Text 1.20 Tablist fix 2024-11-30 09:35:34 +01:00
YoyoNow bd08107701 Merge pull request 'Fix ConcurrentModificationException through death in loop' (#63) from TowerRun/fixCME into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/63
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-11-29 16:02:09 +01:00
Lixfel 4ee8456fd4 Fix ConcurrentModificationException through death in loop 2024-11-29 15:23:17 +01:00
Lixfel 8e2cca854e Fix JsonParser.readString unavailable in 1.15- 2024-11-29 14:59:53 +01:00
Lixfel 28f96e313a Fix bau addmember hover message 2024-11-29 14:09:32 +01:00
Lixfel f51de58921 Fix checking deleted schematic limbo 2024-11-29 13:17:52 +01:00
Lixfel 46c2de43a4 Fix clipboard WorldEditRenderer with transform 2024-11-29 13:02:35 +01:00
Chaoscaot e088e9794b Update WorldEditWrapper21 2024-11-28 23:28:44 +01:00
Lixfel 891f4b0e9c Fix Schematic submission in 1.12 2024-11-28 17:03:34 +01:00
Lixfel e71a704d25 Fix 1.9-1.12 WorldEditRenderer 2024-11-28 16:57:49 +01:00
Lixfel c34575df29 Merge pull request 'Replace WorldEditSUI' (#56) from SpigotCore/WorldEditSUI into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/56
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-11-28 09:58:03 +01:00
Chaoscaot edd3524b41 Fix Build 2024-11-27 22:51:49 +01:00
TheBreadBeard b3cd8d843f Add private ticket log 2024-11-27 19:34:19 +01:00
TheBreadBeard 3e270643e8 Add private ticket log 2024-11-27 19:18:41 +01:00
Chaoscaot 313d63e99d Bausystem geht™️ 2024-11-27 19:06:30 +01:00
Lixfel 8b007721fb Fix NPC Chat messages 2024-11-27 12:38:50 +01:00
Chaoscaot 510aec048b send help ._. 2024-11-27 00:26:06 +01:00
Lixfel 9911a52da9 Bugfixes, tested. 2024-11-26 21:59:52 +01:00
Chaoscaot d5c06688f0 Backend Fixes... 2024-11-26 16:34:24 +01:00
Chaoscaot d6202f9596 First 1.21.3 drafts 2024-11-26 16:30:24 +01:00
YoyoNow df37fa1564 Hotfix SendCommand sending on random servers 2024-11-25 17:07:16 +01:00
Lixfel 0ca3ede280 Replace WorldEditSUI 2024-11-24 23:26:18 +01:00
Chaoscaot 16a5de7a84 Fix Permissions 2024-11-24 23:14:10 +01:00
Chaoscaot 8bb2be52f2 Language Fixes 2024-11-24 22:38:01 +01:00
YoyoNow 06e0d3df74 Merge pull request 'Fixed tracer not being deleted' (#55) from BauSystem/fix-tracer-deletion into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/55
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-11-24 22:37:19 +01:00
D4rkr34lm 128d2d3378 Should fix traces not being deleted 2024-11-24 22:26:43 +01:00
Chaoscaot d30fb5f949 Merge remote-tracking branch 'origin/main' into TNTLeague/finish 2024-11-24 22:20:41 +01:00
Lixfel afadf0b9dd Wrap CheckpointUtils for OpenJDK support 2024-11-24 22:17:11 +01:00
Chaoscaot 5e74aaad2c Merge branch 'main' into TNTLeague/finish 2024-11-24 22:13:01 +01:00
Lixfel daa17c3e8b Wrap CheckpointUtils for OpenJDK support, remove Border debug messages 2024-11-24 22:12:43 +01:00
Chaoscaot ec990cb52a Remove Component Messages 2024-11-24 21:35:13 +01:00
Lixfel 7f640ebd34 Merge pull request 'Add 1.21 Scoreboard Support' (#54) from SpigotCore/1.21 into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/54
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-11-24 20:13:27 +01:00
Lixfel c15d523f3b Hotfix NodeDownload 2024-11-23 17:09:58 +01:00
Chaoscaot 97e4ccb076 Fixes 2024-11-23 15:43:05 +01:00
Lixfel c2cf6125d1 Merge pull request 'Add Backend to Monorepo' (#29) from Backend/init into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/29
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-11-23 15:37:27 +01:00
Chaoscaot 7437f87d22 Fixes 2024-11-23 15:36:34 +01:00
Chaoscaot 5a3d801714 Merge branch 'main' into Backend/init 2024-11-23 13:28:00 +01:00
Chaoscaot edbc43abf1 Hotfix: ModUtils Autoban 2024-11-18 18:07:53 +01:00
Chaoscaot 9415a3f217 Nits 2024-11-18 18:02:15 +01:00
Chaoscaot 4bb1bc0cbd Fixes, changes and Refactors 2024-11-17 12:04:07 +01:00
Chaoscaot 78853c70f8 Fixes and Update Copyright 2024-11-15 23:42:08 +01:00
Chaoscaot 5ac327409b Merge branch 'SpigotCore/1.21' into TNTLeague/finish 2024-11-15 23:13:44 +01:00
Chaoscaot 35ca8f3877 Add 1.21 Scoreboard Support 2024-11-15 22:06:10 +01:00
Chaoscaot 2e9dbfe8b8 Fixes... 2024-11-15 21:35:10 +01:00
Chaoscaot 27bd7be776 Fix Translations 2024-11-14 22:55:03 +01:00
Chaoscaot 9dff1f5884 Revert "Update Message"
This reverts commit ac9197c554.
2024-11-14 22:18:34 +01:00
Chaoscaot 26f15304a2 Merge branch 'KotlinCore/message-update' into TNTLeague/finish 2024-11-14 22:16:14 +01:00
Chaoscaot d115975403 Add ComponentMessage, for TranslatableComponents in Paper >1.20 2024-11-14 22:08:06 +01:00
Chaoscaot ac9197c554 Update Message 2024-11-14 19:31:17 +01:00
YoyoNow a78974b903 Merge pull request 'Add npc chat messages' (#41) from LobbySystem/NpcChatAdditions into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/41
2024-11-13 13:32:36 +01:00
YoyoNow 8c0a888b3d Remove PR issues 2024-11-13 13:32:05 +01:00
YoyoNow 597716569b Merge remote-tracking branch 'origin/main' 2024-11-12 16:10:50 +01:00
YoyoNow 0485713e86 Update GameStates
Fix FightserverPortal.fightStateMapper
2024-11-12 16:10:46 +01:00
Lixfel 85c8e2e56b Merge pull request 'Fix transitive dependencies for STRG+Click in Source code not jumping to Source code' (#50) from FixTransitiveDependencies into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/50
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-11-12 15:57:40 +01:00
YoyoNow 43618fc290 Fix transitive dependencies for STRG+Click in Source code not jumping to Source code 2024-11-12 15:41:48 +01:00
YoyoNow 07049c4646 Merge pull request 'Add FightInfoPacketSender for TowerRun' (#47) from TowerRun/FightInfoPacket into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/47
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-11-12 14:56:15 +01:00
YoyoNow 32afd1de8c Fix PR things 2024-11-11 15:05:08 +01:00
Lixfel af4a3eb2ed Fix empty discord messages 2024-11-11 09:29:12 +01:00
Lixfel fdd6d84b54 Fix mod name during kick/ban 2024-11-10 17:46:43 +01:00
Lixfel 8842d822d9 Merge pull request 'Changes to support AIs, Add DummyAI' (#31) from FightSystem/DummyAI into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/31
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-11-10 17:33:09 +01:00
Lixfel 1c7c57e10c Update JDA to 5.2.0 2024-11-10 17:30:38 +01:00
Lixfel 5e27f5c333 Merge pull request 'Fix TinyProtocol spurious ConcurrentModificationExceptions' (#24) from SpigotCore/TInyProtocolConcurrentModEx into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/24
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-11-10 17:29:21 +01:00
Chaoscaot 9d87ac6747 Merge branch 'main' into TNTLeague/finish 2024-11-10 16:47:14 +01:00
YoyoNow 6fea09fb9d Fix nit picks 2024-11-03 20:26:24 +01:00
YoyoNow 338f2e6ed1 Add FightInfoPacketSender for TowerRun 2024-11-03 11:57:37 +01:00
YoyoNow a9514996a9 Update Punishment requirements 2024-10-29 15:57:24 +01:00
YoyoNow 31bcefce8a Fix ProcessingTracesState performance 2024-10-04 20:01:47 +02:00
YoyoNow 11a933fede Improve PasteBuilder 2024-09-17 16:51:31 +02:00
YoyoNow dbe6d40e36 Merge pull request 'Fix Discord Ticket Log' (#43) from VelocityCore/jda-fix into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/43
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-09-17 07:55:54 +02:00
YoyoNow d4ba20ee37 Hotfix SimulatorStorage.openSimulatorSelector ordering 2024-09-16 20:40:11 +02:00
YoyoNow cb54591ad9 Merge pull request 'Add team changecolor command alias' (#42) from VelocityCore/TeamChangecolor into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/42
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-09-16 18:01:31 +02:00
YoyoNow 9dcd0cce43 Merge branch 'main' into VelocityCore/TeamChangecolor 2024-09-16 18:00:40 +02:00
Chaoscaot 35d812b280 Fix Discord Ticket Log 2024-09-03 00:34:07 +02:00
Chaoscaot a1e1396bdb Fix Discord Ticket Log 2024-08-31 20:17:02 +02:00
TheBreadBeard a64f6292e9 Add team changecolor command alias 2024-08-30 11:00:56 +02:00
YoyoNow 2142ed2f97 Hotfix DiscordBot 2024-08-30 08:41:37 +02:00
YoyoNow 6560562b05 Hotfix DiscordBot? 2024-08-30 08:39:57 +02:00
YoyoNow 6222f76417 Hotfix DiscordBot 2024-08-30 08:33:05 +02:00
YoyoNow 1f908134a1 Hotfix DiscordBot 2024-08-30 08:31:29 +02:00
TheBreadBeard 04d9f38f7d Add team changecolor command alias 2024-08-29 22:53:22 +02:00
TheBreadBeard 94502a1567 Add npc chat messages 2024-08-29 22:40:05 +02:00
Chaoscaot 4edc59ba66 Add translations 2024-08-29 22:33:54 +02:00
Lixfel 46ee20ad1b Merge pull request 'Add DiscordTicketType.SCHEMATIC' (#40) from VelocityCore/SchematicReportDiscord into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/40
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-08-29 22:19:25 +02:00
TheBreadBeard 52302dd284 Add DiscordTicketType.SCHEMATIC 2024-08-29 22:09:43 +02:00
Lixfel e1769a42f4 DummyAI only Test arenas 2024-08-29 13:58:27 +02:00
YoyoNow 1b10063e30 Merge pull request 'Add SimulatorCommand.rename' (#38) from BauSystem/SimulatorRename into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/38
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-08-29 12:55:43 +02:00
YoyoNow bd389a7a7e Merge remote-tracking branch 'origin/BauSystem/SimulatorRename' into BauSystem/SimulatorRename 2024-08-29 11:32:40 +02:00
YoyoNow ac25dea08a Fix PR stuff 2024-08-29 11:32:34 +02:00
YoyoNow e0d964bdd7 Merge pull request 'Fix Loader wait time to be 2 gameticks when 1 is selected' (#39) from BauSystem/LoaderWaitTime into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/39
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-08-29 10:12:22 +02:00
Chaoscaot c11eaaee45 Fixes... 2024-08-27 21:34:18 +02:00
YoyoNow baf837946e Merge pull request 'Fix output on to small/large speed value' (#37) from BauSystem/SpeedCommand into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/37
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-08-27 20:16:44 +02:00
YoyoNow 5f92d4c68c Fix Loader wait time to be 2 gameticks when 1 is selected 2024-08-27 20:16:30 +02:00
YoyoNow 6496f33a9e Fix argument name of rename command 2024-08-26 07:44:54 +02:00
YoyoNow 9e2f2748b6 BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/SpeedCommand.java aktualisiert 2024-08-26 07:42:47 +02:00
YoyoNow a25e55ffdf Fix Loader wait time to be 2 gameticks when 1 is selected 2024-08-25 15:49:21 +02:00
YoyoNow c8381413a3 Add SimulatorCommand.rename 2024-08-25 15:46:03 +02:00
YoyoNow c61c2d8087 Fix output on to small/large speed value 2024-08-25 15:34:07 +02:00
YoyoNow 18cb7157d7 Merge remote-tracking branch 'origin/main' 2024-08-25 08:04:28 +02:00
YoyoNow ea929e0615 Hotfix Laufbau BoundingBoxLoader 2024-08-25 08:04:22 +02:00
Lixfel 42dd4160ea Merge pull request 'Update to Discord JDA 5.0' (#22) from dc-5 into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/22
2024-08-23 11:41:40 +02:00
Chaoscaot cab12fca92 Merge branch 'main' into Backend/init 2024-08-23 11:40:04 +02:00
YoyoNow a75a1e8e10 Hotfix WorldEditSelectionSaver 2024-08-22 17:01:53 +02:00
Chaoscaot d5398cbde2 Remove redundant checks 2024-08-22 11:17:17 +02:00
Chaoscaot 12b16d6801 Merge branch 'main' into dc-5 2024-08-22 11:10:41 +02:00
Lixfel c5f40f0911 Merge pull request 'Add CRIUSleepEvent and CRIUWakeupEvent' (#34) from CRIUSupport/Events into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/34
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-08-22 10:55:33 +02:00
Lixfel 9b66df1e08 Merge pull request 'Fix WorldEditSelectionSaver finally' (#35) from BauSystem/SelectionSaverTheLast into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/35
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-08-22 10:40:37 +02:00
YoyoNow 20acd7abbe Fix WorldEditSelectionSaver finally 2024-08-21 21:15:00 +02:00
YoyoNow 49fa6c364f Hotfix WorldEditUtils.getVertices 2024-08-21 21:07:25 +02:00
YoyoNow 56cbb41930 Merge pull request 'Add WorldEditSelectionSaver' (#32) from BauSystem/WorldEditSelectionSaver into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/32
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-08-21 20:55:58 +02:00
YoyoNow fde70029c5 Fix WorldEditUtils.setVertices 2024-08-21 20:55:03 +02:00
YoyoNow 42fd35077b Fix PR stuff 2024-08-21 20:31:21 +02:00
YoyoNow 76aa61934c Add CRIUSleepEvent and CRIUWakeupEvent
Fix AFKStopperListener
2024-08-21 20:27:36 +02:00
YoyoNow f375aa68b5 Fix things 2024-08-21 18:26:33 +02:00
YoyoNow b2ff042e4a Merge pull request 'Fix SpecialItem.getRandomItem' (#33) from MissileWars/FixItemGive into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/33
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-08-21 18:21:28 +02:00
YoyoNow 6a2a3314c6 Fix SpecialItem.getRandomItem 2024-08-21 11:04:28 +02:00
YoyoNow 007f0796ae Add WorldEditSelectionSaver 2024-08-21 10:59:09 +02:00
Lixfel 9203e84d46 Merge pull request 'Fix Badlion restrictions' (#27) from VelocityCore/BadlionRestrictions into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/27
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-08-20 08:14:31 +02:00
Chaoscaot cca8bdaab7 Merge branch 'main' into Backend/init 2024-08-18 23:11:20 +02:00
YoyoNow 5e1338a9f3 Merge pull request 'fix(BauSystem): Fix trace serialisation (#7)' (#12) from wip/#7-fix-eof-in-trace-reader into main
Reviewed-on: https://steamwar.de/devlabs/SteamWar/SteamWar/pulls/12
Reviewed-by: YoyoNow <jwsteam@nidido.de>
2024-08-18 21:00:57 +02:00
D4rkr34lm 50175b2518 Fixed access 2024-08-18 20:53:36 +02:00
Lixfel 09a8dc0786 Fix Badlion (tested), Fix Client channel registration and brand detection 2024-08-18 15:36:50 +02:00
Lixfel 5afdc04e1e Merge branch 'main' into VelocityCore/BadlionRestrictions 2024-08-18 14:40:22 +02:00
Chaoscaot 42254a5133 Fixes 2024-08-18 13:09:19 +02:00
Chaoscaot 6d648b9a71 Fixes 2024-08-18 13:03:24 +02:00
D4rkr34lm 67d4f3432a Changed trace record output to data output/input instead of object output/input 2024-08-18 12:23:05 +02:00
D4rkr34lm 3e6dd61428 Readd allArgs and history place holder 2024-08-18 12:08:57 +02:00
D4rkr34lm fbb6d84dae Moved trace system init to plugin enable 2024-08-18 11:53:14 +02:00
D4rkr34lm 44faab9950 Added all args through lombok 2024-08-18 11:45:38 +02:00
Chaoscaot f69f7ae294 Fix Build 2024-08-18 11:21:39 +02:00
D4rkr34lm a780385599 Removed debug statement 2024-08-18 11:19:35 +02:00
Chaoscaot fd7fe8c305 Add Backend to Monorepo 2024-08-18 11:15:54 +02:00
D4rkr34lm 817c522d9a Added flushing of trace write to prevent eof on read 2024-08-18 11:14:42 +02:00
Lixfel 4a2afee27d Fix Badlion restrictions (untested)
Fixes #dreamjxnas-bug-325.
2024-08-16 17:56:00 +02:00
D4rkr34lm 15654394b5 Fixed false record count being red 2024-08-16 17:36:43 +02:00
D4rkr34lm 25f6b3c223 Fixed trace record count in trace objects created through recording 2024-08-16 17:35:11 +02:00
D4rkr34lm 642e9ffd50 Fixed deletion of old traces 2024-08-16 17:18:02 +02:00
Lixfel 8bdb2bad14 Fix TinyProtocol spurious ConcurrentModificationExceptions 2024-08-13 19:37:37 +02:00
Chaoscaot 8b776ff33e Es baut... (Untested) 2024-08-12 17:15:38 +02:00
D4rkr34lm 963f798e7c Added removal of outdated save files and usage of safe file versioning 2024-08-08 16:01:35 +02:00
D4rkr34lm 0d2e028fac Moved init functionality in onEnable 2024-08-08 16:01:35 +02:00
D4rkr34lm ead144d974 Removed compression from TraceRecord serialisation 2024-08-08 16:01:35 +02:00
D4rkr34lm be848ac67a Improved trace serialisation through versioning 2024-08-08 16:01:35 +02:00
D4rkr34lm a9393f878f Extracted Trace Deserialisation/Serialisation process into Repo 2024-08-08 16:01:35 +02:00
D4rkr34lm 3b378977b7 removed vscode config from repo 2024-08-08 16:01:35 +02:00
D4rkr34lm 6c7b0f7bb5 Added workspace config for VsCode workspace 2024-08-08 16:01:35 +02:00
D4rkr34lm f4fef76562 Added VS Code configuration to gitignore 2024-08-08 16:01:35 +02:00
357 changed files with 7722 additions and 4783 deletions
+4
View File
@@ -11,5 +11,9 @@ steamwar.properties
.idea .idea
*.iml *.iml
# VSCode
bin/
.vscode
# Other # Other
lib lib
+2 -2
View File
@@ -27,8 +27,8 @@ java {
} }
dependencies { dependencies {
compileOnly(project(":BauSystem:BauSystem_Main")) compileOnly(project(":BauSystem:BauSystem_Main", "default"))
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore", "default"))
compileOnly(libs.nms15) compileOnly(libs.nms15)
compileOnly(libs.worldedit15) compileOnly(libs.worldedit15)
@@ -19,27 +19,21 @@
package de.steamwar.bausystem.utils; package de.steamwar.bausystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import de.steamwar.bausystem.features.util.NoClipCommand; import de.steamwar.bausystem.features.util.NoClipCommand;
import net.minecraft.server.v1_15_R1.*; import net.minecraft.server.v1_15_R1.*;
import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.function.LongSupplier;
public class NMSWrapper15 implements NMSWrapper { public class NMSWrapper15 implements NMSWrapper {
private static final Reflection.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0); private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@@ -63,7 +57,7 @@ public class NMSWrapper15 implements NMSWrapper {
player.updateInventory(); player.updateInventory();
} }
private static final Reflection.FieldAccessor<Integer> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, int.class, 0); private static final Reflection.Field<Integer> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, int.class, 0);
@Override @Override
public void setGameStateChangeReason(Object packet) { public void setGameStateChangeReason(Object packet) {
@@ -120,12 +114,12 @@ public class NMSWrapper15 implements NMSWrapper {
return invalid; return invalid;
} }
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion"); private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0); private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1); private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2); private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0); private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0); private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
@Override @Override
public Object resetExplosionKnockback(Object packet) { public Object resetExplosionKnockback(Object packet) {
@@ -19,12 +19,9 @@
package de.steamwar.bausystem.utils; package de.steamwar.bausystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import de.steamwar.bausystem.utils.PlayerMovementWrapper;
import net.minecraft.server.v1_15_R1.EntityPlayer; import net.minecraft.server.v1_15_R1.EntityPlayer;
import net.minecraft.server.v1_15_R1.PacketPlayInFlying; import net.minecraft.server.v1_15_R1.PacketPlayInFlying;
import net.minecraft.server.v1_15_R1.PacketPlayOutEntity;
import net.minecraft.server.v1_15_R1.PacketPlayOutEntityTeleport;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -46,14 +43,9 @@ public class PlayerMovementWrapper15 implements PlayerMovementWrapper {
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object); PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
Object packet = Reflection.newInstance(teleportPacket); Object packet = Reflection.newInstance(teleportPacket);
teleportEntity.set(packet, player.getEntityId()); teleportEntity.set(packet, player.getEntityId());
teleportPosition.set(packet, packetPlayInFlying.a(0.0), packetPlayInFlying.b(0.0), packetPlayInFlying.c(0.0)); teleportPosition.set(packet, packetPlayInFlying.a(0.0), packetPlayInFlying.b(0.0), packetPlayInFlying.c(0.0),
if (Float.isNaN(packetPlayInFlying.a(Float.NaN))) { Float.isNaN(packetPlayInFlying.a(Float.NaN)) ? player.getLocation().getYaw() : packetPlayInFlying.a(0.0F),
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw())); Float.isNaN(packetPlayInFlying.b(Float.NaN)) ? player.getLocation().getPitch() : packetPlayInFlying.b(0.0F));
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
} else {
teleportYaw.set(packet, rotToByte(packetPlayInFlying.a(0.0F)));
teleportPitch.set(packet, rotToByte(packetPlayInFlying.b(0.0F)));
}
return packet; return packet;
} }
} }
+2 -2
View File
@@ -27,8 +27,8 @@ java {
} }
dependencies { dependencies {
compileOnly(project(":BauSystem:BauSystem_Main")) compileOnly(project(":BauSystem:BauSystem_Main", "default"))
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore", "default"))
compileOnly(libs.spigotapi) compileOnly(libs.spigotapi)
compileOnly(libs.nms18) compileOnly(libs.nms18)
@@ -19,36 +19,26 @@
package de.steamwar.bausystem.utils; package de.steamwar.bausystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.features.util.NoClipCommand; import de.steamwar.bausystem.features.util.NoClipCommand;
import net.minecraft.SystemUtils;
import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.*; import net.minecraft.network.protocol.game.*;
import net.minecraft.server.level.PlayerInteractManager; import net.minecraft.server.level.PlayerInteractManager;
import net.minecraft.world.level.EnumGamemode; import net.minecraft.world.level.EnumGamemode;
import net.minecraft.world.phys.Vec3D;
import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.function.LongSupplier;
public class NMSWrapper18 implements NMSWrapper { public class NMSWrapper18 implements NMSWrapper {
private static final Reflection.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0); private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@@ -73,7 +63,7 @@ public class NMSWrapper18 implements NMSWrapper {
player.updateInventory(); player.updateInventory();
} }
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12); private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
@Override @Override
public void setGameStateChangeReason(Object packet) { public void setGameStateChangeReason(Object packet) {
@@ -130,12 +120,12 @@ public class NMSWrapper18 implements NMSWrapper {
return invalid; return invalid;
} }
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion"); private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0); private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1); private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2); private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0); private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0); private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
@Override @Override
public Object resetExplosionKnockback(Object packet) { public Object resetExplosionKnockback(Object packet) {
@@ -19,8 +19,7 @@
package de.steamwar.bausystem.utils; package de.steamwar.bausystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import de.steamwar.bausystem.utils.PlayerMovementWrapper;
import net.minecraft.network.protocol.game.PacketPlayInFlying; import net.minecraft.network.protocol.game.PacketPlayInFlying;
import net.minecraft.server.level.EntityPlayer; import net.minecraft.server.level.EntityPlayer;
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
@@ -44,14 +43,9 @@ public class PlayerMovementWrapper18 implements PlayerMovementWrapper {
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object); PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
Object packet = Reflection.newInstance(teleportPacket); Object packet = Reflection.newInstance(teleportPacket);
teleportEntity.set(packet, player.getEntityId()); teleportEntity.set(packet, player.getEntityId());
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c); teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c,
if (packetPlayInFlying.h) { packetPlayInFlying.h ? player.getLocation().getYaw() : packetPlayInFlying.d,
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw())); packetPlayInFlying.h ? player.getLocation().getPitch() : packetPlayInFlying.e);
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
} else {
teleportYaw.set(packet, rotToByte(packetPlayInFlying.d));
teleportPitch.set(packet, rotToByte(packetPlayInFlying.e));
}
return packet; return packet;
} }
} }
+2 -2
View File
@@ -27,8 +27,8 @@ java {
} }
dependencies { dependencies {
compileOnly(project(":BauSystem:BauSystem_Main")) compileOnly(project(":BauSystem:BauSystem_Main", "default"))
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore", "default"))
compileOnly(libs.spigotapi) compileOnly(libs.spigotapi)
compileOnly(libs.paperapi) compileOnly(libs.paperapi)
@@ -19,37 +19,26 @@
package de.steamwar.bausystem.utils; package de.steamwar.bausystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.features.util.NoClipCommand; import de.steamwar.bausystem.features.util.NoClipCommand;
import net.minecraft.SystemUtils;
import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.*; import net.minecraft.network.protocol.game.*;
import net.minecraft.network.syncher.DataWatcher;
import net.minecraft.server.level.PlayerInteractManager; import net.minecraft.server.level.PlayerInteractManager;
import net.minecraft.world.level.EnumGamemode; import net.minecraft.world.level.EnumGamemode;
import net.minecraft.world.phys.Vec3D;
import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.function.LongSupplier;
public class NMSWrapper19 implements NMSWrapper { public class NMSWrapper19 implements NMSWrapper {
private static final Reflection.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0); private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@@ -73,7 +62,7 @@ public class NMSWrapper19 implements NMSWrapper {
player.updateInventory(); player.updateInventory();
} }
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12); private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
@Override @Override
public void setGameStateChangeReason(Object packet) { public void setGameStateChangeReason(Object packet) {
@@ -130,12 +119,12 @@ public class NMSWrapper19 implements NMSWrapper {
return invalid; return invalid;
} }
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion"); private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0); private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1); private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2); private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0); private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0); private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
@Override @Override
public Object resetExplosionKnockback(Object packet) { public Object resetExplosionKnockback(Object packet) {
@@ -19,17 +19,12 @@
package de.steamwar.bausystem.utils; package de.steamwar.bausystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import net.minecraft.network.protocol.game.PacketPlayInFlying; import net.minecraft.network.protocol.game.PacketPlayInFlying;
import net.minecraft.server.level.EntityPlayer; import net.minecraft.server.level.EntityPlayer;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class PlayerMovementWrapper19 implements PlayerMovementWrapper { public class PlayerMovementWrapper19 implements PlayerMovementWrapper {
@Override @Override
@@ -48,14 +43,9 @@ public class PlayerMovementWrapper19 implements PlayerMovementWrapper {
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object); PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
Object packet = Reflection.newInstance(teleportPacket); Object packet = Reflection.newInstance(teleportPacket);
teleportEntity.set(packet, player.getEntityId()); teleportEntity.set(packet, player.getEntityId());
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c); teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c,
if (packetPlayInFlying.h) { packetPlayInFlying.h ? player.getLocation().getYaw() : packetPlayInFlying.d,
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw())); packetPlayInFlying.h ? player.getLocation().getPitch() : packetPlayInFlying.e);
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
} else {
teleportYaw.set(packet, rotToByte(packetPlayInFlying.d));
teleportPitch.set(packet, rotToByte(packetPlayInFlying.e));
}
return packet; return packet;
} }
} }
+2 -2
View File
@@ -27,8 +27,8 @@ java {
} }
dependencies { dependencies {
compileOnly(project(":BauSystem:BauSystem_Main")) compileOnly(project(":BauSystem:BauSystem_Main", "default"))
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore", "default"))
compileOnly(libs.spigotapi) compileOnly(libs.spigotapi)
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.utils; package de.steamwar.bausystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import de.steamwar.bausystem.features.util.NoClipCommand; import de.steamwar.bausystem.features.util.NoClipCommand;
import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@@ -40,7 +40,7 @@ import java.util.List;
public class NMSWrapper20 implements NMSWrapper { public class NMSWrapper20 implements NMSWrapper {
private static final Reflection.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0); private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@@ -64,7 +64,7 @@ public class NMSWrapper20 implements NMSWrapper {
player.updateInventory(); player.updateInventory();
} }
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12); private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
@Override @Override
public void setGameStateChangeReason(Object packet) { public void setGameStateChangeReason(Object packet) {
@@ -121,12 +121,12 @@ public class NMSWrapper20 implements NMSWrapper {
return invalid; return invalid;
} }
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion"); private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0); private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1); private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2); private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0); private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0); private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
@Override @Override
public Object resetExplosionKnockback(Object packet) { public Object resetExplosionKnockback(Object packet) {
@@ -19,18 +19,12 @@
package de.steamwar.bausystem.utils; package de.steamwar.bausystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import net.minecraft.network.protocol.game.PacketPlayInFlying; import net.minecraft.network.protocol.game.PacketPlayInFlying;
import net.minecraft.network.protocol.game.PacketPlayOutEntityTeleport;
import net.minecraft.server.level.EntityPlayer; import net.minecraft.server.level.EntityPlayer;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class PlayerMovementWrapper20 implements PlayerMovementWrapper { public class PlayerMovementWrapper20 implements PlayerMovementWrapper {
@Override @Override
@@ -49,14 +43,9 @@ public class PlayerMovementWrapper20 implements PlayerMovementWrapper {
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object); PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
Object packet = Reflection.newInstance(teleportPacket); Object packet = Reflection.newInstance(teleportPacket);
teleportEntity.set(packet, player.getEntityId()); teleportEntity.set(packet, player.getEntityId());
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c); teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c,
if (packetPlayInFlying.h) { packetPlayInFlying.h ? player.getLocation().getYaw() : packetPlayInFlying.d,
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw())); packetPlayInFlying.h ? player.getLocation().getPitch() : packetPlayInFlying.e);
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
} else {
teleportYaw.set(packet, rotToByte(packetPlayInFlying.d));
teleportPitch.set(packet, rotToByte(packetPlayInFlying.e));
}
return packet; return packet;
} }
} }
+17
View File
@@ -0,0 +1,17 @@
plugins {
steamwar.java
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
dependencies {
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
compileOnly(project(":SpigotCore", "default"))
compileOnly(libs.paperapi21)
compileOnly(libs.nms21)
}
@@ -0,0 +1,141 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.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 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.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.Optional;
public class NMSWrapper21 implements NMSWrapper {
private static final Reflection.Field<PlayerInteractManager> playerInteractManager = Reflection.getField(EntityPlayer.class, null, PlayerInteractManager.class);
@Override
public void setInternalGameMode(Player player, GameMode gameMode) {
playerInteractManager.get(((CraftPlayer) player).getHandle()).a(EnumGamemode.a(gameMode.getValue()));
}
@Override
public void setSlotToItemStack(Player player, Object o) {
PacketPlayInSetCreativeSlot packetPlayInSetCreativeSlot = (PacketPlayInSetCreativeSlot) o;
int index = packetPlayInSetCreativeSlot.b();
if (index >= 36 && index <= 44) {
index -= 36;
} else if (index > 44) {
index -= 5;
} else if (index <= 8) {
index = index - 8 + 36;
}
player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.e()));
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);
@Override
public void setGameStateChangeReason(Object packet) {
gameStateChangeReason.set(packet, PacketPlayOutGameStateChange.d);
}
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;
}
@Override
public Material pathMaterial() {
return Material.DIRT_PATH;
}
private static final int threshold = 2048;
@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;
}
}
return false;
}
private int drillDown(NBTTagList items, int layer, int start) {
if (layer > 2) return start + threshold;
int invalid = start;
for (NBTBase nbtBase : items) {
if (!(nbtBase instanceof NBTTagCompound slot))
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);
}
}
}
if (invalid > threshold)
break;
}
return invalid;
}
@Override
public Object resetExplosionKnockback(Object packet) {
PacketPlayOutExplosion explosion = (PacketPlayOutExplosion) packet;
return new PacketPlayOutExplosion(
explosion.b(),
Optional.empty(),
explosion.f(),
explosion.g()
);
}
}
+1 -3
View File
@@ -33,14 +33,12 @@ java {
dependencies { dependencies {
compileOnly(libs.classindex) compileOnly(libs.classindex)
annotationProcessor(libs.classindex) annotationProcessor(libs.classindex)
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore", "default"))
compileOnly(libs.spigotapi) compileOnly(libs.spigotapi)
compileOnly(libs.axiom) compileOnly(libs.axiom)
compileOnly(libs.authlib) compileOnly(libs.authlib)
compileOnly(libs.viaapi)
compileOnly(libs.nms20)
compileOnly(libs.fawe18) compileOnly(libs.fawe18)
implementation(libs.luaj) implementation(libs.luaj)
@@ -271,6 +271,7 @@ SIMULATOR_CHANGE_HELP=§8/§esimulator change §8-§7 Change your simulator wand
SIMULATOR_DELETE_HELP=§8/§esimulator delete §8[§7name§8] §8-§7 Deletes the simulator SIMULATOR_DELETE_HELP=§8/§esimulator delete §8[§7name§8] §8-§7 Deletes the simulator
SIMULATOR_START_HELP=§8/§esimulator start §8[§7name§8] §8-§7 Starts the simulator SIMULATOR_START_HELP=§8/§esimulator start §8[§7name§8] §8-§7 Starts the simulator
SIMULATOR_COPY_HELP=§8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Copy the simulator SIMULATOR_COPY_HELP=§8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Copy the simulator
SIMULATOR_RENAME_HELP=§8/§esimulator rename §8[§7to-rename§8] §8[§7name§8] §8-§7 Rename the simulator
SIMULATOR_GUI_ITEM_NAME=§eTNT Simulator SIMULATOR_GUI_ITEM_NAME=§eTNT Simulator
SIMULATOR_NO_SIM_IN_HAND=§cNo simulator item selected SIMULATOR_NO_SIM_IN_HAND=§cNo simulator item selected
SIMULATOR_GUI_SELECT_SIM=Simulator selection SIMULATOR_GUI_SELECT_SIM=Simulator selection
@@ -307,6 +308,7 @@ SIMULATOR_POSITION_Z=§7z-Position
SIMULATOR_BACK=§eBack SIMULATOR_BACK=§eBack
SIMULATOR_GUI_TOTAL_TNT=§7Total TNT§8: §e{0} SIMULATOR_GUI_TOTAL_TNT=§7Total TNT§8: §e{0}
SIMULATOR_DELETED=§cSimulator deleted SIMULATOR_DELETED=§cSimulator deleted
SIMULATOR_RENAMED=§cSimulator renamed from {0} to {1}
## GUI ## GUI
SIMULATOR_POSITION_EDIT=§eEdit position SIMULATOR_POSITION_EDIT=§eEdit position
SIMULATOR_POSITION_ADD=§eSet position SIMULATOR_POSITION_ADD=§eSet position
@@ -1012,5 +1014,3 @@ COLORREPLACE_HELP=§8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §
TYPEREPLACE_HELP=§8//§etypereplace §8[§7type§8] §8[§7type§8] §8- §7Replace all blocks of one type with another TYPEREPLACE_HELP=§8//§etypereplace §8[§7type§8] §8[§7type§8] §8- §7Replace all blocks of one type with another
# Schematic # Schematic
SCHEMATIC_GUI_ITEM=§eSchematics SCHEMATIC_GUI_ITEM=§eSchematics
#VersionAnnouncer
SERVER_VERSION=§7This server runs on Minecraft version §e{0}
@@ -254,6 +254,7 @@ SIMULATOR_CHANGE_HELP=§8/§esimulator change §8-§7 Wechsel zu einem anderen S
SIMULATOR_DELETE_HELP=§8/§esimulator delete §8[§7name§8] §8-§7 Löscht den Simulator SIMULATOR_DELETE_HELP=§8/§esimulator delete §8[§7name§8] §8-§7 Löscht den Simulator
SIMULATOR_START_HELP=§8/§esimulator start §8[§7name§8] §8-§7 Startet die Simulation SIMULATOR_START_HELP=§8/§esimulator start §8[§7name§8] §8-§7 Startet die Simulation
SIMULATOR_COPY_HELP=§8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Kopiert einen Simulator SIMULATOR_COPY_HELP=§8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Kopiert einen Simulator
SIMULATOR_RENAME_HELP=§8/§esimulator rename §8[§7to-rename§8] §8[§7name§8] §8-§7 Benennt einen Simulator um
SIMULATOR_GUI_ITEM_NAME=§eTNT Simulator SIMULATOR_GUI_ITEM_NAME=§eTNT Simulator
SIMULATOR_NO_SIM_IN_HAND=§cKein Simulator Item gewählt SIMULATOR_NO_SIM_IN_HAND=§cKein Simulator Item gewählt
SIMULATOR_GUI_SELECT_SIM=Simulator wählen SIMULATOR_GUI_SELECT_SIM=Simulator wählen
@@ -290,6 +291,7 @@ SIMULATOR_POSITION_Z=§7z-Position
SIMULATOR_BACK=§eZurück SIMULATOR_BACK=§eZurück
SIMULATOR_GUI_TOTAL_TNT=§7Gesamt TNT§8: §e{0} SIMULATOR_GUI_TOTAL_TNT=§7Gesamt TNT§8: §e{0}
SIMULATOR_DELETED=§cSimulator gelöscht SIMULATOR_DELETED=§cSimulator gelöscht
SIMULATOR_RENAMED=§cSimulator von {0} zu {1} umbenannt
## GUI ## GUI
SIMULATOR_POSITION_EDIT=§ePosition bearbeiten SIMULATOR_POSITION_EDIT=§ePosition bearbeiten
SIMULATOR_POSITION_ADD=§ePosition setzen SIMULATOR_POSITION_ADD=§ePosition setzen
@@ -953,5 +955,3 @@ COLORREPLACE_HELP=§8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §
TYPEREPLACE_HELP=§8//§etyreplace §8[§7type§8] §8[§7type§8] §8- §7Ersetzt einen Blockgruppe mit einer anderen TYPEREPLACE_HELP=§8//§etyreplace §8[§7type§8] §8[§7type§8] §8- §7Ersetzt einen Blockgruppe mit einer anderen
# Schematics # Schematics
SCHEMATIC_GUI_ITEM=§eSchematics SCHEMATIC_GUI_ITEM=§eSchematics
#VersionAnnouncer
SERVER_VERSION=§7Dieser Server läuft auf Minecraft-Version §e{0}
@@ -25,9 +25,12 @@ import de.steamwar.bausystem.configplayer.ConfigConverter;
import de.steamwar.bausystem.features.gui.BauGUI; import de.steamwar.bausystem.features.gui.BauGUI;
import de.steamwar.bausystem.features.script.lua.SteamWarLuaPlugin; import de.steamwar.bausystem.features.script.lua.SteamWarLuaPlugin;
import de.steamwar.bausystem.features.script.lua.libs.LuaLib; import de.steamwar.bausystem.features.script.lua.libs.LuaLib;
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
import de.steamwar.bausystem.features.slaves.panzern.Panzern; import de.steamwar.bausystem.features.slaves.panzern.Panzern;
import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm; import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
import de.steamwar.bausystem.features.tpslimit.TPSFreezeUtils; import de.steamwar.bausystem.features.tpslimit.TPSFreezeUtils;
import de.steamwar.bausystem.features.tracer.TraceManager;
import de.steamwar.bausystem.features.tracer.TraceRecorder;
import de.steamwar.bausystem.features.world.BauScoreboard; import de.steamwar.bausystem.features.world.BauScoreboard;
import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.bausystem.region.loader.PrototypeLoader; import de.steamwar.bausystem.region.loader.PrototypeLoader;
@@ -70,7 +73,7 @@ import java.util.function.Consumer;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class BauSystem extends JavaPlugin implements Listener { public class BauSystem extends JavaPlugin {
// This should be treated as final! // This should be treated as final!
public static Message MESSAGE; public static Message MESSAGE;
@@ -182,6 +185,9 @@ public class BauSystem extends JavaPlugin implements Listener {
if (any instanceof ConfigConverter) { if (any instanceof ConfigConverter) {
Config.addConfigConverter((ConfigConverter) any); Config.addConfigConverter((ConfigConverter) any);
} }
if (any instanceof BoundingBoxLoader) {
((BoundingBoxLoader) any).load();
}
}); });
instances.forEach((clazz, o) -> { instances.forEach((clazz, o) -> {
@@ -197,6 +203,9 @@ public class BauSystem extends JavaPlugin implements Listener {
}); });
TickListener.impl.init(); TickListener.impl.init();
TraceManager.instance.init();
TraceRecorder.instance.init();
} }
@Override @Override
@@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.gui.editor;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.gui.BauGUI; import de.steamwar.bausystem.features.gui.BauGUI;
import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv; import de.steamwar.inventory.SWListInv;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
@@ -72,7 +73,7 @@ public class BauGuiEditor implements Listener {
inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> { inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> {
}).getItemStack()); }).getItemStack());
inv.setItem(mapping.getSize() + 6, new SWItem(Material.SCUTE, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack()); inv.setItem(mapping.getSize() + 6, new SWItem(TrickyTrialsWrapper.impl.getTurtleScute(), BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack());
inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).getItemStack()); inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).getItemStack());
p.openInventory(inv); p.openInventory(inv);
@@ -93,6 +93,7 @@ public class Loader implements Listener {
element.execute(delay -> waitTime = delay); element.execute(delay -> waitTime = delay);
if (waitTime > 0) { if (waitTime > 0) {
if (element instanceof LoaderTNT) currentElement--; if (element instanceof LoaderTNT) currentElement--;
waitTime--;
return; return;
} }
} }
@@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.loadtimer; package de.steamwar.bausystem.features.loadtimer;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@@ -57,7 +58,7 @@ public class LoadtimerListener implements Listener {
@EventHandler @EventHandler
public void onEntitySpawn(EntitySpawnEvent event) { public void onEntitySpawn(EntitySpawnEvent event) {
if (!getTimers().isEmpty() && event.getEntityType() == EntityType.PRIMED_TNT) { if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
Region r = Region.getRegion(event.getLocation()); Region r = Region.getRegion(event.getLocation());
if (hasTimer(r)) { if (hasTimer(r)) {
getTimer(r).onTntSpawn(); getTimer(r).onTntSpawn();
@@ -67,7 +68,7 @@ public class LoadtimerListener implements Listener {
@EventHandler @EventHandler
public void onEntityExplode(EntityExplodeEvent event) { public void onEntityExplode(EntityExplodeEvent event) {
if (!getTimers().isEmpty() && event.getEntityType() == EntityType.PRIMED_TNT) { if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
Region r = Region.getRegion(event.getLocation()); Region r = Region.getRegion(event.getLocation());
if (hasTimer(r)) { if (hasTimer(r)) {
getTimer(r).onTntExplode(event); getTimer(r).onTntExplode(event);
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.features.observer; package de.steamwar.bausystem.features.observer;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import de.steamwar.bausystem.region.Point; import de.steamwar.bausystem.region.Point;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@@ -170,7 +170,7 @@ public class ObserverTracer {
} }
} }
private static final Class<?> craftPoweredRail = Reflection.getClass("{obc}.block.impl.CraftPoweredRail"); private static final Class<?> craftPoweredRail = Reflection.getClass("org.bukkit.craftbukkit.block.impl.CraftPoweredRail");
private boolean checkAllowed(Block block, BlockData blockData) { private boolean checkAllowed(Block block, BlockData blockData) {
if (checkMaterial(block)) return true; if (checkMaterial(block)) return true;
if (block.getType() == Material.BELL) { if (block.getType() == Material.BELL) {
@@ -6,6 +6,7 @@ import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode; import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
import de.steamwar.bausystem.utils.ScoreboardElement; import de.steamwar.bausystem.utils.ScoreboardElement;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
@@ -31,7 +32,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
return; return;
} }
e.setCancelled(true); e.setCancelled(true);
if (e.getEntityType() == EntityType.PRIMED_TNT) { if (e.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
e.getLocation().getBlock().setType(Material.TNT, false); e.getLocation().getBlock().setType(Material.TNT, false);
}, 1L); }, 1L);
@@ -20,7 +20,6 @@
package de.steamwar.bausystem.features.region; package de.steamwar.bausystem.features.region;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.BauServer; import de.steamwar.bausystem.config.BauServer;
import de.steamwar.bausystem.region.GlobalRegion; import de.steamwar.bausystem.region.GlobalRegion;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
@@ -31,7 +30,6 @@ import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.utils.PasteBuilder; import de.steamwar.bausystem.utils.PasteBuilder;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeValidator;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance; import de.steamwar.linkage.LinkedInstance;
import de.steamwar.sql.Punishment; import de.steamwar.sql.Punishment;
@@ -40,7 +38,6 @@ import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.io.IOException;
import java.util.logging.Level; import java.util.logging.Level;
@Linked @Linked
@@ -61,7 +58,7 @@ public class ResetCommand extends SWCommand {
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL))) PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL)))
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor()); .color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL); region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
for (Flag value : Flag.values()) { for (Flag value : Flag.getResetFlags()) {
region.set(value, value.getDefaultValue()); region.set(value, value.getDefaultValue());
} }
RegionUtils.message(region, "REGION_RESET_RESETED"); RegionUtils.message(region, "REGION_RESET_RESETED");
@@ -24,14 +24,13 @@ import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.script.ScriptRunner; import de.steamwar.bausystem.features.script.ScriptRunner;
import de.steamwar.bausystem.features.script.lua.SteamWarGlobalLuaPlugin; import de.steamwar.bausystem.features.script.lua.SteamWarGlobalLuaPlugin;
import de.steamwar.bausystem.features.script.lua.libs.StorageLib; import de.steamwar.bausystem.features.script.lua.libs.StorageLib;
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@@ -71,10 +70,11 @@ public class EventListener implements Listener {
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
StorageLib.removePlayer(event.getPlayer()); if(Permission.BUILD.hasPermission(event.getPlayer())) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.SelfLeave, LuaValue.NIL, event); ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.SelfLeave, LuaValue.NIL, event);
} }
StorageLib.removePlayer(event.getPlayer());
}
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onPlayerSwapHandItems(PlayerSwapHandItemsEvent event) { public void onPlayerSwapHandItems(PlayerSwapHandItemsEvent event) {
@@ -146,7 +146,7 @@ public class EventListener implements Listener {
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onEntitySpawn(EntitySpawnEvent event) { public void onEntitySpawn(EntitySpawnEvent event) {
if (event.getEntityType() != EntityType.PRIMED_TNT) { if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) {
return; return;
} }
Region tntRegion = Region.getRegion(event.getLocation()); Region tntRegion = Region.getRegion(event.getLocation());
@@ -161,7 +161,7 @@ public class EventListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void onEntityExplode(EntityExplodeEvent event) { public void onEntityExplode(EntityExplodeEvent event) {
if (event.getEntityType() != EntityType.PRIMED_TNT) { if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) {
return; return;
} }
Region tntRegion = Region.getRegion(event.getLocation()); Region tntRegion = Region.getRegion(event.getLocation());
@@ -20,7 +20,6 @@
package de.steamwar.bausystem.features.simulator; package de.steamwar.bausystem.features.simulator;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.features.simulator.data.Simulator; import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.execute.SimulatorExecutor; import de.steamwar.bausystem.features.simulator.execute.SimulatorExecutor;
@@ -63,15 +62,7 @@ public class SimulatorCommand extends SWCommand {
} }
@Register(value = "copy", description = "SIMULATOR_COPY_HELP") @Register(value = "copy", description = "SIMULATOR_COPY_HELP")
public void copy(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator, String name) { public void copy(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator, @Validator("simulatorName") String name) {
if (SimulatorStorage.getSimulator(name) != null) {
BauSystem.MESSAGE.send("SIMULATOR_NAME_ALREADY_EXISTS", p);
return;
}
if (!name.matches("[a-zA-Z_0-9-]+")) {
BauSystem.MESSAGE.send("SIMULATOR_NAME_INVALID", p);
return;
}
if (!SimulatorStorage.copy(simulator, name)) { if (!SimulatorStorage.copy(simulator, name)) {
BauSystem.MESSAGE.send("SIMULATOR_ERROR_COPY", p); BauSystem.MESSAGE.send("SIMULATOR_ERROR_COPY", p);
} }
@@ -88,6 +79,17 @@ public class SimulatorCommand extends SWCommand {
SimulatorExecutor.run(simulator); SimulatorExecutor.run(simulator);
} }
@Register(value = "rename", description = "SIMULATOR_RENAME_HELP")
public void rename(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator, @Validator("simulatorName") String name) {
String oldName = simulator.getName();
if (SimulatorStorage.copy(simulator, name)) {
SimulatorStorage.delete(simulator);
BauSystem.MESSAGE.send("SIMULATOR_RENAMED", p, oldName, name);
} else {
BauSystem.MESSAGE.send("SIMULATOR_ERROR_COPY", p);
}
}
@ClassMapper(value = Simulator.class, local = true) @ClassMapper(value = Simulator.class, local = true)
public TypeMapper<Simulator> allSimulators() { public TypeMapper<Simulator> allSimulators() {
return new TypeMapper<>() { return new TypeMapper<>() {
@@ -102,4 +104,19 @@ public class SimulatorCommand extends SWCommand {
} }
}; };
} }
@Validator(value = "simulatorName", local = true)
public TypeValidator<String> simulatorName() {
return (commandSender, name, messageSender) -> {
if (SimulatorStorage.getSimulator(name) != null) {
messageSender.send("SIMULATOR_NAME_ALREADY_EXISTS");
return false;
}
if (!name.matches("[a-zA-Z_0-9-]+")) {
messageSender.send("SIMULATOR_NAME_INVALID");
return false;
}
return true;
};
}
} }
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.features.simulator; package de.steamwar.bausystem.features.simulator;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
@@ -72,9 +72,9 @@ import java.util.stream.Collectors;
public class SimulatorCursor implements Listener { public class SimulatorCursor implements Listener {
private final World WORLD = Bukkit.getWorlds().get(0); private final World WORLD = Bukkit.getWorlds().get(0);
private Class<?> position = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPosition"); private Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
private Class<?> look = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInLook"); private Class<?> look = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Rot");
private Class<?> positionLook = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPositionLook"); private Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
private Map<Player, CursorType> cursorType = Collections.synchronizedMap(new HashMap<>()); private Map<Player, CursorType> cursorType = Collections.synchronizedMap(new HashMap<>());
private Map<Player, REntityServer> cursors = Collections.synchronizedMap(new HashMap<>()); private Map<Player, REntityServer> cursors = Collections.synchronizedMap(new HashMap<>());
@@ -44,6 +44,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Linked @Linked
@MinVersion(19) @MinVersion(19)
@@ -130,7 +131,7 @@ public class SimulatorStorage implements Enable {
} }
public static void openSimulatorSelector(Player player) { public static void openSimulatorSelector(Player player) {
SimulatorPageGui<Simulator> simulatorPageGui = new SimulatorPageGui<Simulator>(player, null, 6 * 9, new ArrayList<>(simulatorMap.values())) { SimulatorPageGui<Simulator> simulatorPageGui = new SimulatorPageGui<Simulator>(player, null, 6 * 9, simulatorMap.values().stream().sorted(Comparator.comparing(Simulator::getName)).collect(Collectors.toList())) {
@Override @Override
public String baseTitle() { public String baseTitle() {
return "Simulators"; return "Simulators";
@@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.simulator.gui.base;
import de.steamwar.bausystem.features.simulator.SimulatorWatcher; import de.steamwar.bausystem.features.simulator.SimulatorWatcher;
import de.steamwar.bausystem.features.simulator.data.Simulator; import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@@ -69,7 +70,7 @@ public abstract class SimulatorBaseGui {
return; return;
} }
player.getOpenInventory().close(); player.closeInventory();
inventory = new SWInventory(player, () -> { inventory = new SWInventory(player, () -> {
inv = Bukkit.createInventory(null, size, title()); inv = Bukkit.createInventory(null, size, title());
@@ -24,6 +24,7 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox; import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid; import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
import de.steamwar.bausystem.features.tracer.TNTPoint; 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.TraceManager;
import de.steamwar.bausystem.region.Point; import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.utils.FlatteningWrapper; import de.steamwar.bausystem.utils.FlatteningWrapper;
@@ -34,7 +35,6 @@ import org.bukkit.util.Vector;
import java.util.*; import java.util.*;
import java.util.function.BiPredicate; import java.util.function.BiPredicate;
import java.util.stream.Collectors;
public class ProcessingTracesState implements LaufbauState { public class ProcessingTracesState implements LaufbauState {
@@ -45,8 +45,9 @@ public class ProcessingTracesState implements LaufbauState {
private final List<BlockBoundingBox> elements; private final List<BlockBoundingBox> elements;
private final int factor; private final int factor;
private final List<TNTPoint> TNTPoints; private final List<Trace> Traces;
private final int totalTntRecords; private final List<TNTPoint> TNTPoints = new ArrayList<>();
private final int totalTraces;
private final Set<Point> affectedBlocks = new HashSet<>(); private final Set<Point> affectedBlocks = new HashSet<>();
private final Map<Point, Set<Cuboid>> cuboidsPerChunk = new HashMap<>(); private final Map<Point, Set<Cuboid>> cuboidsPerChunk = new HashMap<>();
@@ -58,18 +59,13 @@ public class ProcessingTracesState implements LaufbauState {
this.elements = elements; this.elements = elements;
this.factor = factor; this.factor = factor;
// TODO: Optimize only retrieving traces inside of the affected regions! Traces = new ArrayList<>(TraceManager.instance.getAll());
TNTPoints = TraceManager.instance.getAll() totalTraces = Traces.size();
.stream()
.flatMap(trace -> trace.getHistories().stream())
.flatMap(Collection::stream)
.collect(Collectors.toList());
totalTntRecords = TNTPoints.size();
} }
@Override @Override
public String actionBarMessage(Player p) { public String actionBarMessage(Player p) {
return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_PROCESSING_TRACES", p), totalTntRecords - TNTPoints.size(), totalTntRecords, eta(p, start, totalTntRecords - TNTPoints.size(), totalTntRecords)); return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_PROCESSING_TRACES", p), totalTraces - Traces.size(), totalTraces, eta(p, start, totalTraces - Traces.size(), totalTraces));
} }
private boolean inRegion(Vector location, int expansion) { private boolean inRegion(Vector location, int expansion) {
@@ -78,11 +74,17 @@ public class ProcessingTracesState implements LaufbauState {
@Override @Override
public boolean hasNext() { public boolean hasNext() {
return !TNTPoints.isEmpty(); return !Traces.isEmpty() || !TNTPoints.isEmpty();
} }
@Override @Override
public void next() { public void next() {
if (TNTPoints.isEmpty()) {
Trace trace = Traces.remove(0);
trace.getHistories().stream().flatMap(Collection::stream).forEach(TNTPoints::add);
return;
}
TNTPoint current = TNTPoints.remove(0); TNTPoint current = TNTPoints.remove(0);
if (FlatteningWrapper.impl.inWater(world, current.getLocation().toVector())) return; if (FlatteningWrapper.impl.inWater(world, current.getLocation().toVector())) return;
if (!(inRegion(current.getLocation().toVector(), 1) || (current.getPrevious().isPresent() && inRegion(current.getPrevious().get().getLocation().toVector(), 1)))) if (!(inRegion(current.getLocation().toVector(), 1) || (current.getPrevious().isPresent() && inRegion(current.getPrevious().get().getLocation().toVector(), 1))))
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.features.smartplace; package de.steamwar.bausystem.features.smartplace;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
@@ -81,7 +81,7 @@ public class SmartPlaceListener implements Listener {
IGNORED.remove(Material.BARRIER); IGNORED.remove(Material.BARRIER);
} }
private static final Class<?> useItem = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUseItem"); private static final Class<?> useItem = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundUseItemOnPacket");
private static final Set<Player> SMART_PLACING = new HashSet<>(); private static final Set<Player> SMART_PLACING = new HashSet<>();
private static final Set<Player> WAS_EXECUTED = new HashSet<>(); private static final Set<Player> WAS_EXECUTED = new HashSet<>();
@@ -23,6 +23,8 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.Point; import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.core.TrickyParticleWrapper;
import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Particle; import org.bukkit.Particle;
@@ -56,7 +58,7 @@ public class BoundaryViewer implements Listener {
} }
private void showRegion(Region region, Player player) { private void showRegion(Region region, Player player) {
drawCuboid(player, Particle.VILLAGER_HAPPY, region.getMinPoint(), region.getMaxPoint()); drawCuboid(player, TrickyParticleWrapper.impl.getVillagerHappy(), region.getMinPoint(), region.getMaxPoint());
if (region.hasType(RegionType.TESTBLOCK)) { if (region.hasType(RegionType.TESTBLOCK)) {
drawCuboid(player, Particle.END_ROD, region.getMinPointTestblockExtension(), region.getMaxPointTestblockExtension()); drawCuboid(player, Particle.END_ROD, region.getMinPointTestblockExtension(), region.getMaxPointTestblockExtension());
} }
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.features.tpslimit; package de.steamwar.bausystem.features.tpslimit;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.core.BountifulWrapper; import de.steamwar.core.BountifulWrapper;
import de.steamwar.core.ChatWrapper; import de.steamwar.core.ChatWrapper;
@@ -45,18 +45,18 @@ class PacketCache {
private static Set<Entity> entities = new HashSet<>(); private static Set<Entity> entities = new HashSet<>();
private static BukkitTask task = null; private static BukkitTask task = null;
private static Class<?> vec3dClass = Reflection.getClass("{nms.world.phys}.Vec3D"); private static Class<?> vec3dClass = Reflection.getClass("net.minecraft.world.phys.Vec3");
private static Reflection.FieldAccessor<Object> zeroVec3d = (Reflection.FieldAccessor<Object>) Reflection.getField(vec3dClass, vec3dClass, 0); private static Reflection.Field<Object> zeroVec3d = (Reflection.Field<Object>) Reflection.getField(vec3dClass, vec3dClass, 0);
private static Object ZERO_VEC3D = zeroVec3d.get(null); private static Object ZERO_VEC3D = zeroVec3d.get(null);
private static Class<?> velocityPacketClass = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityVelocity"); private static Class<?> velocityPacketClass = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket");
private static Reflection.ConstructorInvoker velocityPacketConstructor = Reflection.getConstructor(velocityPacketClass, int.class, vec3dClass); private static Reflection.Constructor velocityPacketConstructor = Reflection.getConstructor(velocityPacketClass, int.class, vec3dClass);
private static Class<?> teleportPacketClass = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityTeleport"); private static Class<?> teleportPacketClass = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket");
private static Class<?> entityClass = Reflection.getClass("{nms.world.entity}.Entity"); private static Class<?> entityClass = Reflection.getClass("net.minecraft.world.entity.Entity");
private static Reflection.ConstructorInvoker teleportPacketConstructor = Reflection.getConstructor(teleportPacketClass, entityClass); private static Reflection.Constructor teleportPacketConstructor = Reflection.getConstructor(teleportPacketClass, entityClass);
private static Class<?> craftEntityClass = Reflection.getClass("{obc}.entity.CraftEntity"); private static Class<?> craftEntityClass = Reflection.getClass("org.bukkit.craftbukkit.entity.CraftEntity");
private static Reflection.MethodInvoker getHandle = Reflection.getMethod(craftEntityClass, "getHandle"); private static Reflection.Method getHandle = Reflection.getMethod(craftEntityClass, "getHandle");
private static Object noGravityDataWatcher = BountifulWrapper.impl.getDataWatcherObject(5, Boolean.class); private static Object noGravityDataWatcher = BountifulWrapper.impl.getDataWatcherObject(5, Boolean.class);
private static Object fuseDataWatcher = BountifulWrapper.impl.getDataWatcherObject(8, Integer.class); private static Object fuseDataWatcher = BountifulWrapper.impl.getDataWatcherObject(8, Integer.class);
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.features.tpslimit; package de.steamwar.bausystem.features.tpslimit;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import lombok.Getter; import lombok.Getter;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@@ -28,11 +28,11 @@ import org.bukkit.World;
@UtilityClass @UtilityClass
public class TPSFreezeUtils { public class TPSFreezeUtils {
private static Reflection.FieldAccessor<Boolean> fieldAccessor; private static Reflection.Field<Boolean> fieldAccessor;
@Getter @Getter
private static final boolean canFreeze; private static final boolean canFreeze;
private static final Reflection.MethodInvoker getWorldHandle = Reflection.getTypedMethod(Reflection.getClass("{obc}.CraftWorld"), "getHandle", null); private static final Reflection.Method getWorldHandle = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.CraftWorld"), "getHandle", null);
@Getter @Getter
private static boolean frozen = false; private static boolean frozen = false;
@@ -40,9 +40,9 @@ public class TPSFreezeUtils {
private static final World world = Bukkit.getWorlds().get(0); private static final World world = Bukkit.getWorlds().get(0);
static { static {
Reflection.FieldAccessor<Boolean> fieldAccessor; Reflection.Field<Boolean> fieldAccessor;
try { try {
fieldAccessor = Reflection.getField(Reflection.getClass("{nms.server.level}.WorldServer"), "freezed", boolean.class); fieldAccessor = Reflection.getField(Reflection.getClass("net.minecraft.server.level.ServerLevel"), "freezed", boolean.class);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
fieldAccessor = null; fieldAccessor = null;
} }
@@ -19,15 +19,12 @@
package de.steamwar.bausystem.features.tpslimit; package de.steamwar.bausystem.features.tpslimit;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.utils.PlayerMovementWrapper; import de.steamwar.bausystem.utils.PlayerMovementWrapper;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.core.TPSWatcher;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
@@ -104,8 +101,8 @@ public class TPSLimitUtils {
} }
*/ */
private static final Class<?> position = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPosition"); private static final Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
private static final Class<?> positionLook = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPositionLook"); private static final Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
static { static {
BiFunction<Player, Object, Object> positionSetter = (player, o) -> { BiFunction<Player, Object, Object> positionSetter = (player, o) -> {
if (tpsLimiter != null) { if (tpsLimiter != null) {
@@ -22,6 +22,8 @@ package de.steamwar.bausystem.features.tracer;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.bausystem.region.utils.RegionType;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
@@ -39,8 +41,9 @@ import java.util.Optional;
/** /**
* Recording of a tnt at a specific tick * Recording of a tnt at a specific tick
*/ */
@AllArgsConstructor(access = AccessLevel.PACKAGE)
@Getter @Getter
public class TNTPoint implements Externalizable { public class TNTPoint{
/** /**
* Unique number to identify records being of the same tnt * Unique number to identify records being of the same tnt
*/ */
@@ -97,12 +100,9 @@ public class TNTPoint implements Externalizable {
private List<TNTPoint> history; private List<TNTPoint> history;
/** /**
* Constructor for deserialization only !! Do not Call !! * Constructor for object creation in trace recording
*/ */
public TNTPoint() { protected TNTPoint(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart,
}
public TNTPoint(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart,
List<TNTPoint> history, List<Block> destroyedBlocks) { List<TNTPoint> history, List<Block> destroyedBlocks) {
this.tntId = tntId; this.tntId = tntId;
this.explosion = explosion; this.explosion = explosion;
@@ -161,44 +161,6 @@ public class TNTPoint implements Externalizable {
this.history = history; this.history = history;
} }
@Override
public void writeExternal(ObjectOutput objectOutput) throws IOException {
objectOutput.writeInt(tntId);
objectOutput.writeBoolean(explosion);
objectOutput.writeBoolean(inWater);
objectOutput.writeBoolean(afterFirstExplosion);
objectOutput.writeBoolean(destroyedBuildArea);
objectOutput.writeBoolean(destroyedTestBlock);
objectOutput.writeLong(ticksSinceStart);
objectOutput.writeInt(fuse);
objectOutput.writeDouble(location.getX());
objectOutput.writeDouble(location.getY());
objectOutput.writeDouble(location.getZ());
objectOutput.writeDouble(velocity.getX());
objectOutput.writeDouble(velocity.getY());
objectOutput.writeDouble(velocity.getZ());
}
@Override
public void readExternal(ObjectInput objectInput) throws IOException {
tntId = objectInput.readInt();
explosion = objectInput.readBoolean();
inWater = objectInput.readBoolean();
afterFirstExplosion = objectInput.readBoolean();
destroyedBuildArea = objectInput.readBoolean();
destroyedTestBlock = objectInput.readBoolean();
ticksSinceStart = objectInput.readLong();
fuse = objectInput.readInt();
double locX = objectInput.readDouble();
double locY = objectInput.readDouble();
double locZ = objectInput.readDouble();
location = new Location(Bukkit.getWorlds().get(0), locX, locY, locZ);
double velX = objectInput.readDouble();
double velY = objectInput.readDouble();
double velZ = objectInput.readDouble();
velocity = new Vector(velX, velY, velZ);
}
@Override @Override
public String toString() { public String toString() {
return "TNTPoint{" + return "TNTPoint{" +
@@ -26,20 +26,16 @@ import de.steamwar.bausystem.features.tracer.rendering.ViewFlag;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.entity.REntity; import de.steamwar.entity.REntity;
import de.steamwar.entity.REntityServer; import de.steamwar.entity.REntityServer;
import lombok.Cleanup;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.io.*; import java.io.File;
import java.lang.ref.SoftReference; import java.lang.ref.SoftReference;
import java.util.*; import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import java.util.zip.GZIPInputStream;
public class Trace { public class Trace {
/** /**
@@ -77,6 +73,10 @@ public class Trace {
*/ */
private SoftReference<List<TNTPoint>> records; private SoftReference<List<TNTPoint>> records;
@Setter
@Getter
private int recordsCount;
/** /**
* A map of all REntityServers rendering this trace * A map of all REntityServers rendering this trace
*/ */
@@ -91,46 +91,25 @@ public class Trace {
@SneakyThrows @SneakyThrows
public Trace(Region region, List<TNTPoint> recordList) { public Trace(Region region, List<TNTPoint> recordList) {
this.uuid = UUID.randomUUID(); this.uuid = UUID.randomUUID();
recordsSaveFile = new File(TraceManager.tracesFolder, uuid + ".records");
this.region = region; this.region = region;
this.date = new Date(); this.date = new Date();
records = new SoftReference<>(recordList); records = new SoftReference<>(recordList);
metadataSaveFile = new File(TraceManager.tracesFolder, uuid + ".meta"); recordsSaveFile = new File(TraceRepository.tracesFolder, uuid + ".records");
metadataSaveFile = new File(TraceRepository.tracesFolder, uuid + ".meta");
@Cleanup
ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(metadataSaveFile));
outputStream.writeUTF(uuid.toString());
outputStream.writeUTF(region.getName());
outputStream.writeObject(date);
} }
/** /**
* Constructor for serialising a trace from the file system * Constructor for deserialising a trace from the file system
*
* @param metadataSaveFile the file for this traces metadata
*/ */
@SneakyThrows @SneakyThrows
public Trace(File metadataSaveFile) { protected Trace(UUID uuid, Region region, Date date, File metadataFile, File recordsFile, int recordsCount) {
String uuid = null; this.metadataSaveFile = metadataFile;
Region region = null; recordsSaveFile = recordsFile;
Date date = null; this.uuid = uuid;
this.metadataSaveFile = metadataSaveFile;
try {
@Cleanup
ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(metadataSaveFile));
uuid = inputStream.readUTF();
region = Region.getREGION_MAP().get(inputStream.readUTF());
date = (Date) inputStream.readObject();
inputStream.close();
} finally {
this.uuid = UUID.fromString(uuid);
this.region = region; this.region = region;
this.date = date; this.date = date;
recordsSaveFile = new File(TraceManager.tracesFolder, uuid + ".records");
this.records = new SoftReference<>(null); this.records = new SoftReference<>(null);
} this.recordsCount = recordsCount;
} }
/** /**
@@ -173,7 +152,8 @@ public class Trace {
entityServer = new REntityServer(); entityServer = new REntityServer();
entityServer.addPlayer(player); entityServer.addPlayer(player);
entityServer.setCallback((p, rEntity, entityAction) -> { entityServer.setCallback((p, rEntity, entityAction) -> {
if (entityAction != REntityServer.EntityAction.INTERACT) return; if (entityAction != REntityServer.EntityAction.INTERACT)
return;
if (rEntity instanceof TraceEntity) { if (rEntity instanceof TraceEntity) {
((TraceEntity) rEntity).printIntoChat(p); ((TraceEntity) rEntity).printIntoChat(p);
} }
@@ -195,7 +175,8 @@ public class Trace {
REntityServer newEntityServer = new REntityServer(); REntityServer newEntityServer = new REntityServer();
newEntityServer.addPlayer(k); newEntityServer.addPlayer(k);
newEntityServer.setCallback((p, rEntity, entityAction) -> { newEntityServer.setCallback((p, rEntity, entityAction) -> {
if (entityAction != REntityServer.EntityAction.INTERACT) return; if (entityAction != REntityServer.EntityAction.INTERACT)
return;
if (rEntity instanceof TraceEntity) { if (rEntity instanceof TraceEntity) {
((TraceEntity) rEntity).printIntoChat(p); ((TraceEntity) rEntity).printIntoChat(p);
} }
@@ -234,7 +215,8 @@ public class Trace {
List<TraceEntity> entities = new LinkedList<>(); List<TraceEntity> entities = new LinkedList<>();
for (List<TNTPoint> bundle : bundles) { for (List<TNTPoint> bundle : bundles) {
entities.add(new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle, this)); entities.add(new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle,
this));
} }
// Apply modifiers // Apply modifiers
@@ -312,38 +294,7 @@ public class Trace {
* Loads the records of this trace from storage to memory * Loads the records of this trace from storage to memory
*/ */
private void loadRecords() { private void loadRecords() {
List<TNTPoint> records = new ArrayList<>(); records = new SoftReference<>(TraceRepository.readTraceRecords(this));
long readBytes = 0;
try {
FileInputStream fileInputStream = new FileInputStream(recordsSaveFile);
@Cleanup
ObjectInputStream inputStream = new ObjectInputStream(new GZIPInputStream(fileInputStream));
long fileLenght = recordsSaveFile.length();
while (fileInputStream.getChannel().position() < fileLenght) {
records.add((TNTPoint) inputStream.readObject());
readBytes = fileInputStream.getChannel().position();
}
} catch (EOFException e) {
Logger logger = Bukkit.getLogger();
logger.log(Level.WARNING, "EOF in trace read detected in " + uuid);
logger.log(Level.WARNING, "Read " + readBytes + "/" + recordsSaveFile.length() + " Bytes");
logger.log(Level.WARNING, "Read so far: " + records);
e.printStackTrace();
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
}
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);
}
this.records = new SoftReference<>(records);
} }
public synchronized List<TNTPoint> getRecords() { public synchronized List<TNTPoint> getRecords() {
@@ -360,6 +311,7 @@ public class Trace {
", region=" + region + ", region=" + region +
", creationTime=" + date + ", creationTime=" + date +
", recordsSaveFile=" + recordsSaveFile.getName() + ", recordsSaveFile=" + recordsSaveFile.getName() +
", recordCount=" + recordsCount +
", records=" + getRecords() + ", records=" + getRecords() +
'}'; '}';
} }
@@ -30,11 +30,14 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.PluginEnableEvent;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static de.steamwar.bausystem.features.tracer.TraceRepository.tracesFolder;
@Linked @Linked
public class TraceManager implements Listener { public class TraceManager implements Listener {
@@ -44,9 +47,9 @@ public class TraceManager implements Listener {
instance = this; instance = this;
} }
public static File tracesFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "traces");
public TraceManager() {
public void init() {
if (!tracesFolder.exists()) if (!tracesFolder.exists())
tracesFolder.mkdir(); tracesFolder.mkdir();
@@ -58,7 +61,15 @@ public class TraceManager implements Listener {
if (traceFile.getName().contains(".records")) if (traceFile.getName().contains(".records"))
continue; continue;
add(new Trace(traceFile)); 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();
}
} }
} }
@@ -131,17 +142,18 @@ public class TraceManager implements Listener {
* *
* @param trace the trace to be removed * @param trace the trace to be removed
*/ */
public boolean remove(Trace trace) { public void remove(Trace trace) {
Map<Integer, Trace> traces = tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap()); Map<Integer, Trace> traces = tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap());
Integer traceId = traces.entrySet().stream() Integer traceId = traces.entrySet().stream()
.filter(entry -> entry.getValue() == trace) .filter(entry -> entry.getValue() == trace)
.map(Map.Entry::getKey) .map(Map.Entry::getKey)
.findFirst() .findFirst()
.orElse(null); .orElse(null);
if (traceId == null) return false; if (traceId == null) throw new RuntimeException("Trace not found while trying to remove see (c978eb98-b0b2-4009-91d8-acfa34e2831a)");
traces.remove(traceId); traces.remove(traceId);
trace.hide(); trace.hide();
return true; trace.getMetadataSaveFile().delete();
trace.getRecordsSaveFile().delete();
} }
/** /**
@@ -31,6 +31,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.server.PluginEnableEvent;
import java.util.*; import java.util.*;
import java.util.logging.Level; import java.util.logging.Level;
@@ -70,7 +71,7 @@ public class TraceRecorder implements Listener {
*/ */
private final Set<Region> autoTraceRegions = new HashSet<>(); private final Set<Region> autoTraceRegions = new HashSet<>();
public TraceRecorder() { public void init() {
BauSystem.runTaskTimer(BauSystem.getInstance(), () -> { BauSystem.runTaskTimer(BauSystem.getInstance(), () -> {
record(); record();
checkForAutoTraceFinish(); checkForAutoTraceFinish();
@@ -170,8 +171,7 @@ public class TraceRecorder implements Listener {
if (history.size() == 0) { if (history.size() == 0) {
try { try {
historyMap.put(tntPrimed, history); historyMap.put(tntPrimed, history);
} } catch (NullPointerException e) {
catch (NullPointerException e) {
Logger logger = Bukkit.getLogger(); Logger logger = Bukkit.getLogger();
//TODO remove when no longer neccecary //TODO remove when no longer neccecary
logger.log(Level.WARNING, "Nullpointer thrown by historyMap"); logger.log(Level.WARNING, "Nullpointer thrown by historyMap");
@@ -24,28 +24,22 @@ import de.steamwar.bausystem.region.Region;
import lombok.Getter; import lombok.Getter;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.zip.GZIPOutputStream;
public class TraceRecordingWrapper { public class TraceRecordingWrapper {
@Getter
private final Trace trace;
@Getter @Getter
private final long startTick; private final long startTick;
private final List<TNTPoint> recordsToAdd; private final List<TNTPoint> recordsToAdd;
private final List<TNTPoint> recordList; private final List<TNTPoint> recordList;
private final ObjectOutputStream recordsOutputStream;
private int nextOpenRecordId = 0; private int nextOpenRecordId = 0;
@Getter @Getter
private boolean explosionRecorded = false; private boolean explosionRecorded = false;
@Getter
private final Trace trace;
@SneakyThrows @SneakyThrows
public TraceRecordingWrapper(Region region) { public TraceRecordingWrapper(Region region) {
startTick = TPSUtils.currentRealTick.get(); startTick = TPSUtils.currentRealTick.get();
@@ -53,8 +47,6 @@ public class TraceRecordingWrapper {
recordList = new ArrayList<>(); recordList = new ArrayList<>();
trace = new Trace(region, recordList); trace = new Trace(region, recordList);
File recordsSaveFile = new File(TraceManager.tracesFolder, trace.getUuid() + ".records");
recordsOutputStream = new ObjectOutputStream(new GZIPOutputStream(new FileOutputStream(recordsSaveFile)));
} }
public int getNextOpenRecordIdAndIncrement() { public int getNextOpenRecordIdAndIncrement() {
@@ -72,23 +64,14 @@ public class TraceRecordingWrapper {
public void commitRecorded() { public void commitRecorded() {
TraceManager.instance.showPartial(trace, recordsToAdd); TraceManager.instance.showPartial(trace, recordsToAdd);
recordsToAdd.forEach(record -> {
try {
recordsOutputStream.writeObject(record);
recordsOutputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
});
recordList.addAll(recordsToAdd); recordList.addAll(recordsToAdd);
trace.setRecordsCount(recordList.size());
recordsToAdd.clear(); recordsToAdd.clear();
} }
@SneakyThrows @SneakyThrows
protected void finalizeRecording() { protected void finalizeRecording() {
recordsOutputStream.flush(); TraceRepository.writeTrace(trace, recordList);
recordsOutputStream.close();
TraceManager.instance.add(trace); TraceManager.instance.add(trace);
} }
} }
@@ -0,0 +1,136 @@
package de.steamwar.bausystem.features.tracer;
import de.steamwar.bausystem.region.Region;
import lombok.Cleanup;
import lombok.SneakyThrows;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.util.Vector;
import java.io.*;
import java.util.*;
public class TraceRepository {
/**
* Increment this when changing serialisation format
*/
public static final int SERIALISATION_VERSION = 1;
public static File tracesFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "traces");
@SneakyThrows
protected static int getVersion(File metadataFile) {
@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));
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();
return new Trace(uuid, region, date, metadataFile, recordsFile, recordsCount);
}
@SneakyThrows
protected static void writeTrace(Trace trace, List<TNTPoint> records) {
ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(trace.getMetadataSaveFile()));
outputStream.writeUTF(trace.getUuid().toString());
outputStream.writeUTF(trace.getRegion().getName());
outputStream.writeObject(trace.getDate());
outputStream.writeInt(SERIALISATION_VERSION);
outputStream.writeInt(records.size());
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();
outputStream.writeDouble(location.getX());
outputStream.writeDouble(location.getY());
outputStream.writeDouble(location.getZ());
Vector velocity = record.getVelocity();
outputStream.writeDouble(velocity.getX());
outputStream.writeDouble(velocity.getY());
outputStream.writeDouble(velocity.getZ());
}
outputStream.flush();
outputStream.close();
}
@SneakyThrows
protected static TNTPoint readTraceRecord(DataInputStream 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();
double locX = objectInput.readDouble();
double locY = objectInput.readDouble();
double locZ = objectInput.readDouble();
Location location = new Location(Bukkit.getWorlds().get(0), locX, locY, locZ);
double velX = objectInput.readDouble();
double velY = objectInput.readDouble();
double velZ = objectInput.readDouble();
Vector velocity = new Vector(velX, velY, velZ);
return new TNTPoint(tntId, explosion, inWater, afterFirstExplosion, destroyedBuildArea, destroyedTestBlock, ticksSinceStart, fuse, location, velocity, Collections.emptyList());
}
@SneakyThrows
protected static List<TNTPoint> readTraceRecords(Trace trace) {
File recordsFile = trace.getRecordsSaveFile();
@Cleanup
DataInputStream inputStream = new DataInputStream(new FileInputStream(recordsFile));
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);
}
return records;
}
}
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.features.util; package de.steamwar.bausystem.features.util;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
@@ -49,15 +49,15 @@ import java.util.function.BiFunction;
@Linked @Linked
public class NoClipCommand extends SWCommand implements Listener { public class NoClipCommand extends SWCommand implements Listener {
public static final Class<?> gameStateChange = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutGameStateChange"); public static final Class<?> gameStateChange = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundGameEventPacket");
private static final Reflection.FieldAccessor<Float> floatFieldAccessor = Reflection.getField(gameStateChange, float.class, 0); private static final Reflection.Field<Float> floatFieldAccessor = Reflection.getField(gameStateChange, float.class, 0);
private static final Class<?> position = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPosition"); private static final Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
private static final Class<?> positionLook = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPositionLook"); private static final Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
private static final Class<?> useItem = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUseItem"); private static final Class<?> useItem = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundUseItemOnPacket");
private static final Class<?> blockDig = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInBlockDig"); private static final Class<?> blockDig = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundPlayerActionPacket");
private static final Class<?> windowClick = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInWindowClick"); private static final Class<?> windowClick = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundContainerClickPacket");
private static final Class<?> setSlotStack = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInSetCreativeSlot"); private static final Class<?> setSlotStack = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundSetCreativeModeSlotPacket");
@Getter @Getter
private static final List<Player> NOCLIPS = new ArrayList<>(); private static final List<Player> NOCLIPS = new ArrayList<>();
@@ -39,12 +39,12 @@ public class SpeedCommand extends SWCommand {
@Register @Register
public void speedCommand(Player p, float speed) { public void speedCommand(Player p, float speed) {
speed = speed / 10F; if (speed < -10F) {
if (speed < -1F) {
BauSystem.MESSAGE.send("SPEED_TOO_SMALL", p, speed); BauSystem.MESSAGE.send("SPEED_TOO_SMALL", p, speed);
} else if (speed > 1F) { } else if (speed > 10F) {
BauSystem.MESSAGE.send("SPEED_TOO_HIGH", p, speed); BauSystem.MESSAGE.send("SPEED_TOO_HIGH", p, speed);
} else { } else {
speed = speed / 10F;
p.setFlySpeed(speed); p.setFlySpeed(speed);
p.setWalkSpeed(Math.min(speed + 0.1F, 1F)); p.setWalkSpeed(Math.min(speed + 0.1F, 1F));
BauSystem.MESSAGE.send("SPEED_CURRENT", p, (p.getFlySpeed() * 10F)); BauSystem.MESSAGE.send("SPEED_CURRENT", p, (p.getFlySpeed() * 10F));
@@ -47,7 +47,6 @@ public class NightVisionBauGuiItem extends BauGuiItem {
PotionMeta meta = (PotionMeta) itemStack.getItemMeta(); PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
meta.setColor(PotionEffectType.NIGHT_VISION.getColor()); meta.setColor(PotionEffectType.NIGHT_VISION.getColor());
meta.setDisplayName(BauSystem.MESSAGE.parse("NIGHT_VISION_ITEM_ON", player)); meta.setDisplayName(BauSystem.MESSAGE.parse("NIGHT_VISION_ITEM_ON", player));
meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
meta.setCustomModelData(1); meta.setCustomModelData(1);
itemStack.setItemMeta(meta); itemStack.setItemMeta(meta);
return itemStack; return itemStack;
@@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.world; package de.steamwar.bausystem.features.world;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.core.CRIUWakeupEvent;
import de.steamwar.core.CheckpointUtils; import de.steamwar.core.CheckpointUtils;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@@ -69,4 +70,9 @@ public class AFKStopperListener implements Listener {
if(Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(event.getPlayer()))) if(Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(event.getPlayer())))
CheckpointUtils.freeze(); CheckpointUtils.freeze();
} }
@EventHandler
public void onCRIUWakeup(CRIUWakeupEvent event) {
lastMovementTime = System.currentTimeMillis();
}
} }
@@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.world;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.config.BauServer; import de.steamwar.bausystem.config.BauServer;
import de.steamwar.core.CRIUWakeupEvent;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import de.steamwar.sql.BauweltMember; import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
@@ -32,7 +33,6 @@ import org.bukkit.event.player.PlayerJoinEvent;
@Linked @Linked
public class AntiBauAddMemberFix implements Listener { public class AntiBauAddMemberFix implements Listener {
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
if (BauSystem.DEV_SERVER) return; if (BauSystem.DEV_SERVER) return;
@@ -44,4 +44,9 @@ public class AntiBauAddMemberFix implements Listener {
throw new SecurityException("The player " + event.getPlayer().getName() + " joined on the server of " + SteamwarUser.get(BauServer.getInstance().getOwnerID()).getUserName() + " without being added!"); throw new SecurityException("The player " + event.getPlayer().getName() + " joined on the server of " + SteamwarUser.get(BauServer.getInstance().getOwnerID()).getUserName() + " without being added!");
} }
} }
@EventHandler
public void onCRIUWakeup(CRIUWakeupEvent event) {
BauweltMember.clear();
}
} }
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.features.world; package de.steamwar.bausystem.features.world;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
@@ -32,7 +32,7 @@ public class AntiCursorReCentering implements Enable {
@Override @Override
public void enable() { public void enable() {
Class<?> closeWindow = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutCloseWindow"); Class<?> closeWindow = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundContainerClosePacket");
TinyProtocol.instance.addFilter(closeWindow, (player, object) -> { TinyProtocol.instance.addFilter(closeWindow, (player, object) -> {
if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CRAFTING) { if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CRAFTING) {
return object; return object;
@@ -56,7 +56,7 @@ public class BauScoreboard implements Listener {
public void handlePlayerJoin(PlayerJoinEvent event) { public void handlePlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
SWScoreboard.createScoreboard(player, new ScoreboardCallback() { SWScoreboard.impl.createScoreboard(player, new ScoreboardCallback() {
@Override @Override
public HashMap<String, Integer> getData() { public HashMap<String, Integer> getData() {
Region region = Region.getRegion(player.getLocation()); Region region = Region.getRegion(player.getLocation());
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.features.world; package de.steamwar.bausystem.features.world;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.utils.NMSWrapper; import de.steamwar.bausystem.utils.NMSWrapper;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
@@ -29,7 +29,7 @@ import org.bukkit.GameMode;
public class NoCreativeKnockback { public class NoCreativeKnockback {
public NoCreativeKnockback() { public NoCreativeKnockback() {
TinyProtocol.instance.addFilter(Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion"), (player, o) -> { TinyProtocol.instance.addFilter(Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket"), (player, o) -> {
if (player.getGameMode() != GameMode.CREATIVE) return o; if (player.getGameMode() != GameMode.CREATIVE) return o;
return NMSWrapper.impl.resetExplosionKnockback(o); return NMSWrapper.impl.resetExplosionKnockback(o);
}); });
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.features.world; package de.steamwar.bausystem.features.world;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
@@ -48,21 +48,21 @@ import org.bukkit.util.Vector;
@MinVersion(20) @MinVersion(20)
public class SignEditFrom20 implements Listener { public class SignEditFrom20 implements Listener {
private static final Class<?> blockPosition = Reflection.getClass("{nms.core}.BlockPosition"); private static final Class<?> blockPosition = Reflection.getClass("net.minecraft.core.BlockPos");
private static final Class<?> craftBlock = Reflection.getClass("{obc}.block.CraftBlock"); private static final Class<?> craftBlock = Reflection.getClass("org.bukkit.craftbukkit.block.CraftBlock");
private static final Class<?> craftWorld = Reflection.getClass("{obc}.CraftWorld"); private static final Class<?> craftWorld = Reflection.getClass("org.bukkit.craftbukkit.CraftWorld");
private static final Class<?> generatorAccess = Reflection.getClass("{nms.world.level}.GeneratorAccess"); private static final Class<?> generatorAccess = Reflection.getClass("net.minecraft.world.level.LevelAccessor");
private static final Reflection.MethodInvoker getPosition = Reflection.getTypedMethod(craftBlock, "getPosition", blockPosition); private static final Reflection.Method getPosition = Reflection.getTypedMethod(craftBlock, "getPosition", blockPosition);
private static final Reflection.MethodInvoker getWorldHandle = Reflection.getTypedMethod(craftWorld, "getHandle", null); private static final Reflection.Method getWorldHandle = Reflection.getTypedMethod(craftWorld, "getHandle", null);
private static final Reflection.MethodInvoker at = Reflection.getTypedMethod(craftBlock, "at", craftBlock, generatorAccess, blockPosition); private static final Reflection.Method at = Reflection.getTypedMethod(craftBlock, "at", craftBlock, generatorAccess, blockPosition);
private static final Class<?> openSign = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutOpenSignEditor"); private static final Class<?> openSign = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundOpenSignEditorPacket");
private static final Reflection.FieldAccessor<?> blockPositionFieldAccessor = Reflection.getField(openSign, blockPosition, 0); private static final Reflection.Field<?> blockPositionFieldAccessor = Reflection.getField(openSign, blockPosition, 0);
private static final Reflection.FieldAccessor<?> sideFieldAccessor = Reflection.getField(openSign, boolean.class, 0); private static final Reflection.Field<?> sideFieldAccessor = Reflection.getField(openSign, boolean.class, 0);
private static final Class<?> updateSign = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUpdateSign"); private static final Class<?> updateSign = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundSignUpdatePacket");
private static final Reflection.FieldAccessor<?> getBlockPositionFieldAccessor = Reflection.getField(updateSign, blockPosition, 0); private static final Reflection.Field<?> getBlockPositionFieldAccessor = Reflection.getField(updateSign, blockPosition, 0);
private static final Reflection.FieldAccessor<String[]> stringFieldAccessor = Reflection.getField(updateSign, String[].class, 0); private static final Reflection.Field<String[]> stringFieldAccessor = Reflection.getField(updateSign, String[].class, 0);
@EventHandler @EventHandler
public void editSign(PlayerInteractEvent event) { public void editSign(PlayerInteractEvent event) {
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.features.world; package de.steamwar.bausystem.features.world;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
@@ -40,20 +40,20 @@ import org.bukkit.event.player.PlayerInteractEvent;
@MaxVersion(19) @MaxVersion(19)
public class SignEditUntil19 implements Listener { public class SignEditUntil19 implements Listener {
private static final Class<?> blockPosition = Reflection.getClass("{nms.core}.BlockPosition"); private static final Class<?> blockPosition = Reflection.getClass("net.minecraft.core.BlockPos");
private static final Class<?> craftBlock = Reflection.getClass("{obc}.block.CraftBlock"); private static final Class<?> craftBlock = Reflection.getClass("org.bukkit.craftbukkit.block.CraftBlock");
private static final Class<?> craftWorld = Reflection.getClass("{obc}.CraftWorld"); private static final Class<?> craftWorld = Reflection.getClass("org.bukkit.craftbukkit.CraftWorld");
private static final Class<?> generatorAccess = Reflection.getClass("{nms.world.level}.GeneratorAccess"); private static final Class<?> generatorAccess = Reflection.getClass("net.minecraft.world.level.LevelAccessor");
private static final Reflection.MethodInvoker getPosition = Reflection.getTypedMethod(craftBlock, "getPosition", blockPosition); private static final Reflection.Method getPosition = Reflection.getTypedMethod(craftBlock, "getPosition", blockPosition);
private static final Reflection.MethodInvoker getWorldHandle = Reflection.getTypedMethod(craftWorld, "getHandle", null); private static final Reflection.Method getWorldHandle = Reflection.getTypedMethod(craftWorld, "getHandle", null);
private static final Reflection.MethodInvoker at = Reflection.getTypedMethod(craftBlock, "at", craftBlock, generatorAccess, blockPosition); private static final Reflection.Method at = Reflection.getTypedMethod(craftBlock, "at", craftBlock, generatorAccess, blockPosition);
private static final Class<?> openSign = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutOpenSignEditor"); private static final Class<?> openSign = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundOpenSignEditorPacket");
private static final Reflection.FieldAccessor<?> blockPositionFieldAccessor = Reflection.getField(openSign, blockPosition, 0); private static final Reflection.Field<?> blockPositionFieldAccessor = Reflection.getField(openSign, blockPosition, 0);
private static final Class<?> updateSign = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUpdateSign"); private static final Class<?> updateSign = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundSignUpdatePacket");
private static final Reflection.FieldAccessor<?> getBlockPositionFieldAccessor = Reflection.getField(updateSign, blockPosition, 0); private static final Reflection.Field<?> getBlockPositionFieldAccessor = Reflection.getField(updateSign, blockPosition, 0);
private static final Reflection.FieldAccessor<String[]> stringFieldAccessor = Reflection.getField(updateSign, String[].class, 0); private static final Reflection.Field<String[]> stringFieldAccessor = Reflection.getField(updateSign, String[].class, 0);
@EventHandler @EventHandler
public void editSign(PlayerInteractEvent event) { public void editSign(PlayerInteractEvent event) {
@@ -0,0 +1,92 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.world;
import com.sk89q.worldedit.regions.RegionSelector;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.bausystem.utils.WorldEditUtils;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.MinVersion;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.checkerframework.checker.units.qual.min;
import java.io.*;
import java.util.List;
import java.util.logging.Level;
import java.util.stream.Collectors;
@Linked
@MinVersion(18)
public class WorldEditSelectionSaver implements Listener {
private File WORLD_EDIT_SELECTIONS = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "world_edit_selections");
{
WORLD_EDIT_SELECTIONS.mkdir();
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
SteamwarUser steamwarUser = SteamwarUser.get(event.getPlayer().getUniqueId());
File file = new File(WORLD_EDIT_SELECTIONS, Integer.toString(steamwarUser.getId()));
if (!file.exists()) return;
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
Class<? extends RegionSelector> clazz = (Class<? extends RegionSelector>) Class.forName(bufferedReader.readLine());
List<Location> locations = bufferedReader.lines()
.map(s -> s.split(" "))
.map(strings -> strings.length != 3 ? null : new Location(event.getPlayer().getWorld(), Integer.parseInt(strings[0]), Integer.parseInt(strings[1]), Integer.parseInt(strings[2])))
.collect(Collectors.toList());
WorldEditUtils.setVertices(event.getPlayer(), clazz, locations);
} catch (IOException | ClassNotFoundException e) {
BauSystem.getInstance().getLogger().log(Level.SEVERE, e.getMessage(), e);
file.delete();
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
SteamwarUser steamwarUser = SteamwarUser.get(event.getPlayer().getUniqueId());
Pair<Class<? extends RegionSelector>, List<Location>> data = WorldEditUtils.getVertices(event.getPlayer());
File file = new File(WORLD_EDIT_SELECTIONS, Integer.toString(steamwarUser.getId()));
try {
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file)));
bufferedWriter.write(data.getKey().getTypeName());
for (Location location : data.getValue()) {
if (location == null) {
bufferedWriter.write("\n");
} else {
bufferedWriter.write("\n" + location.getBlockX() + " " + location.getBlockY() + " " + location.getBlockZ());
}
}
bufferedWriter.close();
} catch (IOException e) {
BauSystem.getInstance().getLogger().log(Level.SEVERE, e.getMessage(), e);
file.delete();
}
}
}
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.features.xray; package de.steamwar.bausystem.features.xray;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.techhider.TechHiderCommand; import de.steamwar.bausystem.features.techhider.TechHiderCommand;
@@ -108,8 +108,8 @@ public class XrayCommand extends SWCommand implements Listener, ScoreboardElemen
}); });
} }
private static final Class<?> position = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPosition"); private static final Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
private static final Class<?> positionLook = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPositionLook"); private static final Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
{ {
BiFunction<Player, Object, Object> positionSetter = (player, o) -> { BiFunction<Player, Object, Object> positionSetter = (player, o) -> {
@@ -21,41 +21,40 @@ package de.steamwar.bausystem.region.flags;
import de.steamwar.bausystem.region.flags.flagvalues.*; import de.steamwar.bausystem.region.flags.flagvalues.*;
import de.steamwar.bausystem.shared.EnumDisplay; import de.steamwar.bausystem.shared.EnumDisplay;
import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
@Getter @Getter
@AllArgsConstructor
public enum Flag implements EnumDisplay { public enum Flag implements EnumDisplay {
COLOR("FLAG_COLOR", ColorMode.class, ColorMode.YELLOW), COLOR("FLAG_COLOR", ColorMode.class, ColorMode.YELLOW, false),
TNT("FLAG_TNT", TNTMode.class, TNTMode.ONLY_TB), TNT("FLAG_TNT", TNTMode.class, TNTMode.ONLY_TB, true),
FIRE("FLAG_FIRE", FireMode.class, FireMode.ALLOW), FIRE("FLAG_FIRE", FireMode.class, FireMode.ALLOW, true),
FREEZE("FLAG_FREEZE", FreezeMode.class, FreezeMode.INACTIVE), FREEZE("FLAG_FREEZE", FreezeMode.class, FreezeMode.INACTIVE, true),
PROTECT("FLAG_PROTECT", ProtectMode.class, ProtectMode.ACTIVE), PROTECT("FLAG_PROTECT", ProtectMode.class, ProtectMode.ACTIVE, true),
ITEMS("FLAG_ITEMS", ItemMode.class, ItemMode.INACTIVE), ITEMS("FLAG_ITEMS", ItemMode.class, ItemMode.INACTIVE, true),
NO_GRAVITY("FLAG_NO_GRAVITY", NoGravityMode.class, NoGravityMode.INACTIVE), NO_GRAVITY("FLAG_NO_GRAVITY", NoGravityMode.class, NoGravityMode.INACTIVE, true),
; ;
@Getter @Getter
private static final Set<Flag> flags; private static final Set<Flag> flags;
@Getter
private static final Set<Flag> resetFlags;
static { static {
flags = EnumSet.allOf(Flag.class); flags = EnumSet.allOf(Flag.class);
resetFlags = flags.stream().filter(flag -> flag.reset).collect(Collectors.toUnmodifiableSet());
} }
private final String chatValue; private final String chatValue;
private final Class<? extends Value<?>> valueType; private final Class<? extends Value<?>> valueType;
private final Flag.Value<?> defaultValue; private final Flag.Value<?> defaultValue;
private final Value<?>[] values; private final boolean reset;
<T extends Enum<T> & Value<T>> Flag(String chatValue, final Class<? extends Value<T>> valueType, final Flag.Value<T> defaultValue) {
this.chatValue = chatValue;
this.valueType = valueType;
this.defaultValue = defaultValue;
this.values = defaultValue.getValues();
}
public Value<?> getFlagValueOf(final String name) { public Value<?> getFlagValueOf(final String name) {
return this.defaultValue.getValueOf(name); return this.defaultValue.getValueOf(name);
@@ -24,6 +24,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.pattern.WaterloggedRemover; import com.sk89q.worldedit.function.pattern.WaterloggedRemover;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import de.steamwar.bausystem.region.Color; import de.steamwar.bausystem.region.Color;
import de.steamwar.bausystem.region.Point; import de.steamwar.bausystem.region.Point;
@@ -34,9 +35,7 @@ import lombok.NonNull;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Objects;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.function.BiPredicate; import java.util.function.BiPredicate;
@@ -106,51 +105,28 @@ public class PasteBuilder {
public PasteBuilder color(Color color) { public PasteBuilder color(Color color) {
if (color == Color.PINK) return this; if (color == Color.PINK) return this;
BaseBlock WOOL = Objects.requireNonNull(BlockTypes.PINK_WOOL).getDefaultState().toBaseBlock(); Map<String, BaseBlock> blockCache = new HashMap<>();
BaseBlock CLAY = Objects.requireNonNull(BlockTypes.PINK_TERRACOTTA).getDefaultState().toBaseBlock();
BaseBlock GLAZED = Objects.requireNonNull(BlockTypes.PINK_GLAZED_TERRACOTTA).getDefaultState().toBaseBlock();
BaseBlock GLASS = Objects.requireNonNull(BlockTypes.PINK_STAINED_GLASS).getDefaultState().toBaseBlock();
BaseBlock GLASS_PANE = Objects.requireNonNull(BlockTypes.PINK_STAINED_GLASS_PANE).getDefaultState().toBaseBlock();
BaseBlock CONCRETE = Objects.requireNonNull(BlockTypes.PINK_CONCRETE).getDefaultState().toBaseBlock();
BaseBlock CONCRETE_POWDER = Objects.requireNonNull(BlockTypes.PINK_CONCRETE_POWDER).getDefaultState().toBaseBlock();
BaseBlock CARPET = Objects.requireNonNull(BlockTypes.PINK_CARPET).getDefaultState().toBaseBlock();
BaseBlock wool = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_wool")).getDefaultState().toBaseBlock();
BaseBlock clay = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_terracotta")).getDefaultState().toBaseBlock();
BaseBlock glazed = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_glazed_terracotta")).getDefaultState().toBaseBlock();
BaseBlock glass = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_stained_glass")).getDefaultState().toBaseBlock();
BaseBlock glassPane = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_stained_glass_pane")).getDefaultState().toBaseBlock();
BaseBlock carpet = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_carpet")).getDefaultState().toBaseBlock();
BaseBlock concrete = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_concrete")).getDefaultState().toBaseBlock();
BaseBlock concretePowder = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_concrete_powder")).getDefaultState().toBaseBlock();
return map((clipboard, blockVector3) -> { return map((clipboard, blockVector3) -> {
BaseBlock block = clipboard.getFullBlock(blockVector3); BaseBlock block = clipboard.getFullBlock(blockVector3);
if (block.equals(WOOL)) { if (block.getBlockType().getId().startsWith("minecraft:pink_")) {
clipboard.setBlock(blockVector3, wool); BaseBlock baseBlock = blockCache.computeIfAbsent(block.getBlockType().getId(), s -> {
} else if (block.equals(CLAY)) { String replaced = s.replace("minecraft:pink_", "minecraft:" + color.name().toLowerCase() + "_");
clipboard.setBlock(blockVector3, clay); BlockType blockType = BlockTypes.get(replaced);
} else if (block.equals(GLAZED)) { if (blockType == null) return null;
clipboard.setBlock(blockVector3, glazed); return blockType.getDefaultState().toBaseBlock();
} else if (block.equals(GLASS)) { });
clipboard.setBlock(blockVector3, glass); if (baseBlock == null) return;
} else if (block.equals(GLASS_PANE)) { clipboard.setBlock(blockVector3, baseBlock);
clipboard.setBlock(blockVector3, glassPane);
} else if (block.equals(CARPET)) {
clipboard.setBlock(blockVector3, carpet);
} else if (block.equals(CONCRETE)) {
clipboard.setBlock(blockVector3, concrete);
} else if (block.equals(CONCRETE_POWDER)) {
clipboard.setBlock(blockVector3, concretePowder);
} }
}); });
} }
/**
* Can only be used before {@link #color(Color)}.
*/
public PasteBuilder onlyColors(boolean onlyColors) { public PasteBuilder onlyColors(boolean onlyColors) {
if (!onlyColors) return this; if (!onlyColors) return this;
return only((baseBlock, s) -> { return only((baseBlock, s) -> s.startsWith("minecraft:pink_"));
return s.endsWith("_wool") || s.endsWith("_terracotta") || s.endsWith("_glazed_terracotta") || s.endsWith("_stained_glass") || s.endsWith("_stained_glass_pane") || s.endsWith("_carpet") || s.endsWith("_concrete") || s.endsWith("_concrete_powder");
});
} }
public PasteBuilder removeTNT(boolean removeTNT) { public PasteBuilder removeTNT(boolean removeTNT) {
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.utils; package de.steamwar.bausystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
@@ -81,12 +81,12 @@ public class PlaceItemUtils {
.collect(Collectors.toSet()); .collect(Collectors.toSet());
} }
private static final Class<?> blockPosition = Reflection.getClass("{nms.core}.BlockPosition"); private static final Class<?> blockPosition = Reflection.getClass("net.minecraft.core.BlockPos");
private static final Reflection.ConstructorInvoker blockPositionConstructor = Reflection.getConstructor(blockPosition, int.class, int.class, int.class); private static final Reflection.Constructor blockPositionConstructor = Reflection.getConstructor(blockPosition, int.class, int.class, int.class);
private static final Class<?> craftBlock = Reflection.getClass("{obc}.block.CraftBlockState"); private static final Class<?> craftBlock = Reflection.getClass("org.bukkit.craftbukkit.block.CraftBlockState");
private static final Class<?> craftWorld = Reflection.getClass("{obc}.CraftWorld"); private static final Class<?> craftWorld = Reflection.getClass("org.bukkit.craftbukkit.CraftWorld");
private static final Reflection.FieldAccessor<?> positionAccessor = Reflection.getField(craftBlock, blockPosition, 0); private static final Reflection.Field<?> positionAccessor = Reflection.getField(craftBlock, blockPosition, 0);
private static final Reflection.FieldAccessor<?> worldAccessor = Reflection.getField(craftBlock, craftWorld, 0); private static final Reflection.Field<?> worldAccessor = Reflection.getField(craftBlock, craftWorld, 0);
/** /**
* Attempt to place an {@link ItemStack} the {@link Player} is holding against a {@link Block} inside the World. * Attempt to place an {@link ItemStack} the {@link Player} is holding against a {@link Block} inside the World.
@@ -19,26 +19,20 @@
package de.steamwar.bausystem.utils; package de.steamwar.bausystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.core.BountifulWrapper; import de.steamwar.core.BountifulWrapper;
import de.steamwar.core.Core;
import de.steamwar.core.VersionDependent; import de.steamwar.core.VersionDependent;
import de.steamwar.entity.REntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public interface PlayerMovementWrapper { public interface PlayerMovementWrapper {
Class<?> teleportPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityTeleport"); Class<?> teleportPacket = REntity.teleportPacket;
Reflection.FieldAccessor<Integer> teleportEntity = Reflection.getField(teleportPacket, Integer.TYPE, 0); Reflection.Field<Integer> teleportEntity = REntity.teleportEntity;
BountifulWrapper.PositionSetter teleportPosition = BountifulWrapper.impl.getPositionSetter(teleportPacket, Core.getVersion() == 8 ? 1 : 0); BountifulWrapper.PositionSetter teleportPosition = REntity.teleportPosition;
Reflection.FieldAccessor<Byte> teleportYaw = Reflection.getField(teleportPacket, Byte.TYPE, 0);
Reflection.FieldAccessor<Byte> teleportPitch = Reflection.getField(teleportPacket, Byte.TYPE, 1);
PlayerMovementWrapper impl = VersionDependent.getVersionImpl(BauSystem.getInstance()); PlayerMovementWrapper impl = VersionDependent.getVersionImpl(BauSystem.getInstance());
void setPosition(Player player, Object object); void setPosition(Player player, Object object);
Object convertToOut(Player player, Object object); Object convertToOut(Player player, Object object);
default byte rotToByte(float rot) {
return (byte)((int)(rot * 256.0F / 360.0F));
}
} }
@@ -1,49 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.utils;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.ViaAPI;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.linkage.Linked;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
@Linked
public class VersionAnnouncer implements Listener {
private final String versionString = Bukkit.getBukkitVersion().split("-", 2)[0];
@SuppressWarnings("unchecked")
private final ViaAPI<Player> via = Via.getAPI();
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if(via.getServerVersion().supportedVersions().contains(via.getPlayerVersion(player)))
return;
BauSystem.MESSAGE.sendPrefixless("SERVER_VERSION", player, ChatMessageType.ACTION_BAR, versionString);
}
}
@@ -19,17 +19,21 @@
package de.steamwar.bausystem.utils; package de.steamwar.bausystem.utils;
import de.steamwar.Reflection;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.extension.factory.PatternFactory; import com.sk89q.worldedit.extension.factory.PatternFactory;
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.internal.registry.InputParser; import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
import de.steamwar.bausystem.shared.Pair; import de.steamwar.bausystem.shared.Pair;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
@@ -37,6 +41,9 @@ import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.List;
import java.util.stream.Collectors;
@UtilityClass @UtilityClass
public class WorldEditUtils { public class WorldEditUtils {
@@ -77,6 +84,40 @@ public class WorldEditUtils {
return WorldEdit.getInstance().getPatternFactory(); return WorldEdit.getInstance().getPatternFactory();
} }
public Pair<Class<? extends RegionSelector>, List<Location>> getVertices(Player player) {
RegionSelector regionSelector = WorldEdit.getInstance()
.getSessionManager()
.get(BukkitAdapter.adapt(player))
.getRegionSelector(BukkitAdapter.adapt(player.getWorld()));
return new Pair<>(regionSelector.getClass(), regionSelector.getVertices()
.stream()
.map(blockVector3 -> blockVector3 == null ? null : adapt(player.getWorld(), blockVector3))
.collect(Collectors.toList()));
}
public void setVertices(Player player, Class<? extends RegionSelector> clazz, List<Location> vertices) {
LocalSession localSession = WorldEdit.getInstance()
.getSessionManager()
.get(BukkitAdapter.adapt(player));
Reflection.Constructor constructorInvoker = Reflection.getConstructor(clazz, com.sk89q.worldedit.world.World.class);
RegionSelector regionSelector = (RegionSelector) constructorInvoker.invoke(BukkitAdapter.adapt(player.getWorld()));
localSession.setRegionSelector(BukkitAdapter.adapt(player.getWorld()), regionSelector);
if (vertices.isEmpty()) return;
SelectorLimits selectorLimits = ActorSelectorLimits.forActor(BukkitAdapter.adapt(player));
for (int i = 0; i < vertices.size(); i++) {
Location location = vertices.get(i);
if (location == null) continue;
if (i == 0) {
regionSelector.selectPrimary(BukkitAdapter.adapt(location).toBlockPoint(), selectorLimits);
} else {
regionSelector.selectSecondary(BukkitAdapter.adapt(location).toBlockPoint(), selectorLimits);
}
}
}
public Pair<Location, Location> getSelection(Player player) { public Pair<Location, Location> getSelection(Player player) {
RegionSelector regionSelector = WorldEdit.getInstance() RegionSelector regionSelector = WorldEdit.getInstance()
.getSessionManager() .getSessionManager()
-2
View File
@@ -2,8 +2,6 @@ name: BauSystem
authors: [ Lixfel, YoyoNow, Chaoscaot, Zeanon, D4rkr34lm ] authors: [ Lixfel, YoyoNow, Chaoscaot, Zeanon, D4rkr34lm ]
version: "2.0" version: "2.0"
depend: [ WorldEdit, SpigotCore ] depend: [ WorldEdit, SpigotCore ]
softdepend:
- ViaVersion
load: POSTWORLD load: POSTWORLD
main: de.steamwar.bausystem.BauSystem main: de.steamwar.bausystem.BauSystem
api-version: "1.13" api-version: "1.13"
+1
View File
@@ -32,4 +32,5 @@ dependencies {
implementation(project(":BauSystem:BauSystem_18")) implementation(project(":BauSystem:BauSystem_18"))
implementation(project(":BauSystem:BauSystem_19")) implementation(project(":BauSystem:BauSystem_19"))
implementation(project(":BauSystem:BauSystem_20")) implementation(project(":BauSystem:BauSystem_20"))
implementation(project(":BauSystem:BauSystem_21"))
} }
+22 -6
View File
@@ -21,6 +21,7 @@ package de.steamwar.sql;
import de.steamwar.sql.internal.Field; import de.steamwar.sql.internal.Field;
import de.steamwar.sql.internal.SelectStatement; import de.steamwar.sql.internal.SelectStatement;
import de.steamwar.sql.internal.Statement;
import de.steamwar.sql.internal.Table; import de.steamwar.sql.internal.Table;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
@@ -42,6 +43,11 @@ public class Event {
private static final SelectStatement<Event> byId = table.select(Table.PRIMARY); private static final SelectStatement<Event> byId = table.select(Table.PRIMARY);
private static final SelectStatement<Event> byName = table.select("eventName"); private static final SelectStatement<Event> byName = table.select("eventName");
private static final SelectStatement<Event> byComing = new SelectStatement<>(table, "SELECT * FROM Event WHERE Start > now()"); private static final SelectStatement<Event> byComing = new SelectStatement<>(table, "SELECT * FROM Event WHERE Start > now()");
private static final SelectStatement<Event> all = new SelectStatement<>(table, "SELECT * FROM Event");
private static final Statement create = table.insertFields(true, "eventName", "deadline", "start", "end", "maximumTeamMembers", "publicSchemsOnly");
private static final Statement update = table.update(Table.PRIMARY, "eventName", "deadline", "start", "end", "schemType", "maximumTeamMembers", "publicSchemsOnly");
private static final Statement delete = table.delete(Table.PRIMARY);
private static Event current = null; private static Event current = null;
@@ -53,6 +59,14 @@ public class Event {
return current; return current;
} }
public static List<Event> getAll(){
return all.listSelect();
}
public static Event create(String eventName, Timestamp start, Timestamp end){
return get(create.insertGetKey(eventName, start, start, end, 5, false, false));
}
public static Event get(int eventID){ public static Event get(int eventID){
return byId.select(eventID); return byId.select(eventID);
} }
@@ -87,16 +101,10 @@ public class Event {
private final SchematicType schemType; private final SchematicType schemType;
@Field @Field
private final boolean publicSchemsOnly; private final boolean publicSchemsOnly;
@Deprecated
@Field
private final boolean spectateSystem;
public boolean publicSchemsOnly() { public boolean publicSchemsOnly() {
return publicSchemsOnly; return publicSchemsOnly;
} }
public boolean spectateSystem(){
return spectateSystem;
}
public SchematicType getSchematicType() { public SchematicType getSchematicType() {
return schemType; return schemType;
@@ -106,4 +114,12 @@ public class Event {
Instant now = Instant.now(); Instant now = Instant.now();
return now.isAfter(start.toInstant()) && now.isBefore(end.toInstant()); return now.isAfter(start.toInstant()) && now.isBefore(end.toInstant());
} }
public void update(String eventName, Timestamp deadline, Timestamp start, Timestamp end, SchematicType schemType, int maximumTeamMembers, boolean publicSchemsOnly) {
update.update(eventName, deadline, start, end, schemType, maximumTeamMembers, publicSchemsOnly, eventID);
}
public void delete() {
delete.update(eventID);
}
} }
@@ -25,6 +25,7 @@ import de.steamwar.sql.internal.Statement;
import de.steamwar.sql.internal.Table; import de.steamwar.sql.internal.Table;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.*; import java.util.*;
@@ -42,6 +43,11 @@ public class EventFight implements Comparable<EventFight> {
private static final Statement setResult = table.update(Table.PRIMARY, "Ergebnis"); private static final Statement setResult = table.update(Table.PRIMARY, "Ergebnis");
private static final Statement setFight = table.update(Table.PRIMARY, "Fight"); private static final Statement setFight = table.update(Table.PRIMARY, "Fight");
private static final Statement create = table.insertFields(true, "eventID", "startTime", "spielmodus", "map", "teamBlue", "teamRed", "spectatePort");
private static final Statement update = table.update(Table.PRIMARY, "startTime", "spielModus", "map", "teamBlue", "teamRed", "spectatePort");
private static final Statement delete = table.delete(Table.PRIMARY);
@Getter
private static final Queue<EventFight> fights = new PriorityQueue<>(); private static final Queue<EventFight> fights = new PriorityQueue<>();
public static EventFight get(int fightID) { public static EventFight get(int fightID) {
@@ -57,8 +63,8 @@ public class EventFight implements Comparable<EventFight> {
return event.listSelect(eventID); return event.listSelect(eventID);
} }
public static Queue<EventFight> getFights() { public static EventFight create(int event, Timestamp from, String spielmodus, String map, int blueTeam, int redTeam, Integer spectatePort) {
return fights; return get(create.insertGetKey(event, from, spielmodus, map, blueTeam, redTeam, spectatePort));
} }
@Getter @Getter
@@ -68,27 +74,29 @@ public class EventFight implements Comparable<EventFight> {
@Field(keys = {Table.PRIMARY}, autoincrement = true) @Field(keys = {Table.PRIMARY}, autoincrement = true)
private final int fightID; private final int fightID;
@Getter @Getter
@Setter
@Field @Field
private Timestamp startTime; private Timestamp startTime;
@Getter @Getter
@Setter
@Field @Field
private final String spielmodus; private String spielmodus;
@Getter @Getter
@Setter
@Field @Field
private final String map; private String map;
@Getter @Getter
@Setter
@Field @Field
private final int teamBlue; private int teamBlue;
@Getter @Getter
@Setter
@Field @Field
private final int teamRed; private int teamRed;
@Getter @Getter
@Field @Setter
@Deprecated @Field(nullable = true)
private final int kampfleiter; private Integer spectatePort;
@Getter
@Field
private final int spectatePort;
@Getter @Getter
@Field(def = "0") @Field(def = "0")
private int ergebnis; private int ergebnis;
@@ -133,4 +141,18 @@ public class EventFight implements Comparable<EventFight> {
public int compareTo(EventFight o) { public int compareTo(EventFight o) {
return startTime.compareTo(o.startTime); return startTime.compareTo(o.startTime);
} }
public void update(Timestamp startTime, String spielmodus, String map, int teamBlue, int teamRed, Integer spectatePort) {
update.update(startTime, spielmodus, map, teamBlue, teamRed, spectatePort, fightID);
this.startTime = startTime;
this.spielmodus = spielmodus;
this.map = map;
this.teamBlue = teamBlue;
this.teamRed = teamRed;
this.spectatePort = spectatePort;
}
public void delete() {
delete.update(fightID);
}
} }
@@ -28,12 +28,15 @@ import java.sql.PreparedStatement;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
@AllArgsConstructor @AllArgsConstructor
@Getter
public class NodeData { public class NodeData {
static { static {
new SqlTypeMapper<>(PipedInputStream.class, "BLOB", (rs, identifier) -> { throw new SecurityException("PipedInputStream is write only datatype"); }, PreparedStatement::setBinaryStream); 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); new SqlTypeMapper<>(ByteArrayInputStream.class, "BLOB", (rs, identifier) -> { throw new SecurityException("ByteArrayInputStream is write only datatype"); }, PreparedStatement::setBinaryStream);
new SqlTypeMapper<>(BufferedInputStream.class, "BLOB", (rs, identifier) -> { throw new SecurityException("BufferedInputStream is write only datatype"); }, PreparedStatement::setBinaryStream); new SqlTypeMapper<>(BufferedInputStream.class, "BLOB", (rs, identifier) -> { throw new SecurityException("BufferedInputStream is write only datatype"); }, PreparedStatement::setBinaryStream);
SqlTypeMapper.ordinalEnumMapper(SchematicFormat.class);
} }
private static final Table<NodeData> table = new Table<>(NodeData.class); private static final Table<NodeData> table = new Table<>(NodeData.class);
@@ -48,19 +51,18 @@ public class NodeData {
throw new IllegalArgumentException("Node is a directory"); throw new IllegalArgumentException("Node is a directory");
return get.select(rs -> { return get.select(rs -> {
if(rs.next()) { if(rs.next()) {
return new NodeData(node.getId(), rs.getBoolean("NodeFormat")); return new NodeData(node.getId(), SchematicFormat.values()[rs.getInt("NodeFormat")]);
} else { } else {
return new NodeData(node.getId(), false); return new NodeData(node.getId(), SchematicFormat.MCEDIT);
} }
}, node); }, node);
} }
@Getter
@Field(keys = {Table.PRIMARY}) @Field(keys = {Table.PRIMARY})
private final int nodeId; private final int nodeId;
@Field @Field
private boolean nodeFormat; private SchematicFormat nodeFormat;
public InputStream schemData() throws IOException { public InputStream schemData() throws IOException {
try { try {
@@ -81,12 +83,18 @@ public class NodeData {
} }
} }
public void saveFromStream(InputStream blob, boolean newFormat) { public void saveFromStream(InputStream blob, SchematicFormat newFormat) {
updateDatabase.update(nodeId, newFormat, blob); updateDatabase.update(nodeId, newFormat, blob);
nodeFormat = newFormat; nodeFormat = newFormat;
} }
public boolean getNodeFormat() { @AllArgsConstructor
return nodeFormat; @Getter
public enum SchematicFormat {
MCEDIT(".schematic"),
SPONGE_V2(".schem"),
SPONGE_V3(".schem");
private final String fileEnding;
} }
} }
@@ -20,9 +20,11 @@
package de.steamwar.sql; package de.steamwar.sql;
import de.steamwar.sql.internal.Field; import de.steamwar.sql.internal.Field;
import de.steamwar.sql.internal.SelectStatement;
import de.steamwar.sql.internal.Statement; import de.steamwar.sql.internal.Statement;
import de.steamwar.sql.internal.Table; import de.steamwar.sql.internal.Table;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
@@ -38,11 +40,21 @@ public class NodeDownload {
private static final Table<NodeDownload> table = new Table<>(NodeDownload.class); private static final Table<NodeDownload> table = new Table<>(NodeDownload.class);
private static final Statement insert = table.insertFields("NodeId", "Link"); private static final Statement insert = table.insertFields("NodeId", "Link");
private static final SelectStatement<NodeDownload> select = table.selectFields("link");
private static final Statement delete = table.delete(Table.PRIMARY);
public static NodeDownload get(String link) {
return select.select(link);
}
@Getter
@Field(keys = {Table.PRIMARY}) @Field(keys = {Table.PRIMARY})
private final int nodeId; private final int nodeId;
@Field @Field
private final String link; private final String link;
@Field(def = "CURRENT_TIMESTAMP") @Field(def = "CURRENT_TIMESTAMP")
@Getter
private final Timestamp timestamp; private final Timestamp timestamp;
public static String getLink(SchematicNode schem){ public static String getLink(SchematicNode schem){
@@ -60,10 +72,15 @@ public class NodeDownload {
insert.update(schem.getId(), hash); insert.update(schem.getId(), hash);
return LINK_BASE + hash; return LINK_BASE + hash;
} }
public static String base16encode(byte[] byteArray) { public static String base16encode(byte[] byteArray) {
StringBuilder hexBuffer = new StringBuilder(byteArray.length * 2); StringBuilder hexBuffer = new StringBuilder(byteArray.length * 2);
for (byte b : byteArray) for (byte b : byteArray)
hexBuffer.append(HEX[(b >>> 4) & 0xF]).append(HEX[b & 0xF]); hexBuffer.append(HEX[(b >>> 4) & 0xF]).append(HEX[b & 0xF]);
return hexBuffer.toString(); return hexBuffer.toString();
} }
public void delete() {
delete.update(nodeId);
}
} }
@@ -72,6 +72,10 @@ public class NodeMember {
return new NodeMember(node, member, null); return new NodeMember(node, member, null);
} }
public static NodeMember getNodeMember(int node, SteamwarUser member) {
return getNodeMember(node, member.getId());
}
public static NodeMember getNodeMember(int node, int member) { public static NodeMember getNodeMember(int node, int member) {
return getNodeMember.select(node, member); return getNodeMember.select(node, member);
} }
@@ -121,11 +121,11 @@ public class Punishment {
public enum PunishmentType { public enum PunishmentType {
Ban(false, "BAN_TEAM", "BAN_PERMA", "BAN_UNTIL", "UNBAN_ERROR", "UNBAN"), Ban(false, "BAN_TEAM", "BAN_PERMA", "BAN_UNTIL", "UNBAN_ERROR", "UNBAN"),
Mute( false, "MUTE_TEAM", "MUTE_PERMA", "MUTE_UNTIL", "UNMUTE_ERROR", "UNMUTE"), Mute( false, "MUTE_TEAM", "MUTE_PERMA", "MUTE_UNTIL", "UNMUTE_ERROR", "UNMUTE"),
NoSchemReceiving(false, "NOSCHEMRECEIVING_TEAM", "NOSCHEMRECEIVING_PERMA", "NOSCHEMRECEIVING_UNTIL", "UNNOSCHEMRECEIVING_ERROR", "UNNOSCHEMRECEIVING"), NoSchemReceiving(true, "NOSCHEMRECEIVING_TEAM", "NOSCHEMRECEIVING_PERMA", "NOSCHEMRECEIVING_UNTIL", "UNNOSCHEMRECEIVING_ERROR", "UNNOSCHEMRECEIVING"),
NoSchemSharing(false, "NOSCHEMSHARING_TEAM", "NOSCHEMSHARING_PERMA", "NOSCHEMSHARING_UNTIL", "UNNOSCHEMSHARING_ERROR", "UNNOSCHEMSHARING"), NoSchemSharing(true, "NOSCHEMSHARING_TEAM", "NOSCHEMSHARING_PERMA", "NOSCHEMSHARING_UNTIL", "UNNOSCHEMSHARING_ERROR", "UNNOSCHEMSHARING"),
NoSchemSubmitting(true, "NOSCHEMSUBMITTING_TEAM", "NOSCHEMSUBMITTING_PERMA", "NOSCHEMSUBMITTING_UNTIL", "UNNOSCHEMSUBMITTING_ERROR", "UNNOSCHEMSUBMITTING"), NoSchemSubmitting(false, "NOSCHEMSUBMITTING_TEAM", "NOSCHEMSUBMITTING_PERMA", "NOSCHEMSUBMITTING_UNTIL", "UNNOSCHEMSUBMITTING_ERROR", "UNNOSCHEMSUBMITTING"),
NoDevServer(true, "NODEVSERVER_TEAM", "NODEVSERVER_PERMA", "NODEVSERVER_UNTIL", "UNNODEVSERVER_ERROR", "UNNODEVSERVER"), NoDevServer(true, "NODEVSERVER_TEAM", "NODEVSERVER_PERMA", "NODEVSERVER_UNTIL", "UNNODEVSERVER_ERROR", "UNNODEVSERVER"),
NoFightServer(false, "NOFIGHTSERVER_TEAM", "NOFIGHTSERVER_PERMA", "NOFIGHTSERVER_UNTIL", "UNNOFIGHTSERVER_ERROR", "UNNOFIGHTSERVER"), NoFightServer(true, "NOFIGHTSERVER_TEAM", "NOFIGHTSERVER_PERMA", "NOFIGHTSERVER_UNTIL", "UNNOFIGHTSERVER_ERROR", "UNNOFIGHTSERVER"),
NoTeamServer(true, "NOTEAMSERVER_TEAM", "NOTEAMSERVER_PERMA", "NOTEAMSERVER_UNTIL", "UNNOTEAMSERVER_ERROR", "UNNOTEAMSERVER"), NoTeamServer(true, "NOTEAMSERVER_TEAM", "NOTEAMSERVER_PERMA", "NOTEAMSERVER_UNTIL", "UNNOTEAMSERVER_ERROR", "UNNOTEAMSERVER"),
Note(false, "NOTE_TEAM", null, null, null, null, true); Note(false, "NOTE_TEAM", null, null, null, null, true);
@@ -21,6 +21,7 @@ package de.steamwar.sql;
import de.steamwar.sql.internal.Field; import de.steamwar.sql.internal.Field;
import de.steamwar.sql.internal.SelectStatement; import de.steamwar.sql.internal.SelectStatement;
import de.steamwar.sql.internal.Statement;
import de.steamwar.sql.internal.Table; import de.steamwar.sql.internal.Table;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@@ -33,6 +34,17 @@ public class Referee {
private static final Table<Referee> table = new Table<>(Referee.class); private static final Table<Referee> table = new Table<>(Referee.class);
private static final SelectStatement<Referee> byEvent = table.selectFields("eventID"); private static final SelectStatement<Referee> byEvent = table.selectFields("eventID");
private static final Statement insert = table.insertAll();
private static final Statement delete = table.delete("eventReferee");
public static void add(int eventID, int userID) {
insert.update(eventID, userID);
}
public static void remove(int eventID, int userID) {
delete.update(eventID, userID);
}
public static Set<Integer> get(int eventID) { public static Set<Integer> get(int eventID) {
return byEvent.listSelect(eventID).stream().map(referee -> referee.userID).collect(Collectors.toSet()); return byEvent.listSelect(eventID).stream().map(referee -> referee.userID).collect(Collectors.toSet());
} }
@@ -375,11 +375,10 @@ public class SchematicNode {
return nodeType == null; return nodeType == null;
} }
@Deprecated public String getFileEnding() {
public boolean getSchemFormat() {
if(isDir()) if(isDir())
throw new SecurityException("Node is Directory"); throw new SecurityException("Node is Directory");
return NodeData.get(this).getNodeFormat(); return NodeData.get(this).getNodeFormat().getFileEnding();
} }
public int getRank() { public int getRank() {
@@ -443,7 +442,7 @@ public class SchematicNode {
return SchemElo.getElo(this, season); return SchemElo.getElo(this, season);
} }
public boolean accessibleByUser(int user) { public boolean accessibleByUser(SteamwarUser user) {
return NodeMember.getNodeMember(nodeId, user) != null; return NodeMember.getNodeMember(nodeId, user) != null;
} }
@@ -506,6 +505,19 @@ public class SchematicNode {
return builder.toString(); return builder.toString();
} }
public List<Map.Entry<String, Integer>> generateBreadcrumbsMap(SteamwarUser user) {
List<Map.Entry<String, Integer>> map = new ArrayList<>();
Optional<SchematicNode> currentNode = Optional.of(this);
if(currentNode.map(SchematicNode::isDir).orElse(false)) {
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.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")); private static final List<String> FORBIDDEN_NAMES = Collections.unmodifiableList(Arrays.asList("public"));
public static boolean invalidSchemName(String[] layers) { public static boolean invalidSchemName(String[] layers) {
for (String layer : layers) { for (String layer : layers) {
@@ -62,6 +62,7 @@ public class SteamwarUser {
private static final SelectStatement<SteamwarUser> byDiscord = table.selectFields("DiscordId"); private static final SelectStatement<SteamwarUser> byDiscord = table.selectFields("DiscordId");
private static final SelectStatement<SteamwarUser> byTeam = table.selectFields("Team"); private static final SelectStatement<SteamwarUser> byTeam = table.selectFields("Team");
private static final SelectStatement<SteamwarUser> getUsersWithPerm = new SelectStatement<>(table, "SELECT S.* FROM UserData S JOIN UserPerm P ON S.id = P.User WHERE P.Perm = ?"); private static final SelectStatement<SteamwarUser> getUsersWithPerm = new SelectStatement<>(table, "SELECT S.* FROM UserData S JOIN UserPerm P ON S.id = P.User WHERE P.Perm = ?");
private static final SelectStatement<SteamwarUser> getAll = new SelectStatement<SteamwarUser>(table, "SELECT * FROM UserData");
private static final Statement updateName = table.update(Table.PRIMARY, "UserName"); private static final Statement updateName = table.update(Table.PRIMARY, "UserName");
private static final Statement updatePassword = table.update(Table.PRIMARY, "Password"); private static final Statement updatePassword = table.update(Table.PRIMARY, "Password");
@@ -72,6 +73,7 @@ public class SteamwarUser {
private static final Statement getPlaytime = new Statement("SELECT SUM(UNIX_TIMESTAMP(EndTime) - UNIX_TIMESTAMP(StartTime)) as Playtime FROM Session WHERE UserID = ?"); private static final Statement getPlaytime = new Statement("SELECT SUM(UNIX_TIMESTAMP(EndTime) - UNIX_TIMESTAMP(StartTime)) as Playtime FROM Session WHERE UserID = ?");
private static final Statement getFirstjoin = new Statement("SELECT MIN(StartTime) AS FirstJoin FROM Session WHERE UserID = ?"); private static final Statement getFirstjoin = new Statement("SELECT MIN(StartTime) AS FirstJoin FROM Session WHERE UserID = ?");
private static final Statement getLastonline = new Statement("SELECT MAX(EndTime) AS LastOnline FROM Session WHERE UserID = ?");
private static final Map<Integer, SteamwarUser> usersById = new HashMap<>(); private static final Map<Integer, SteamwarUser> usersById = new HashMap<>();
private static final Map<UUID, SteamwarUser> usersByUUID = new HashMap<>(); private static final Map<UUID, SteamwarUser> usersByUUID = new HashMap<>();
@@ -275,6 +277,14 @@ public class SteamwarUser {
}, id); }, id);
} }
public Timestamp getLastOnline() {
return getLastonline.select(rs -> {
if (rs.next())
return rs.getTimestamp("LastOnline");
return null;
}, id);
}
public void punish(Punishment.PunishmentType punishment, Timestamp time, String banReason, int from, boolean perma) { public void punish(Punishment.PunishmentType punishment, Timestamp time, String banReason, int from, boolean perma) {
initPunishments(); initPunishments();
punishments.remove(punishment); punishments.remove(punishment);
@@ -370,4 +380,8 @@ public class SteamwarUser {
permissions = UserPerm.getPerms(id); permissions = UserPerm.getPerms(id);
prefix = permissions.stream().filter(UserPerm.prefixes::containsKey).findAny().map(UserPerm.prefixes::get).orElse(UserPerm.emptyPrefix); prefix = permissions.stream().filter(UserPerm.prefixes::containsKey).findAny().map(UserPerm.prefixes::get).orElse(UserPerm.emptyPrefix);
} }
public static List<SteamwarUser> getAll() {
return getAll.listSelect();
}
} }
@@ -19,10 +19,7 @@
package de.steamwar.sql; package de.steamwar.sql;
import de.steamwar.sql.internal.Field; import de.steamwar.sql.internal.*;
import de.steamwar.sql.internal.SelectStatement;
import de.steamwar.sql.internal.SqlTypeMapper;
import de.steamwar.sql.internal.Table;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
@@ -68,11 +65,21 @@ public enum UserPerm {
private static final Table<UserPermTable> table = new Table<>(UserPermTable.class, "UserPerm"); private static final Table<UserPermTable> table = new Table<>(UserPermTable.class, "UserPerm");
private static final SelectStatement<UserPermTable> getPerms = table.selectFields("user"); private static final SelectStatement<UserPermTable> getPerms = table.selectFields("user");
private static final Statement addPerm = table.insertAll();
private static final Statement removePerm = table.delete(Table.PRIMARY);
public static Set<UserPerm> getPerms(int user) { public static Set<UserPerm> getPerms(int user) {
return getPerms.listSelect(user).stream().map(up -> up.perm).collect(Collectors.toSet()); return getPerms.listSelect(user).stream().map(up -> up.perm).collect(Collectors.toSet());
} }
public static void addPerm(SteamwarUser user, UserPerm perm) {
addPerm.update(user, perm);
}
public static void removePerm(SteamwarUser user, UserPerm perm) {
removePerm.update(user, perm);
}
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public static class Prefix { public static class Prefix {
@@ -83,7 +83,11 @@ public class Table<T> {
} }
public Statement insertAll() { public Statement insertAll() {
return insertFields(false, Arrays.stream(fields).map(f -> f.identifier).toArray(String[]::new)); return insertAll(false);
}
public Statement insertAll(boolean returnGeneratedKeys) {
return insertFields(returnGeneratedKeys, Arrays.stream(fields).map(f -> f.identifier).toArray(String[]::new));
} }
public Statement insertFields(String... fields) { public Statement insertFields(String... fields) {
+2 -2
View File
@@ -22,8 +22,8 @@ plugins {
} }
dependencies { dependencies {
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore", "default"))
compileOnly(project(":FightSystem:FightSystem_Core")) compileOnly(project(":FightSystem:FightSystem_Core", "default"))
compileOnly(libs.nms10) compileOnly(libs.nms10)
} }
+3 -3
View File
@@ -22,9 +22,9 @@ plugins {
} }
dependencies { dependencies {
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore", "default"))
compileOnly(project(":FightSystem:FightSystem_Core")) compileOnly(project(":FightSystem:FightSystem_Core", "default"))
compileOnly(project(":FightSystem:FightSystem_8")) compileOnly(project(":FightSystem:FightSystem_8", "default"))
compileOnly(libs.nms12) compileOnly(libs.nms12)
compileOnly(libs.worldedit12) compileOnly(libs.worldedit12)
+4 -4
View File
@@ -22,10 +22,10 @@ plugins {
} }
dependencies { dependencies {
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore", "default"))
compileOnly(project(":FightSystem:FightSystem_Core")) compileOnly(project(":FightSystem:FightSystem_Core", "default"))
compileOnly(project(":FightSystem:FightSystem_8")) compileOnly(project(":FightSystem:FightSystem_8", "default"))
compileOnly(project(":FightSystem:FightSystem_9")) compileOnly(project(":FightSystem:FightSystem_9", "default"))
compileOnly(libs.nms14) compileOnly(libs.nms14)
compileOnly(libs.worldedit15) compileOnly(libs.worldedit15)
@@ -19,45 +19,46 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.Map; import java.util.Map;
public class BlockIdWrapper14 implements BlockIdWrapper { public class BlockIdWrapper14 implements BlockIdWrapper {
private static final Class<?> chunkProviderServer = Reflection.getClass("{nms.server.level}.ChunkProviderServer"); private static final Class<?> chunkProviderServer = Reflection.getClass("net.minecraft.server.level.ServerChunkCache");
private static final Reflection.MethodInvoker getChunkProvider = Reflection.getTypedMethod(worldServer, null, chunkProviderServer); private static final Reflection.Method getChunkProvider = Reflection.getTypedMethod(worldServer, null, chunkProviderServer);
private static final Class<?> playerChunkMap = Reflection.getClass("{nms.server.level}.PlayerChunkMap"); private static final Class<?> playerChunkMap = Reflection.getClass("net.minecraft.server.level.ChunkMap");
private static final Reflection.FieldAccessor<?> getPlayerChunkMap = Reflection.getField(chunkProviderServer, playerChunkMap, 0); private static final Reflection.Field<?> getPlayerChunkMap = Reflection.getField(chunkProviderServer, playerChunkMap, 0);
private static final Reflection.FieldAccessor<? extends Map> entityTrackers = Core.getVersion() > 15 ? Reflection.getField(playerChunkMap, Int2ObjectMap.class, 0) : Reflection.getField(playerChunkMap, org.bukkit.craftbukkit.libs.it.unimi.dsi.fastutil.ints.Int2ObjectMap.class, 0); private static final Reflection.Field<? extends Map> entityTrackers = Core.getVersion() > 15 ? Reflection.getField(playerChunkMap, Int2ObjectMap.class, 0) : Reflection.getField(playerChunkMap, org.bukkit.craftbukkit.libs.it.unimi.dsi.fastutil.ints.Int2ObjectMap.class, 0);
private static final Class<?> block = Reflection.getClass("{nms.world.level.block}.Block"); private static final Class<?> block = Reflection.getClass("net.minecraft.world.level.block.Block");
private static final Class<?> iBlockData = Reflection.getClass("{nms.world.level.block.state}.IBlockData"); private static final Class<?> iBlockData = Reflection.getClass("net.minecraft.world.level.block.state.BlockState");
private static final Class<?> blockPosition = Reflection.getClass("{nms.core}.BlockPosition"); private static final Class<?> blockPosition = Reflection.getClass("net.minecraft.core.BlockPos");
private final Map trackers; private final Map trackers;
public BlockIdWrapper14() { public BlockIdWrapper14() {
trackers = entityTrackers.get(getPlayerChunkMap.get(getChunkProvider.invoke(getWorldHandle.invoke(Config.world)))); trackers = entityTrackers.get(getPlayerChunkMap.get(getChunkProvider.invoke(getWorldHandle.invoke(Config.world))));
} }
private static final Reflection.MethodInvoker getCombinedId = Reflection.getTypedMethod(block, null, int.class, iBlockData); private static final Reflection.Method getCombinedId = Reflection.getTypedMethod(block, null, int.class, iBlockData);
private static final Reflection.MethodInvoker getNMS = Reflection.getTypedMethod(Reflection.getClass("{obc}.block.CraftBlock"), "getNMS", iBlockData); private static final Reflection.Method getNMS = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.block.CraftBlock"), "getNMS", iBlockData);
@Override @Override
public int blockToId(Block block) { public int blockToId(Block block) {
return (int) getCombinedId.invoke(null, getNMS.invoke(block)); return (int) getCombinedId.invoke(null, getNMS.invoke(block));
} }
private static final Reflection.MethodInvoker getByCombinedId = Reflection.getTypedMethod(block, null, iBlockData, int.class); private static final Reflection.Method getByCombinedId = Reflection.getTypedMethod(block, null, iBlockData, int.class);
private static final Reflection.ConstructorInvoker newBlockPosition = Reflection.getConstructor(blockPosition, int.class, int.class, int.class); private static final Reflection.Constructor newBlockPosition = Reflection.getConstructor(blockPosition, int.class, int.class, int.class);
private static final Reflection.MethodInvoker getTypeAndData = Reflection.getMethod(worldServer, null, blockPosition, iBlockData, int.class); private static final Reflection.Method getTypeAndData = Reflection.getMethod(worldServer, null, blockPosition, iBlockData, int.class);
private static final Reflection.MethodInvoker removeTileEntity = Reflection.getMethod(worldServer, Core.getVersion() > 15 ? "m" : "removeTileEntity", blockPosition); private static final Reflection.Method removeTileEntity = Reflection.getMethod(worldServer, Core.getVersion() > 15 ? "m" : "removeTileEntity", blockPosition);
private static final Reflection.MethodInvoker flagDirty = Reflection.getMethod(chunkProviderServer, null, blockPosition); private static final Reflection.Method flagDirty = Reflection.getMethod(chunkProviderServer, null, blockPosition);
@Override @Override
public void setBlock(World world, int x, int y, int z, int blockState) { public void setBlock(World world, int x, int y, int z, int blockState) {
Object blockData = getByCombinedId.invoke(null, blockState); Object blockData = getByCombinedId.invoke(null, blockState);
@@ -69,25 +70,25 @@ public class BlockIdWrapper14 implements BlockIdWrapper {
flagDirty.invoke(getChunkProvider.invoke(nworld), pos); flagDirty.invoke(getChunkProvider.invoke(nworld), pos);
} }
private static final Class<?> entityTracker = Reflection.getClass("{nms.server.level}.PlayerChunkMap$EntityTracker"); private static final Class<?> entityTracker = Reflection.getClass("net.minecraft.server.level.ChunkMap$TrackedEntity");
private static final Reflection.MethodInvoker updatePlayer = Reflection.getMethod(entityTracker, Core.getVersion() > 15 ? "b" : "updatePlayer", entityPlayer); private static final Reflection.Method updatePlayer = Reflection.getMethod(entityTracker, Core.getVersion() > 15 ? "b" : "updatePlayer", entityPlayer);
@Override @Override
public void trackEntity(Player player, int entity) { public void trackEntity(Player player, Entity entity) {
Object tracker = trackers.get(entity); Object tracker = trackers.get(entity.getEntityId());
if(tracker != null) if(tracker != null)
updatePlayer.invoke(tracker, getPlayer.invoke(player)); updatePlayer.invoke(tracker, getPlayer.invoke(player));
} }
private static final Reflection.MethodInvoker clearPlayer = Reflection.getMethod(entityTracker, Core.getVersion() > 15 ? "a" : "clear", entityPlayer); private static final Reflection.Method clearPlayer = Reflection.getMethod(entityTracker, Core.getVersion() > 15 ? "a" : "clear", entityPlayer);
@Override @Override
public void untrackEntity(Player player, int entity) { public void untrackEntity(Player player, Entity entity) {
Object tracker = trackers.get(entity); Object tracker = trackers.get(entity.getEntityId());
if(tracker != null) if(tracker != null)
clearPlayer.invoke(tracker, getPlayer.invoke(player)); clearPlayer.invoke(tracker, getPlayer.invoke(player));
} }
private static final Reflection.MethodInvoker getMaterialByBlock = Reflection.getTypedMethod(Reflection.getClass("{obc}.util.CraftMagicNumbers"), "getMaterial", Material.class, block); private static final Reflection.Method getMaterialByBlock = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.util.CraftMagicNumbers"), "getMaterial", Material.class, block);
private static final Reflection.MethodInvoker getBlockByBlockData = Reflection.getTypedMethod(iBlockData, null, block); private static final Reflection.Method getBlockByBlockData = Reflection.getTypedMethod(iBlockData, null, block);
@Override @Override
public Material idToMaterial(int blockState) { public Material idToMaterial(int blockState) {
return (Material)getMaterialByBlock.invoke(null, getBlockByBlockData.invoke(getByCombinedId.invoke(null, blockState))); return (Material)getMaterialByBlock.invoke(null, getBlockByBlockData.invoke(getByCombinedId.invoke(null, blockState)));
@@ -42,6 +42,7 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.sql.NodeData;
import de.steamwar.sql.SchematicData; import de.steamwar.sql.SchematicData;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
@@ -144,6 +145,6 @@ public class WorldeditWrapper14 implements WorldeditWrapper {
throw new SecurityException(e); throw new SecurityException(e);
} }
new SchematicData(schem).saveFromBytes(outputStream.toByteArray(), true); new SchematicData(schem).saveFromBytes(outputStream.toByteArray(), NodeData.SchematicFormat.SPONGE_V2);
} }
} }
+2 -2
View File
@@ -22,8 +22,8 @@ plugins {
} }
dependencies { dependencies {
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore", "default"))
compileOnly(project(":FightSystem:FightSystem_Core")) compileOnly(project(":FightSystem:FightSystem_Core", "default"))
compileOnly(libs.nms15) compileOnly(libs.nms15)
compileOnly(libs.worldedit15) compileOnly(libs.worldedit15)
+3 -2
View File
@@ -22,8 +22,9 @@ plugins {
} }
dependencies { dependencies {
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore", "default"))
compileOnly(project(":FightSystem:FightSystem_Core")) compileOnly(project(":FightSystem:FightSystem_Core", "default"))
compileOnly(project(":FightSystem:FightSystem_14", "default"))
compileOnly(libs.spigotapi) compileOnly(libs.spigotapi)
@@ -0,0 +1,42 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
import de.steamwar.Reflection;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import java.util.*;
public class BlockIdWrapper18 extends BlockIdWrapper14 {
private static final Reflection.Field<Map> hiddenEntities = Reflection.getField(Reflection.getClass("org.bukkit.craftbukkit.entity.CraftPlayer"), Map.class, 0, UUID.class, Set.class);
@Override
public void trackEntity(Player player, Entity entity) {
hiddenEntities.get(player).remove(entity.getUniqueId());
super.trackEntity(player, entity);
}
@Override
public void untrackEntity(Player player, Entity entity) {
hiddenEntities.get(player).put(entity.getUniqueId(), new HashSet<>(1));
super.untrackEntity(player, entity);
}
}
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import net.minecraft.server.level.WorldServer; import net.minecraft.server.level.WorldServer;
import net.minecraft.world.level.chunk.Chunk; import net.minecraft.world.level.chunk.Chunk;
@@ -33,9 +33,9 @@ import java.util.stream.StreamSupport;
public class CraftbukkitWrapper18 implements CraftbukkitWrapper { public class CraftbukkitWrapper18 implements CraftbukkitWrapper {
private static final Reflection.MethodInvoker getWorld = Reflection.getMethod(Reflection.getClass("{obc}.CraftWorld"), "getHandle"); private static final Reflection.Method getWorld = Reflection.getMethod(Reflection.getClass("org.bukkit.craftbukkit.CraftWorld"), "getHandle");
private static final Reflection.MethodInvoker getChunk = Reflection.getTypedMethod(net.minecraft.world.level.World.class, null, Chunk.class, int.class, int.class); private static final Reflection.Method getChunk = Reflection.getTypedMethod(net.minecraft.world.level.World.class, null, Chunk.class, int.class, int.class);
private static final Reflection.MethodInvoker getChunkSections = Reflection.getTypedMethod(Chunk.class, null, ChunkSection[].class); private static final Reflection.Method getChunkSections = Reflection.getTypedMethod(Chunk.class, null, ChunkSection[].class);
private ChunkSection[] getChunkSections(World world, int x, int z) { private ChunkSection[] getChunkSections(World world, int x, int z) {
return (ChunkSection[]) getChunkSections.invoke(getChunk.invoke(getWorld.invoke(world), x, z)); return (ChunkSection[]) getChunkSections.invoke(getChunk.invoke(getWorld.invoke(world), x, z));
} }
@@ -46,7 +46,7 @@ public class CraftbukkitWrapper18 implements CraftbukkitWrapper {
System.arraycopy(getChunkSections(backup, x, z), 0, sections, 0, sections.length); System.arraycopy(getChunkSections(backup, x, z), 0, sections, 0, sections.length);
} }
private static final Reflection.MethodInvoker getEntity = Reflection.getTypedMethod(Reflection.getClass("{obc}.entity.CraftEntity"), "getHandle", net.minecraft.world.entity.Entity.class); private static final Reflection.Method getEntity = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.entity.CraftEntity"), "getHandle", net.minecraft.world.entity.Entity.class);
protected net.minecraft.world.entity.Entity getEntity(Entity e) { protected net.minecraft.world.entity.Entity getEntity(Entity e) {
return (net.minecraft.world.entity.Entity) getEntity.invoke(e); return (net.minecraft.world.entity.Entity) getEntity.invoke(e);
} }
@@ -56,8 +56,8 @@ public class CraftbukkitWrapper18 implements CraftbukkitWrapper {
return getEntity(e).ce(); return getEntity(e).ce();
} }
private static final Reflection.MethodInvoker getWorldEntities = Reflection.getTypedMethod(WorldServer.class, null, LevelEntityGetter.class); private static final Reflection.Method getWorldEntities = Reflection.getTypedMethod(WorldServer.class, null, LevelEntityGetter.class);
private static final Reflection.MethodInvoker getIterable = Reflection.getTypedMethod(LevelEntityGetter.class, null, Iterable.class); private static final Reflection.Method getIterable = Reflection.getTypedMethod(LevelEntityGetter.class, null, Iterable.class);
@Override @Override
public Stream<?> entityIterator() { public Stream<?> entityIterator() {
return StreamSupport.stream(((Iterable<?>) getIterable.invoke(getWorldEntities.invoke(getWorld.invoke(Config.world)))).spliterator(), false); return StreamSupport.stream(((Iterable<?>) getIterable.invoke(getWorldEntities.invoke(getWorld.invoke(Config.world)))).spliterator(), false);
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import it.unimi.dsi.fastutil.shorts.Short2ObjectArrayMap; import it.unimi.dsi.fastutil.shorts.Short2ObjectArrayMap;
import net.minecraft.core.BlockPosition; import net.minecraft.core.BlockPosition;
@@ -27,31 +27,22 @@ import net.minecraft.core.SectionPosition;
import net.minecraft.network.protocol.game.PacketPlayOutBlockChange; import net.minecraft.network.protocol.game.PacketPlayOutBlockChange;
import net.minecraft.network.protocol.game.PacketPlayOutMultiBlockChange; import net.minecraft.network.protocol.game.PacketPlayOutMultiBlockChange;
import net.minecraft.world.level.block.state.IBlockData; import net.minecraft.world.level.block.state.IBlockData;
import org.bukkit.block.data.BlockData;
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class HullHiderWrapper18 implements HullHiderWrapper { public class HullHiderWrapper18 implements HullHiderWrapper {
private static final Reflection.MethodInvoker getState = Reflection.getTypedMethod(Reflection.getClass("{obc}.block.data.CraftBlockData"), "getState", IBlockData.class); private static final Reflection.Method getState = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.block.data.CraftBlockData"), "getState", IBlockData.class);
@Override @Override
public Object generateBlockChangePacket(List<Hull.IntVector> changes) { public Object generateBlockChangePacket(List<Hull.IntVector> changes) {
List<Object> blockdata = new ArrayList<>(changes.size()); Object[] blockdata = new Object[changes.size()];
for(int i = 0; i < blockdata.length; i++) {
Hull.IntVector change = changes.get(i);
blockdata[i] = getState.invoke(Config.world.getBlockData(change.getX(), change.getY(), change.getZ()));
}
changes.removeIf(change -> { return generateBlockChangePacket(changes, blockdata);
BlockData data = Config.world.getBlockData(change.getX(), change.getY(), change.getZ());
boolean unchanged = data.getMaterial() == Config.ObfuscateWith || Config.HiddenBlocks.contains(data.getMaterial());
if(!unchanged)
blockdata.add(getState.invoke(data));
return unchanged;
});
if(changes.isEmpty())
return null;
return generateBlockChangePacket(changes, blockdata.toArray());
} }
private Object generateBlockChangePacket(List<Hull.IntVector> changes, Object[] blockdata) { private Object generateBlockChangePacket(List<Hull.IntVector> changes, Object[] blockdata) {
+2 -2
View File
@@ -22,8 +22,8 @@ plugins {
} }
dependencies { dependencies {
compileOnly(project(":FightSystem:FightSystem_Core")) compileOnly(project(":FightSystem:FightSystem_Core", "default"))
compileOnly(project(":FightSystem:FightSystem_18")) compileOnly(project(":FightSystem:FightSystem_18", "default"))
compileOnly(libs.spigotapi) compileOnly(libs.spigotapi)
+2 -2
View File
@@ -22,8 +22,8 @@ plugins {
} }
dependencies { dependencies {
compileOnly(project(":FightSystem:FightSystem_Core")) compileOnly(project(":FightSystem:FightSystem_Core", "default"))
compileOnly(project(":FightSystem:FightSystem_18")) compileOnly(project(":FightSystem:FightSystem_18", "default"))
compileOnly(libs.spigotapi) compileOnly(libs.spigotapi)
@@ -0,0 +1,43 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
plugins {
steamwar.java
}
dependencies {
compileOnly(project(":FightSystem:FightSystem_Core", "default"))
compileOnly(project(":FightSystem:FightSystem_18", "default"))
compileOnly(libs.paperapi21) {
attributes {
// Very Hacky, but it works
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 21)
}
}
compileOnly(libs.nms21) {
attributes {
// Very Hacky, but it works
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 21)
}
}
compileOnly(libs.fastutil)
}
@@ -1,7 +1,7 @@
/* /*
* This file is a part of the SteamWar software. * This file is a part of the SteamWar software.
* *
* Copyright (C) 2023 SteamWar.de-Serverteam * Copyright (C) 2024 SteamWar.de-Serverteam
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by * it under the terms of the GNU Affero General Public License as published by
@@ -17,15 +17,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.steamwar.fightsystem.ai.chaos; package de.steamwar.fightsystem.utils;
import org.bukkit.util.Vector; import org.bukkit.entity.Entity;
public class Bridge { public class CraftbukkitWrapper21 extends CraftbukkitWrapper18 {
private Bridge() {
@Override
public float headRotation(Entity e) {
return getEntity(e).bS();
} }
public static final Vector BRIDGE_POS = new Vector(25, 14, 24);
public static final Vector BRIDGE_SHIELDS = new Vector(25, 15, 25);
public static final Vector BRIDGE_MG = new Vector(21, 15, 24);
} }
+2 -2
View File
@@ -22,8 +22,8 @@ plugins {
} }
dependencies { dependencies {
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore", "default"))
compileOnly(project(":FightSystem:FightSystem_Core")) compileOnly(project(":FightSystem:FightSystem_Core", "default"))
compileOnly(libs.nms8) compileOnly(libs.nms8)
compileOnly(libs.worldedit12) compileOnly(libs.worldedit12)
@@ -19,19 +19,20 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class BlockIdWrapper8 implements BlockIdWrapper { public class BlockIdWrapper8 implements BlockIdWrapper {
private static final Class<?> entityTracker = Reflection.getClass("{nms}.EntityTracker"); private static final Class<?> entityTracker = Reflection.getClass("net.minecraft.EntityTracker");
private static final Reflection.FieldAccessor<?> getEntityTracker = Reflection.getField(worldServer, entityTracker, 0); private static final Reflection.Field<?> getEntityTracker = Reflection.getField(worldServer, entityTracker, 0);
private static final Class<?> intHashMap = Reflection.getClass("{nms}.IntHashMap"); private static final Class<?> intHashMap = Reflection.getClass("net.minecraft.IntHashMap");
private static final Reflection.FieldAccessor<?> getTrackedEntities = Reflection.getField(entityTracker, intHashMap, 0); private static final Reflection.Field<?> getTrackedEntities = Reflection.getField(entityTracker, intHashMap, 0);
private final Object trackers; private final Object trackers;
public BlockIdWrapper8() { public BlockIdWrapper8() {
@@ -53,20 +54,20 @@ public class BlockIdWrapper8 implements BlockIdWrapper {
world.getBlockAt(x, y, z).setTypeIdAndData(blockState >> 4, (byte)(blockState & 0b1111), false); world.getBlockAt(x, y, z).setTypeIdAndData(blockState >> 4, (byte)(blockState & 0b1111), false);
} }
private static final Class<?> entityTrackerEntry = Reflection.getClass("{nms}.EntityTrackerEntry"); private static final Class<?> entityTrackerEntry = Reflection.getClass("net.minecraft.EntityTrackerEntry");
private static final Reflection.MethodInvoker get = Reflection.getTypedMethod(intHashMap, "get", Object.class, int.class); private static final Reflection.Method get = Reflection.getTypedMethod(intHashMap, "get", Object.class, int.class);
private static final Reflection.MethodInvoker updatePlayer = Reflection.getMethod(entityTrackerEntry, "updatePlayer", entityPlayer); private static final Reflection.Method updatePlayer = Reflection.getMethod(entityTrackerEntry, "updatePlayer", entityPlayer);
@Override @Override
public void trackEntity(Player player, int entity) { public void trackEntity(Player player, Entity entity) {
Object tracker = get.invoke(trackers, entity); Object tracker = get.invoke(trackers, entity.getEntityId());
if(tracker != null) if(tracker != null)
updatePlayer.invoke(tracker, getPlayer.invoke(player)); updatePlayer.invoke(tracker, getPlayer.invoke(player));
} }
private static final Reflection.MethodInvoker clearPlayer = Reflection.getMethod(entityTrackerEntry, "a", entityPlayer); private static final Reflection.Method clearPlayer = Reflection.getMethod(entityTrackerEntry, "a", entityPlayer);
@Override @Override
public void untrackEntity(Player player, int entity) { public void untrackEntity(Player player, Entity entity) {
Object tracker = get.invoke(trackers, entity); Object tracker = get.invoke(trackers, entity.getEntityId());
if(tracker != null) if(tracker != null)
clearPlayer.invoke(tracker, getPlayer.invoke(player)); clearPlayer.invoke(tracker, getPlayer.invoke(player));
} }
@@ -19,26 +19,17 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import org.bukkit.Material;
import java.util.List; import java.util.List;
public class HullHiderWrapper8 implements HullHiderWrapper { public class HullHiderWrapper8 implements HullHiderWrapper {
private static final Reflection.ConstructorInvoker newMultiBlockChange = Reflection.getConstructor("{nms}.PacketPlayOutMultiBlockChange", int.class, short[].class, Reflection.getClass("{nms}.Chunk")); private static final Reflection.Constructor newMultiBlockChange = Reflection.getConstructor("net.minecraft.PacketPlayOutMultiBlockChange", int.class, short[].class, Reflection.getClass("net.minecraft.Chunk"));
private static final Reflection.MethodInvoker getHandle = Reflection.getMethod("{obc}.CraftChunk", "getHandle"); private static final Reflection.Method getHandle = Reflection.getMethod("org.bukkit.craftbukkit.CraftChunk", "getHandle");
@Override @Override
public Object generateBlockChangePacket(List<Hull.IntVector> changes) { public Object generateBlockChangePacket(List<Hull.IntVector> changes) {
changes.removeIf(change -> {
Material material = Config.world.getBlockAt(change.getX(), change.getY(), change.getZ()).getType();
return material == Config.ObfuscateWith || Config.HiddenBlocks.contains(material);
});
if(changes.isEmpty())
return null;
Hull.IntVector chunk = changes.get(0); Hull.IntVector chunk = changes.get(0);
chunk = new Hull.IntVector(chunk.getX() >> 4, chunk.getY() >> 4, chunk.getZ() >> 4); chunk = new Hull.IntVector(chunk.getX() >> 4, chunk.getY() >> 4, chunk.getZ() >> 4);
int xOffset = 16*chunk.getX(); int xOffset = 16*chunk.getX();
@@ -39,6 +39,7 @@ import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.sql.NodeData;
import de.steamwar.sql.SchematicData; import de.steamwar.sql.SchematicData;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
@@ -142,6 +143,6 @@ public class WorldeditWrapper8 implements WorldeditWrapper {
throw new SecurityException(e); throw new SecurityException(e);
} }
new SchematicData(schem).saveFromBytes(outputStream.toByteArray(), false); new SchematicData(schem).saveFromBytes(outputStream.toByteArray(), NodeData.SchematicFormat.MCEDIT);
} }
} }
+3 -3
View File
@@ -22,9 +22,9 @@ plugins {
} }
dependencies { dependencies {
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore", "default"))
compileOnly(project(":FightSystem:FightSystem_Core")) compileOnly(project(":FightSystem:FightSystem_Core", "default"))
compileOnly(project(":FightSystem:FightSystem_8")) compileOnly(project(":FightSystem:FightSystem_8", "default"))
compileOnly(libs.nms9) compileOnly(libs.nms9)
} }
@@ -19,7 +19,7 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.listener.Recording; import de.steamwar.fightsystem.listener.Recording;
@@ -43,9 +43,9 @@ import java.util.Map;
public class BountifulWrapper9 implements BountifulWrapper { public class BountifulWrapper9 implements BountifulWrapper {
private static final Class<?> enumHand = Reflection.getClass("{nms.world}.EnumHand"); private static final Class<?> enumHand = Reflection.getClass("net.minecraft.world.InteractionHand");
private static final Object mainHand = enumHand.getEnumConstants()[0]; private static final Object mainHand = enumHand.getEnumConstants()[0];
private static final Reflection.FieldAccessor<?> blockPlaceHand = Reflection.getField(Recording.blockPlacePacket, enumHand, 0); private static final Reflection.Field<?> blockPlaceHand = Reflection.getField(Recording.blockPlacePacket, enumHand, 0);
@Override @Override
public boolean mainHand(Object packet) { public boolean mainHand(Object packet) {
@@ -22,7 +22,7 @@ plugins {
} }
dependencies { dependencies {
compileOnly(project(":SpigotCore")) compileOnly(project(":SpigotCore", "default"))
compileOnly(libs.spigotapi) compileOnly(libs.spigotapi)
@@ -344,7 +344,7 @@ public class Config {
EventTeamBlueID = team1.getTeamId(); EventTeamBlueID = team1.getTeamId();
EventTeamRedID = team2.getTeamId(); EventTeamRedID = team2.getTeamId();
BothTeamsPublic = EventTeamRedID == 0 && EventTeamBlueID == 0; BothTeamsPublic = EventTeamRedID == 0 && EventTeamBlueID == 0;
SpectatePort = EventKampf.getSpectatePort(); SpectatePort = EventKampf.getSpectatePort() == null ? 0 : EventKampf.getSpectatePort();
LiveReplay = SpectatePort != 0; LiveReplay = SpectatePort != 0;
Referees = Referee.get(Config.EventKampf.getEventID()); Referees = Referee.get(Config.EventKampf.getEventID());
@@ -153,7 +153,6 @@ public class FightSystem extends JavaPlugin {
new GamemodeCommand(); new GamemodeCommand();
new ReadyCommand(); new ReadyCommand();
new AkCommand(); new AkCommand();
new LeaderCommand();
new LockschemCommand(); new LockschemCommand();
new StateCommand(); new StateCommand();
new SkipCommand(); new SkipCommand();
@@ -34,9 +34,6 @@ GAMEMODE_NOT_ALLOWED=§cChanging gamemode is not permitted
GAMEMODE_UNKNOWN=§cUnknown gamemode {0} GAMEMODE_UNKNOWN=§cUnknown gamemode {0}
GAMEMODE_HELP=§8/§7gm §8[§egamemode§8] GAMEMODE_HELP=§8/§7gm §8[§egamemode§8]
LEADER_FULL=§cAll teams already have a leader
ALREADY_IN_TEAM=§cYou are already in a team
LOCKSCHEM_HELP=§8/§7lockschem §8[§eteam§8] LOCKSCHEM_HELP=§8/§7lockschem §8[§eteam§8]
UNKNOWN_TEAM=§cThis team does not exist UNKNOWN_TEAM=§cThis team does not exist
LOCKSCHEM_LOCKED=§7Schematic locked LOCKSCHEM_LOCKED=§7Schematic locked
@@ -65,7 +62,9 @@ STATE_RUNNING=§eFighting phase
STATE_SPECTATE_WIN=§7Victory {0} STATE_SPECTATE_WIN=§7Victory {0}
STATE_SPECTATE_TIE=§7Draw STATE_SPECTATE_TIE=§7Draw
REMOVE_TITLE=Kick player MANAGE_TITLE=Manage players
MANAGE_LORE1=§eLeft §7click§8: §ekick
MANAGE_LORE2=§eRight §7click§8: §epromote
KIT_SELECTION_TITLE=Kit selection KIT_SELECTION_TITLE=Kit selection
KIT_NO_KITS=§cNo kits found KIT_NO_KITS=§cNo kits found
@@ -113,7 +112,7 @@ SKIP_NOT_READY=§c§mSkipping to next event
TEAM_CHAT={0}{1}§8» {0}{2} TEAM_CHAT={0}{1}§8» {0}{2}
CHOOSE_KIT=§eChoose kit CHOOSE_KIT=§eChoose kit
RESPAWN=§eRespawn RESPAWN=§eRespawn
REMOVE_PLAYERS=§cKick player MANAGE_PLAYERS=§cManage players
CHOOSE_SCHEMATIC=§eChoose {0} CHOOSE_SCHEMATIC=§eChoose {0}
SCHEMATIC_REQUIRED=§cChoose a schematic first SCHEMATIC_REQUIRED=§cChoose a schematic first
ADD_AI=§eAdd AI ADD_AI=§eAdd AI
@@ -141,7 +140,6 @@ NO_TELEPORT=§cYou are not allowed to use this teleport function
OPEN_INVENTORY_TO_CUSTOMIZE=§eOpen inventory to customize your kit OPEN_INVENTORY_TO_CUSTOMIZE=§eOpen inventory to customize your kit
NO_ENTERN=§cYou may not board NO_ENTERN=§cYou may not board
NO_TEAMAREA=§cYou are not allowed in the team area NO_TEAMAREA=§cYou are not allowed in the team area
TEST_BECOME_LEADER=§7Become a team leader with §8/§eleader
PREPARE_SCHEM_DELETED=§cApparently the schematic to be submitted was deleted. submission aborted. PREPARE_SCHEM_DELETED=§cApparently the schematic to be submitted was deleted. submission aborted.
PREPARE_SCHEM_EXISTS=§cThere is already a schematic with the suffix -prepared, please rename or delete it, submission aborted. PREPARE_SCHEM_EXISTS=§cThere is already a schematic with the suffix -prepared, please rename or delete it, submission aborted.
PREPARE_ACTIVE_PISTON=§cMoving pistons were found in the team area, submission aborted. PREPARE_ACTIVE_PISTON=§cMoving pistons were found in the team area, submission aborted.
@@ -32,9 +32,6 @@ GAMEMODE_NOT_ALLOWED=§cSpielmodusänderung verboten
GAMEMODE_UNKNOWN=§cUnbekannter Spielmodus {0} GAMEMODE_UNKNOWN=§cUnbekannter Spielmodus {0}
GAMEMODE_HELP=§8/§7gm §8[§eSpielmodus§8] GAMEMODE_HELP=§8/§7gm §8[§eSpielmodus§8]
LEADER_FULL=§cAlle Teams haben bereits einen Leader
ALREADY_IN_TEAM=§cDu bist bereits in einem Team
LOCKSCHEM_HELP=§8/§7lockschem §8[§eTeam§8] LOCKSCHEM_HELP=§8/§7lockschem §8[§eTeam§8]
UNKNOWN_TEAM=§cDieses Team existiert nicht UNKNOWN_TEAM=§cDieses Team existiert nicht
LOCKSCHEM_LOCKED=§7Schematic gesperrt LOCKSCHEM_LOCKED=§7Schematic gesperrt
@@ -59,7 +56,9 @@ STATE_RUNNING=§eKampfphase
STATE_SPECTATE_WIN=§7Sieg {0} STATE_SPECTATE_WIN=§7Sieg {0}
STATE_SPECTATE_TIE=§7Unentschieden STATE_SPECTATE_TIE=§7Unentschieden
REMOVE_TITLE=Spieler rauswerfen MANAGE_TITLE=Mitspieler verwalten
MANAGE_LORE1=§eLinksklick§8: §eRauswurf
MANAGE_LORE2=§eRechtsklick§8: §eBefördern
KIT_SELECTION_TITLE=Kitauswahl KIT_SELECTION_TITLE=Kitauswahl
KIT_NO_KITS=§cKeine Kits gefunden KIT_NO_KITS=§cKeine Kits gefunden
@@ -106,7 +105,7 @@ SKIP_READY=§aBeschleunigung zum nächsten Event
SKIP_NOT_READY=§c§mBeschleunigung zum nächsten Event SKIP_NOT_READY=§c§mBeschleunigung zum nächsten Event
CHOOSE_KIT=§eKit wählen CHOOSE_KIT=§eKit wählen
RESPAWN=§eRespawn RESPAWN=§eRespawn
REMOVE_PLAYERS=§cSpieler rauswerfen MANAGE_PLAYERS=§cMitspieler verwalten
CHOOSE_SCHEMATIC=§e{0} wählen CHOOSE_SCHEMATIC=§e{0} wählen
SCHEMATIC_REQUIRED=§cZuerst muss eine Schematic gewählt sein SCHEMATIC_REQUIRED=§cZuerst muss eine Schematic gewählt sein
ADD_AI=§eKI hinzufügen ADD_AI=§eKI hinzufügen
@@ -134,7 +133,6 @@ NO_TELEPORT=§cDu darfst diese Teleportfunktion nicht benutzen
OPEN_INVENTORY_TO_CUSTOMIZE=§eInventar zum Anpassen des Kits öffnen OPEN_INVENTORY_TO_CUSTOMIZE=§eInventar zum Anpassen des Kits öffnen
NO_ENTERN=§cDu darfst nicht entern NO_ENTERN=§cDu darfst nicht entern
NO_TEAMAREA=§cDu darfst nicht zu den Teams NO_TEAMAREA=§cDu darfst nicht zu den Teams
TEST_BECOME_LEADER=§7Werde zum Teamleader mit §8/§eleader
PREPARE_SCHEM_DELETED=§cAnscheinend wurde die auszufahrende Schematic gelöscht, Einsenden wird abgebrochen. PREPARE_SCHEM_DELETED=§cAnscheinend wurde die auszufahrende Schematic gelöscht, Einsenden wird abgebrochen.
PREPARE_SCHEM_EXISTS=§cEs existiert bereits eine Schem mit Namenszusatz -prepared, diese bitte umbenennen oder löschen, Einsenden wird abgebrochen. PREPARE_SCHEM_EXISTS=§cEs existiert bereits eine Schem mit Namenszusatz -prepared, diese bitte umbenennen oder löschen, Einsenden wird abgebrochen.
PREPARE_ACTIVE_PISTON=§cIm Teambereich wurden sich noch bewegende Pistons gefunden, Einsenden wird abgebrochen. PREPARE_ACTIVE_PISTON=§cIm Teambereich wurden sich noch bewegende Pistons gefunden, Einsenden wird abgebrochen.
@@ -19,11 +19,9 @@
package de.steamwar.fightsystem.ai; package de.steamwar.fightsystem.ai;
import com.comphenix.tinyprotocol.Reflection; import de.steamwar.Reflection;
import de.steamwar.core.Core; import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.ai.chaos.ChaosAI;
import de.steamwar.fightsystem.ai.lixfel.LixfelAI;
import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FightTeam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
@@ -37,9 +35,7 @@ import java.util.stream.Collectors;
@AllArgsConstructor @AllArgsConstructor
public class AIManager { public class AIManager {
private static final List<AIManager> AIs = Arrays.asList( private static final List<AIManager> AIs = Arrays.asList(
new AIManager(DummyAI.class, Material.STONE, () -> true), new AIManager(DummyAI.class, Material.STONE, () -> ArenaMode.Test.contains(Config.mode))
new AIManager(LixfelAI.class, Material.TNT, () -> Core.getVersion() >= 14),
new AIManager(ChaosAI.class, Material.SLIME_BLOCK, () -> Config.SchematicType.toDB().equals("miniwargear19") && Core.getVersion() >= 14)
); );
public static List<AIManager> availableAIs() { public static List<AIManager> availableAIs() {
@@ -1,172 +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.fightsystem.ai.chaos;
import org.bukkit.util.Vector;
public class Cannon {
public final Vector[] tnt;
public final Vector button;
public final Vector load;
public final Vector escape;
public final String name;
private Cannon(String name, Vector[] tnt, Vector button, Vector load, Vector escape) {
this.tnt = tnt;
this.button = button;
this.load = load;
this.escape = escape;
this.name = name;
}
public static final Vector[] DS_LEFT_TNT = new Vector[] {
new Vector(40, 24, 12),
new Vector(39, 24, 12),
new Vector(38, 23, 12),
new Vector(38, 24, 12),
new Vector(40, 23, 15),
new Vector(40, 23, 14),
new Vector(40, 24, 15),
new Vector(40, 24, 14),
new Vector(38, 23, 15),
new Vector(38, 23, 14),
new Vector(38, 24, 15),
new Vector(38, 24, 14),
new Vector(40, 23, 12),
};
public static final Vector DS_LEFT_BUTTON = new Vector(39, 25, 11);
public static final Vector DS_LEFT_LOAD = new Vector(39, 25, 13);
public static final Vector DS_LEFT_ESCAPE = new Vector(31, 26, 13);
public static final Cannon DS_LEFT = new Cannon("Downstäb Links", DS_LEFT_TNT, DS_LEFT_BUTTON, DS_LEFT_LOAD, DS_LEFT_ESCAPE);
public static final Vector[] DS_RIGHT_TNT = new Vector[] {
new Vector(12, 24, 12),
new Vector(11, 24, 12),
new Vector(10, 23, 12),
new Vector(10, 24, 12),
new Vector(10, 23, 15),
new Vector(10, 23, 14),
new Vector(10, 24, 15),
new Vector(10, 24, 14),
new Vector(12, 23, 14),
new Vector(12, 24, 14),
new Vector(12, 23, 15),
new Vector(12, 24, 15),
new Vector(12, 23, 12),
};
public static final Vector DS_RIGHT_BUTTON = new Vector(11, 25, 11);
public static final Vector DS_RIGHT_LOAD = new Vector(11, 25, 13);
public static final Vector DS_RIGHT_ESCAPE = new Vector(19, 26, 13);
public static final Cannon DS_RIGHT = new Cannon("Downstäb Rechts", DS_RIGHT_TNT, DS_RIGHT_BUTTON, DS_RIGHT_LOAD, DS_RIGHT_ESCAPE);
public static final Vector[] STATIC_LEFT_TNT = new Vector[] {
new Vector(37, 17, 15),
new Vector(37, 17, 14),
new Vector(37, 18, 16),
new Vector(37, 18, 15),
new Vector(37, 18, 14),
new Vector(36, 17, 16),
new Vector(36, 17, 15),
new Vector(36, 17, 14),
new Vector(36, 18, 16),
new Vector(36, 18, 15),
new Vector(36, 18, 14),
new Vector(37, 17, 16),
};
public static final Vector STATIC_LEFT_BUTTON = new Vector(38, 18, 11);
public static final Vector STATIC_LEFT_LOAD = new Vector(37, 17, 12);
public static final Vector STATIC_LEFT_ESCAPE = new Vector(30, 13, 9);
public static final Cannon STATIC_LEFT = new Cannon("Lupf Links", STATIC_LEFT_TNT, STATIC_LEFT_BUTTON, STATIC_LEFT_LOAD, STATIC_LEFT_ESCAPE);
public static final Vector[] STATIC_RIGHT_TNT = new Vector[] {
new Vector(14, 17, 15),
new Vector(14, 18, 16),
new Vector(14, 18, 15),
new Vector(14, 17, 14),
new Vector(14, 18, 14),
new Vector(13, 17, 16),
new Vector(13, 17, 15),
new Vector(13, 17, 14),
new Vector(13, 18, 16),
new Vector(13, 18, 15),
new Vector(13, 18, 14),
new Vector(14, 17, 16),
};
public static final Vector STATIC_RIGHT_BUTTON = new Vector(12, 18, 11);
public static final Vector STATIC_RIGHT_LOAD = new Vector(13, 17, 12);
public static final Vector STATIC_RIGHT_ESCAPE = new Vector(20, 13, 9);
public static final Cannon STATIC_RIGHT = new Cannon("Lupf Rechts", STATIC_RIGHT_TNT, STATIC_RIGHT_BUTTON, STATIC_RIGHT_LOAD, STATIC_RIGHT_ESCAPE);
public static final Vector[] AK_TNT = new Vector[] {
new Vector(10, 7, 17),
new Vector(10, 11, 17),
new Vector(10, 10, 17),
new Vector(10, 8, 17),
new Vector(10, 9, 17),
new Vector(10, 7, 15),
new Vector(11, 7, 15),
new Vector(12, 7, 15),
new Vector(10, 10, 15),
new Vector(11, 10, 15),
new Vector(12, 10, 15),
new Vector(12, 8, 15),
new Vector(12, 9, 15),
new Vector(11, 8, 15),
new Vector(11, 9, 15),
new Vector(10, 8, 15),
new Vector(10, 9, 15),
new Vector(10, 7, 19),
new Vector(11, 7, 19),
new Vector(12, 7, 19),
new Vector(12, 8, 19),
new Vector(11, 8, 19),
new Vector(10, 8, 19),
new Vector(10, 10, 19),
new Vector(11, 10, 19),
new Vector(12, 10, 19),
new Vector(12, 9, 19),
new Vector(11, 9, 19),
new Vector(10, 9, 19),
new Vector(10, 6, 17),
};
public static final Vector AK_BUTTON = new Vector(9, 9, 16);
public static final Vector AK_LOAD = new Vector(11, 8, 17);
public static final Cannon AK = new Cannon("Arschkratzer", AK_TNT, AK_BUTTON, AK_LOAD, null);
public static final Vector[] HA_RIGHT_TNT = new Vector[] {
new Vector(23, 5, 9),
new Vector(23, 6, 9),
new Vector(23, 7, 9),
new Vector(23, 8, 9),
};
public static final Vector[] HA_LEFT_TNT = new Vector[] {
new Vector(27, 5, 9),
new Vector(27, 6, 9),
new Vector(27, 7, 9),
new Vector(27, 8, 9),
};
public static final Vector HA_RIGHT_LOAD = new Vector(23, 8, 8);
public static final Vector HA_LEFT_LOAD = new Vector(27, 8, 8);
public static final Cannon HA_LEFT = new Cannon("Halbautomatik Links", HA_LEFT_TNT, null, HA_LEFT_LOAD, null);
public static final Cannon HA_RIGHT = new Cannon("Halbautomatik Rechts", HA_RIGHT_TNT, null, HA_RIGHT_LOAD, null);
}

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