mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-24 22:04:23 +00:00
Make things undoable -- should (mostly) fix /mt reload
This commit is contained in:
1 parent
e4a0cc8f35
commit
8fff244d95
4 files changed
+79
-31
No files matched your search
@@ -58,6 +58,7 @@ public class MineTweakerImplementationAPI {
|
||||
private static final ListenPlayerLoggedIn LISTEN_LOGIN = new ListenPlayerLoggedIn();
|
||||
private static final ListenPlayerLoggedOut LISTEN_LOGOUT = new ListenPlayerLoggedOut();
|
||||
private static final ListenBlockInfo LISTEN_BLOCK_INFO = new ListenBlockInfo();
|
||||
private static final EventList<ReloadEvent> ONROLLBACK = new EventList<>();
|
||||
private static final EventList<ReloadEvent> ONRELOAD = new EventList<>();
|
||||
private static final EventList<ReloadEvent> ONPOSTRELOAD = new EventList<>();
|
||||
|
||||
@@ -573,6 +574,9 @@ public class MineTweakerImplementationAPI {
|
||||
* @param handler
|
||||
* @return
|
||||
*/
|
||||
public static IEventHandle onRollbackEvent(IEventHandler<ReloadEvent> handler) {
|
||||
return ONROLLBACK.add(handler);
|
||||
}
|
||||
public static IEventHandle onReloadEvent(IEventHandler<ReloadEvent> handler) {
|
||||
return ONRELOAD.add(handler);
|
||||
}
|
||||
@@ -623,6 +627,8 @@ public class MineTweakerImplementationAPI {
|
||||
}
|
||||
|
||||
MineTweakerAPI.tweaker.rollback();
|
||||
ONROLLBACK.publish(new ReloadEvent());
|
||||
|
||||
if (MineTweakerAPI.server != null) {
|
||||
if (!MineTweakerAPI.server.isCommandAdded("minetweaker")) {
|
||||
server.addCommand("minetweaker", "", new String[]{"mt", "crafttweaker", "ct"}, new ICommandFunction() {
|
||||
|
||||
Reference in new issue
Block a user