forked from alkarinv/BattleArena
-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes a few bugs with users getting stuck in the wizard, or instructions being unclear.
- Loading branch information
Showing
11 changed files
with
188 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
plugin/src/main/java/org/battleplugins/arena/BattleArenaListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.battleplugins.arena; | ||
|
||
import io.papermc.paper.event.player.AsyncChatEvent; | ||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; | ||
import org.battleplugins.arena.editor.ArenaEditorWizard; | ||
import org.battleplugins.arena.event.BattleArenaPostInitializeEvent; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.EventPriority; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.server.ServerLoadEvent; | ||
|
||
class BattleArenaListener implements Listener { | ||
private final BattleArena plugin; | ||
|
||
public BattleArenaListener(BattleArena plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
@EventHandler | ||
public void onServerLoad(ServerLoadEvent event) { | ||
// There is logic called later, however by this point all plugins | ||
// using the BattleArena API should have been loaded. As modules will | ||
// listen for this event to register their behavior, we need to ensure | ||
// they are fully initialized so any references to said modules in | ||
// arena config files will be valid. | ||
new BattleArenaPostInitializeEvent(this.plugin).callEvent(); | ||
|
||
this.plugin.postInitialize(); | ||
} | ||
|
||
@EventHandler(priority = EventPriority.LOWEST) | ||
public void onChat(AsyncChatEvent event) { | ||
String message = PlainTextComponentSerializer.plainText().serialize(event.originalMessage()); | ||
if (message.equalsIgnoreCase("cancel")) { | ||
ArenaEditorWizard.wizardContext(event.getPlayer()).ifPresent(ctx -> { | ||
event.setCancelled(true); | ||
|
||
ctx.getWizard().onCancel(ctx); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
plugin/src/main/java/org/battleplugins/arena/editor/BaseEditorContext.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.