diff options
author | Eryk Ruta <70776766+kingstefan26@users.noreply.github.com> | 2022-11-01 15:51:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-01 23:51:30 +0900 |
commit | 292fbd05e13271ca3ad99ebe00ae4302e04848f3 (patch) | |
tree | 2a7aeb12ab95ff688479a4727f76e3e4152c30b5 /src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java | |
parent | dd7a4209752715db544b2fef804da9762c532cdc (diff) | |
download | Skyblock-Dungeons-Guide-292fbd05e13271ca3ad99ebe00ae4302e04848f3.tar.gz Skyblock-Dungeons-Guide-292fbd05e13271ca3ad99ebe00ae4302e04848f3.tar.bz2 Skyblock-Dungeons-Guide-292fbd05e13271ca3ad99ebe00ae4302e04848f3.zip |
3rd time is the charm (#70)
* Updated some dependencies, used my crusty skytils forgegradle fork + removed the IRRELEVANT hytils fixes. generally made the thing build
* made the logs less annoying
* temp fix so it doesn't throw an exception
* FAT REFACTOR
General refactor on
Authenticator.java
DungeonsGuide.java
Main.java
removed unnecessary imports where not needed
to be removed DGInterface.java (no real reason to exist)
in DungeonsGuide.java made the retry stomp a singe-thread executor, so it doesn't leak when offline
added an "offline mode" so it doesn't just error when server down
TODO: move auth to DungeonsGuide.java and make it retry when network down on launch
* New auth implementation that should replace the old one:
does all the things the old one did
removed progressBar cuz it would make the impl 3x more complicated in the name of a splash screen
added a token changed event (so now it supports re-logging with a different account)
code is (should) be more readable / extensible
TODO: surgically replace Authenticator.java with new impl AND support re-logging
* Made the chat processor logger name less obnoxious
* implemented my implementation of an implementation of auth
can and is very buggy, essentially the loading of the remote classes but the mod works so idk
TODO: MAKE STOMP NOT DO STUFF TILL STOMPCONNECTED IS EMITTED
* fix for stomp client null bc forge events not going tru on pre-init
TODO: make work and test the web loadable classes, then make all the stuff that relies on stomp not throw exceptions when stomp is not connected
* move the create auth method into AuthProvider interface,
so we don't clutter AuthManager with implementation details
* Decouple AuthProviderUtil and DgAuth,
move some stuff around and make it more readable
* moved AuthUtil to make more sense
* de-clutter the tree a little bit
* Inline StompClientStatus.java / refactor
* inline the useless interface
* refactoringgg
* fix ahUtils exeption spam
* small StompClient refactor
* fix GLCursors exeption spam + logger
* make sure we are authenticated when downloading resources
* new .destination("value") instead of .header("destination", "value")
* StompMessageHandler -> StompMessageSubscription
* Introduced StompManager
* fix dungeon map not showing ppl heads
* ehhh
* wip (commit cuz im chekig out)
* fix player profile not never loading in chat
* remove this specific line
* fix player profile not never loading in chat
* cut out hychat like a cancer
* ApiFetchur now caches whole players not single profiles,
added a switch profile button in gui
* ugh git
* Revert "cut out hychat like a cancer"
This reverts commit 2ee11afa
* ugh git x2
* I tried, good luck maintaining this
* forgot to uncomment hychat fix
* make my new party ready work and look ok
* change the look and add some "somewhere" locations
* make stomp connection "null safe"
* i hate git
* introduce callbacks on parameter change for cleaner code
add one example
* impl new system,
half way done
* now shows which profile is now selected
put button on top
a lil refactor
* fix player profile sometimes not loading
* add players knowing who is using dg (try to)
* announcing that we are a dg user will get reworked in the future
* update deps
* make it not spam logs
* sanity check for premium features so it doesn't 403
* add YoMamaOutdated that checks if you are using outdated dg
* hychat?? anyone
* try catch in FeatureRegistry
* added Ether transmission ability
* chat shredder borken, disabled for now
* party deserves its own folder
* dungeon stuff in dungeon folder
* events folders moved
* fix score data collection hanging forever if stomp is not connected
* fix stomp never connecting
* re-add the removed
* fix wonky rendering
* server side implementation is not ready, canning this for a future release
* attempt to fix heads loading on main thread
* discord
* me when sonar lint
* new consumer based stomp subscriptions
* replace old with new subscriptions
* remove the remains of StompSubscription and replace CloseListener with a forge event
* StompSubscription is now a functional interface
* remove unnecessary event message chains,
feature logic should be in the feature
* fix events being set up wrongly
* Revert "fix events being set up wrongly"
This reverts commit e6ea7efa557a5f5c8a3ea33be998717bc024b8cb.
* Revert "remove unnecessary event message chains,"
This reverts commit 96f508bae85b33cdcef6be19226c00fc52a1439b.
* fix stomp client sending payload object instead of the actual payload
* fix null pointer on empty party
* fix players with cosmetics name being white in tab
* added message when not connected to dg
changed YoMamaOutdated to use CloudFlare workers
added client sided message queue
* the mod doesn't init when outdated
* mcmod.info
* dont busy wait in authmenager
* test pepole crusty tests
* chill out the authmanager
* name the thread pool in auth manager
* clear most compiler warnings
* make outdated check allow to play without the mod initialized
* make first startup VERY noticeable, move config creation to main
* major dungeon package refactor
* refactor checkpoint
* refactor checkpoint #1
* final refactor checkpoint #2
* remove the player if from version check, made the version check not nesssery for playing
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* remove trap room fix that didnt fix anything
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* make secret beacons optional
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* make the checkmarks on map align with the rest of everyone
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* removed debug function
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* move the menus to make more sense + make destination text on secrets optional
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* improve dungeonMap performance by ~90%
temporarly disabled 9 slot map player location due to bugs
fix DungeonContext not getting player from ScoreBoard
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* add epic countdown on dungeon start (still wip)
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* added a option to cache blockstaes
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* added TabListUtil
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* fixed epic countdown
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* (i want to sleep) made all the dungeon room detection async
TODO: fix ol the bugs i created by doing that
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* stuff still broken but almost playable, unlike last commit
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* upload build jar to discord
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* cache the deps for the love of god
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* who needs linux and 32bit windows anyway
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* only upload to discord on beta branch
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* added "kick" when a member joins party
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* move stuff that sends chat to player into a separate class
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* use our chat queue instead of calling `thePlayer.addChatMessage` to proxy ourselves from 1.8 code
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* Added and implemented MortDetector2000.java
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* extract duplicate + make more readable
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* added dummy support in FeatureDebugTrap
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* gradle now puts version in mcmod.info
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* remove side effects from DgAuth.java
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* move debug commands into debug CommandDgDebug.java
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* fix key being wrong
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* move epic countdown to dungeon huds, clean up
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* Revert "who needs linux and 32bit windows anyway"
This reverts commit 0f3c2d544a70fc799cd3215dad5e997c0c8b6c06.
* make FeatureRegistry not static initialise to get rid of "ClassNotDefined" errors
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* null check on Exception since it threw NullPointers
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* finish up progress bar in DungeonsGuide.java
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* warn about null features
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* move stuff around in SkyblockStatus, move the stuff that updates status into SkyblockStatus from DungeonListener
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* rename DungeonGodObject.java to DungeonFacade.java
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* add cleanChat clause in FeatureEpicCountdown
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* implement getPreRequisites and isComplete in ActionBreakWithSuperBoom
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* clean up FeatureParameter
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* eliminate possible state inconsistency in DungeonListener
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* move percentage from DungeonFacade to DungeonContext
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* move `purge` and `partymax` back into CommandDungeonsGuide
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* stop repeating ReceiveChatQueue in ChatTransmitter
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* Clean up DungeonsGuide
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* move `sendDebugChat` to `ChatTransmitter.java`
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* change CommandDgDebug into a `else if` from an `switch` because some bigot decided its better
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* duplicate code since it currently doesn't make sense, to be reworked
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* fix typo
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* remove the trycatch so we fail fast
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* fix null pointer when trying to get fontRenderer before minecraft is initialised
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* broken checkpoint 0
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* broken checkpoint 1
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* Revert "broken checkpoint 1"
This reverts commit 64985e6287c7b5650b509668e42b9803e25c419c.
* Revert "broken checkpoint 0"
This reverts commit 5f62e1345d9c8e7f66f1e5792004a05027913d92.
* Revert "fix null pointer when trying to get fontRenderer before minecraft is initialised"
This reverts commit 57d92a78d31c410f699b58c8995c94055d57e2a4.
* Revert "remove the trycatch so we fail fast"
This reverts commit 12772255ed575e411fb99edf37ec16d0e5f42924.
* Revert "fix typo"
This reverts commit aa96cc2436d3ead42d53ead78f3334fac5100713.
* Revert "duplicate code since it currently doesn't make sense, to be reworked"
This reverts commit 6d71b88e3102d23bcfd90d85e8996327776fd52f.
* Revert "change CommandDgDebug into a `else if` from an `switch` because some bigot decided its better"
This reverts commit ffea84d9b5fd4adbe034a88249bc920eafa7c53a.
* Revert "move `sendDebugChat` to `ChatTransmitter.java`"
This reverts commit 5b8b2e22fff33768134a01c15c7650100ebb9257.
* Revert "Clean up DungeonsGuide"
This reverts commit 2069ad3ebc4344eb1e778954dc1d8f6c9303de69.
* fix typo
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
(cherry picked from commit aa96cc2436d3ead42d53ead78f3334fac5100713)
* duplicate code since it currently doesn't make sense, to be reworked
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
(cherry picked from commit 6d71b88e3102d23bcfd90d85e8996327776fd52f)
* change CommandDgDebug into a `else if` from an `switch` because some bigot decided its better
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
(cherry picked from commit ffea84d9b5fd4adbe034a88249bc920eafa7c53a)
* move debug chat into ChatTransmitter
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* null pointer in SkyblockStatus bc context was not initialised yet
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* move dungeon starting door detection up the tree since it was a duplicate in both children, inline MortDetector2000
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* move dungeon name to DungeonContext
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* clean up Main
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* separate the "loader" and "mod"
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* separate DungeonsGuide and Main even more
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* change singleton implementation of DungeonsGuide
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* move classes since their paths are hardcoded into roomdatas
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* create CatacombsDataProvider.java and implement it
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* remove unnecessary `DungeonsGuide.getDungeonsGuide();` (IntelliJ refactor bug)
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* move `help` text in commands
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* a certain someone hates switch statements
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* remove my version check, since we have to wait for out lord and savior to make his own
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* make `Main` and `DungeonsGuide` compatible with supported jar classloading
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* make the beta upload action run on push
since it didnt get the secret on pull request and failed anyway,
TODO: make the jar name not hardcoded
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
* upload all jar
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
Signed-off-by: kingstefan26 <70776766+kingstefan26@users.noreply.github.com>
Co-authored-by: syeyoung <42869671+cyoung06@users.noreply.github.com>
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java | 450 |
1 files changed, 450 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java b/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java new file mode 100644 index 00000000..b3f8dd19 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java @@ -0,0 +1,450 @@ +package kr.syeyoung.dungeonsguide.mod.commands; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.Main; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.NestedCategory; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.MapProcessor; +import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; +import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.DungeonSpecificDataProvider; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; +import kr.syeyoung.dungeonsguide.mod.dungeon.events.DungeonEventHolder; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.*; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui.GuiDungeonRoomEdit; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoomInfoRegistry; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessor; +import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonLeftEvent; +import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.party.PartyContext; +import kr.syeyoung.dungeonsguide.mod.party.PartyManager; +import kr.syeyoung.dungeonsguide.mod.utils.*; +import kr.syeyoung.dungeonsguide.mod.wsresource.StaticResourceCache; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.Tuple; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; + +import javax.crypto.BadPaddingException; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import javax.vecmath.Vector2d; +import java.awt.*; +import java.io.*; +import java.nio.file.Files; +import java.security.*; +import java.security.cert.CertificateException; +import java.util.List; +import java.util.*; +import java.util.regex.Pattern; + +public class CommandDgDebug extends CommandBase { + @Override + public String getCommandName() { + return "dgdebug"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "dgdebug"; + } + + @Override + public void processCommand(ICommandSender sender, String[] args) throws CommandException { + if (args.length == 0) return; + String arg = args[0].toLowerCase(); + + + if ("scoreboard".equals(arg)) { + ScoreBoardUtils.forEachLine(l -> { + ChatTransmitter.addToQueue("LINE: " + l, false); + }); + } else if ("scoreboardclean".equals(arg)) { + ScoreBoardUtils.forEachLineClean(l -> { + ChatTransmitter.addToQueue("LINE: " + l, false); + }); + } else if ("title".equals(arg)) { + if (args.length == 2) { + System.out.println("Displayuing title:" + args[1]); + TitleRender.displayTitle(args[1], "", 10, 40, 20); + } + } else if ("mockdungeonstart".equals(arg)) { + if (!Minecraft.getMinecraft().isSingleplayer()) { + ChatTransmitter.addToQueue("This only works in singlepauer", false); + return; + } + + if (args.length == 2) { + int time = Integer.parseInt(args[1]); + ChatTransmitter.addToQueue("§r§aDungeon starts in " + time + " seconds.§r", false); + return; + } + + + (new Thread(() -> { + try { + ChatTransmitter.addToQueue("§r§aDungeon starts in 15 seconds.§r", false); + Thread.sleep(6000); + ChatTransmitter.addToQueue("§r§aDungeon starts in 10 seconds.§r", false); + Thread.sleep(700); + ChatTransmitter.addToQueue("§r§aDungeon starts in 5 seconds.§r", false); + Thread.sleep(1000); + ChatTransmitter.addToQueue("§r§aDungeon starts in 4 seconds.§r", false); + Thread.sleep(1000); + ChatTransmitter.addToQueue("§r§aDungeon starts in 3 seconds.§r", false); + Thread.sleep(1000); + ChatTransmitter.addToQueue("§r§aDungeon starts in 2 seconds.§r", false); + Thread.sleep(1000); + ChatTransmitter.addToQueue("§r§aDungeon starts in 1 seconds.§r", false); + } catch (InterruptedException ignored) { + } + })).start(); + } else if ("saverooms".equals(arg)) { + DungeonRoomInfoRegistry.saveAll(Main.getConfigDir()); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSuccessfully saved user generated roomdata")); + } else if ("loadrooms".equals(arg)) { + try { + DungeonRoomInfoRegistry.loadAll(Main.getConfigDir()); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSuccessfully loaded roomdatas")); + return; + } catch (BadPaddingException | InvalidKeyException | InvalidAlgorithmParameterException | + NoSuchAlgorithmException | IOException | IllegalBlockSizeException | + NoSuchPaddingException e) { + e.printStackTrace(); + } + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cAn error has occurred while loading roomdata")); + } else if ("reloadah".equals(arg)) { + try { + AhUtils.loadAuctions(); + } catch (CertificateException | NoSuchAlgorithmException | InvalidKeyException | + InvalidAlgorithmParameterException | NoSuchPaddingException | BadPaddingException | + KeyStoreException | IllegalBlockSizeException | KeyManagementException e) { + e.printStackTrace(); + } + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fReloaded Ah data")); + } else if ("brand".equals(arg)) { + String serverBrand = Minecraft.getMinecraft().thePlayer.getClientBrand(); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e" + serverBrand)); + } else if ("pathfind".equals(arg)) { + try { + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + if (thePlayer == null) return; + if (context.getBossfightProcessor() != null) context.getBossfightProcessor().tick(); + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + GeneralRoomProcessor grp = (GeneralRoomProcessor) dungeonRoom.getRoomProcessor(); + grp.pathfind("COMMAND", args[1], args[2], FeatureRegistry.SECRET_LINE_PROPERTIES_GLOBAL.getRouteProperties()); + } catch (Throwable t) { + t.printStackTrace(); + } + } else if ("process".equals(arg)) { + File fileRoot = Main.getConfigDir(); + File dir = new File(fileRoot, "processorinput"); + File outsecret = new File(fileRoot, "processoroutsecret"); + for (File f : dir.listFiles()) { + if (!f.getName().endsWith(".roomdata")) continue; + try { + InputStream fis = new FileInputStream(f); + ObjectInputStream ois = new ObjectInputStream(fis); + DungeonRoomInfo dri = (DungeonRoomInfo) ois.readObject(); + ois.close(); + fis.close(); + dri.setUserMade(false); + + FileOutputStream fos = new FileOutputStream(new File(outsecret, dri.getUuid().toString() + ".roomdata")); + ObjectOutputStream oos = new ObjectOutputStream(fos); + oos.writeObject(dri); + oos.flush(); + oos.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } else if ("check".equals(arg)) { + File fileroot = Main.getConfigDir(); + for (File f : fileroot.listFiles()) { + if (!f.getName().endsWith(".roomdata")) continue; + try { + InputStream fis = new FileInputStream(f); + ObjectInputStream ois = new ObjectInputStream(fis); + DungeonRoomInfo dri = (DungeonRoomInfo) ois.readObject(); + ois.close(); + fis.close(); + System.out.println("Starting at " + dri.getName() + " - " + dri.getUuid()); + for (Map.Entry<String, DungeonMechanic> value2 : dri.getMechanics().entrySet()) { + DungeonMechanic value = value2.getValue(); + if (value instanceof DungeonSecret && + (((DungeonSecret) value).getSecretType() == DungeonSecret.SecretType.BAT + || ((DungeonSecret) value).getSecretType() == DungeonSecret.SecretType.CHEST) + && ((DungeonSecret) value).getSecretPoint().getY() == 0) { + OffsetPoint offsetPoint = ((DungeonSecret) value).getSecretPoint(); + if (dri.getBlocks()[offsetPoint.getZ()][offsetPoint.getX()] != -1) { + dri.getBlocks()[offsetPoint.getZ()][offsetPoint.getX()] = -1; + System.out.println("Fixing " + value2.getKey() + " - as secret " + ((DungeonSecret) value).getSecretType() + " - at " + ((DungeonSecret) value).getSecretPoint()); + } + } else if (value instanceof DungeonOnewayDoor) { + for (OffsetPoint offsetPoint : ((DungeonOnewayDoor) value).getSecretPoint().getOffsetPointList()) { + if (offsetPoint.getY() == 0 && dri.getBlocks()[offsetPoint.getZ()][offsetPoint.getX()] != -1) { + dri.getBlocks()[offsetPoint.getZ()][offsetPoint.getX()] = -1; + System.out.println("Fixing " + value2.getKey() + " - o-door - at " + offsetPoint); + } + } + } else if (value instanceof DungeonDoor) { + for (OffsetPoint offsetPoint : ((DungeonDoor) value).getSecretPoint().getOffsetPointList()) { + if (offsetPoint.getY() == 0 && dri.getBlocks()[offsetPoint.getZ()][offsetPoint.getX()] != -1) { + dri.getBlocks()[offsetPoint.getZ()][offsetPoint.getX()] = -1; + System.out.println("Fixing " + value2.getKey() + " - door - at " + offsetPoint); + } + } + } else if (value instanceof DungeonBreakableWall) { + for (OffsetPoint offsetPoint : ((DungeonBreakableWall) value).getSecretPoint().getOffsetPointList()) { + if (offsetPoint.getY() == 0 && dri.getBlocks()[offsetPoint.getZ()][offsetPoint.getX()] != -1) { + dri.getBlocks()[offsetPoint.getZ()][offsetPoint.getX()] = -1; + System.out.println("Fixing " + value2.getKey() + " - wall - at " + offsetPoint); + } + } + } else if (value instanceof DungeonTomb) { + for (OffsetPoint offsetPoint : ((DungeonTomb) value).getSecretPoint().getOffsetPointList()) { + if (offsetPoint.getY() == 0 && dri.getBlocks()[offsetPoint.getZ()][offsetPoint.getX()] != -1) { + dri.getBlocks()[offsetPoint.getZ()][offsetPoint.getX()] = -1; + System.out.println("Fixing " + value2.getKey() + " - crypt - at " + offsetPoint); + } + } + } + } + FileOutputStream fos = new FileOutputStream(f); + ObjectOutputStream oos = new ObjectOutputStream(fos); + oos.writeObject(dri); + oos.flush(); + oos.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } else if ("reloaddungeon".equals(arg)) { + try { + MinecraftForge.EVENT_BUS.post(new DungeonLeftEvent()); + + DungeonsGuide.getDungeonsGuide().getDungeonFacade().setContext(null); + MapUtils.clearMap(); + } catch (Throwable t) { + t.printStackTrace(); + } + } else if ("partyid".equals(arg)) { + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fInternal Party id: " + Optional.ofNullable(PartyManager.INSTANCE.getPartyContext()).map(PartyContext::getPartyID).orElse(null))); + } else if ("loc".equals(arg)) { + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fYou're in " + DungeonContext.getDungeonName())); + } else if ("saverun".equals(arg)) { + try { + File f = Main.getConfigDir(); + File runDir = new File(f, "dungeonruns"); + runDir.mkdirs(); + + File runFile = new File(runDir, UUID.randomUUID() + ".dgrun"); + + DungeonContext dungeonContext = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + if (dungeonContext == null) { + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cCouldn't find dungeon to save!")); + return; + } + DungeonEventHolder dungeonEventHolder = new DungeonEventHolder(); + dungeonEventHolder.setDate(dungeonContext.getInit()); + dungeonEventHolder.setPlayers(dungeonContext.getPlayers()); + dungeonEventHolder.setEventDataList(dungeonContext.getEvents()); + + + ObjectOutputStream oos = new ObjectOutputStream(Files.newOutputStream(runFile.toPath())); + oos.writeObject(dungeonEventHolder); + oos.flush(); + oos.close(); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSuccessfully saved dungeon run to " + runFile.getAbsolutePath())); + } catch (Exception e) { + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cAn error occured while writing rundata " + e.getMessage())); + e.printStackTrace(); + } + } else if ("requeststaticresource".equals(arg)) { + UUID uid = UUID.fromString(args[1]); + StaticResourceCache.INSTANCE.getResource(uid).thenAccept(a -> { + sender.addChatMessage(new ChatComponentText(a.getResourceID() + ": " + a.getValue() + ": " + a.isExists())); + }); + } else if ("createfakeroom".equals(arg)) {// load schematic + File f = new File(Main.getConfigDir(), "schematics/new roonm-b2df250c-4af2-4201-963c-0ee1cb6bd3de-5efb1f0c-c05f-4064-bde7-cad0874fdf39.schematic"); + NBTTagCompound compound; + try { + compound = CompressedStreamTools.readCompressed(new FileInputStream(f)); + } catch (IOException e) { + e.printStackTrace(); + return; + } + + byte[] blocks = compound.getByteArray("Blocks"); + byte[] meta = compound.getByteArray("Data"); + for (int x = 0; x < compound.getShort("Width"); x++) { + for (int y = 0; y < compound.getShort("Height"); y++) { + for (int z = 0; z < compound.getShort("Length"); z++) { + int index = x + (y * compound.getShort("Length") + z) * compound.getShort("Width"); + BlockPos pos = new BlockPos(x, y, z); + World w = MinecraftServer.getServer().getEntityWorld(); + w.setBlockState(pos, Block.getBlockById(blocks[index] & 0xFF).getStateFromMeta(meta[index] & 0xFF), 2); + } + } + } + + + DungeonSpecificDataProviderRegistry.doorFinders.put(Pattern.compile("TEST DG"), new DungeonSpecificDataProvider() { + @Override + public BlockPos findDoor(World w, String dungeonName) { + return new BlockPos(0, 0, 0); + } + + @Override + public Vector2d findDoorOffset(World w, String dungeonName) { + return null; + } + + @Override + public BossfightProcessor createBossfightProcessor(World w, String dungeonName) { + return null; + } + + @Override + public boolean isTrapSpawn(String dungeonName) { + return false; + } + + @Override + public double secretPercentage(String dungeonName) { + return 0; + } + + @Override + public int speedSecond(String dungeonName) { + return 0; + } + }); + DungeonContext.setDungeonName("TEST DG"); + DungeonContext fakeContext = new DungeonContext(Minecraft.getMinecraft().theWorld); + DungeonsGuide.getDungeonsGuide().getDungeonFacade().setContext(fakeContext); + DungeonsGuide.getDungeonsGuide().getSkyblockStatus().setForceIsOnDungeon(true); + MapProcessor mapProcessor = fakeContext.getMapProcessor(); + mapProcessor.setUnitRoomDimension(new Dimension(16, 16)); + mapProcessor.setBugged(false); + mapProcessor.setDoorDimensions(new Dimension(4, 4)); + mapProcessor.setTopLeftMapPoint(new Point(0, 0)); + fakeContext.setDungeonMin(new BlockPos(0, 70, 0)); + + DungeonRoom dungeonRoom = new DungeonRoom(Arrays.asList(new Point(0, 0)), ShortUtils.topLeftifyInt((short) 1), (byte) 63, new BlockPos(0, 70, 0), new BlockPos(31, 70, 31), fakeContext, Collections.emptySet()); + + fakeContext.getDungeonRoomList().add(dungeonRoom); + for (Point p : Arrays.asList(new Point(0, 0))) { + fakeContext.getRoomMapper().put(p, dungeonRoom); + } + + EditingContext.createEditingContext(dungeonRoom); + EditingContext.getEditingContext().openGui(new GuiDungeonRoomEdit(dungeonRoom)); + } else if ("closecontext".equals(arg)) { + DungeonsGuide.getDungeonsGuide().getSkyblockStatus().setForceIsOnDungeon(false); + + DungeonsGuide.getDungeonsGuide().getDungeonFacade().setContext(null); + } else if ("dumpsettings".equals(arg)) { + NestedCategory nestedCategory = new NestedCategory("ROOT"); + for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { + String category = abstractFeature.getCategory(); + NestedCategory currentRoot = nestedCategory; + for (String s : category.split("\\.")) { + NestedCategory finalCurrentRoot = currentRoot; + if (currentRoot.children().containsKey(s)) + currentRoot = currentRoot.children().get(s); + else { + currentRoot.child(currentRoot = new NestedCategory(finalCurrentRoot.categoryFull() + "." + s)); + } + } + } + + StringBuilder stringBuilder = new StringBuilder(); + StringBuilder stringBuilder2 = new StringBuilder(); + + Stack<Tuple<NestedCategory, Integer>> stak = new Stack<>(); + stak.push(new Tuple<>(nestedCategory, 0)); + Set<NestedCategory> discovered = new HashSet<>(); + while (!stak.isEmpty()) { + Tuple<NestedCategory, Integer> n = stak.pop(); + if (discovered.contains(n.getFirst())) continue; + discovered.add(n.getFirst()); + for (Map.Entry<String, NestedCategory> stringNestedCategoryEntry : n.getFirst().children().entrySet()) { + stak.push(new Tuple<>(stringNestedCategoryEntry.getValue(), n.getSecond() + 1)); + } + + if (n.getFirst().categoryFull().equals("ROOT")) continue; + + String prefix = ""; + for (int i = 0; i < n.getSecond() - 1; i++) { + prefix += " "; + } + + List<AbstractFeature> abstractFeatureList = FeatureRegistry.getFeaturesByCategory().getOrDefault(n.getFirst().categoryFull().substring(5), Collections.emptyList()); + stringBuilder.append(prefix).append("- C ").append(n.getFirst().categoryFull()).append("\n"); + stringBuilder2.append(n.getFirst().categoryFull()).append("\n"); + for (AbstractFeature abstractFeature : abstractFeatureList) { + stringBuilder.append(prefix).append(" - F ").append(abstractFeature.getName()).append(" / ").append(abstractFeature.getDescription().replace("\n", "$NEW_LINE$")).append("\n"); + } + } + System.out.println(stringBuilder.toString()); + System.out.println(stringBuilder2.toString()); + } else if ("readmap".equals(arg)) { + try { + int fromX = Integer.parseInt(args[1]); + int fromY = Integer.parseInt(args[2]); + sender.addChatMessage(new ChatComponentText(MapUtils.readDigit(MapUtils.getColors(), fromX, fromY) + "-")); +// int cntY = Integer.parseInt(args[3]); +// int target = Integer.parseInt(args[4]); +// StringBuilder sb = new StringBuilder("{"); +// for (int y = fromY; y < fromY + cntY; y++) { +// int curr = 0; +// for (int x = fromX; x < fromX+8; x++) { +// byte clr = MapUtils.getMapColorAt(MapUtils.getColors(), x,y); +// if (clr == target) curr = (curr << 1) | 1; +// else curr <<= 1; +// } +// sb.append("0x").append(Integer.toHexString(curr).toUpperCase()); +// if (y != fromY + cntY - 1) sb.append(", "); +// } +// sb.append("}"); +// System.out.println("\n"+sb.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + sender.addChatMessage(new ChatComponentText("ain't gonna find much anything here")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg loadrooms §7-§f Reloads dungeon roomdata.")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg brand §7-§f View server brand.")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg info §7-§f View Current DG User info.")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg saverun §7-§f Save run to be sent to developer.")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg saverooms §7-§f Saves usergenerated dungeon roomdata.")); + } + } + + + @Override + public int getRequiredPermissionLevel() { + return 0; + } +} |