Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion mod/src/main/java/eu/the5zig/mod/BytecodeHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* along with The 5zig Mod. If not, see <http://www.gnu.org/licenses/>.
*/

package eu.the5zig.mod;import com.mojang.authlib.GameProfile;
package eu.the5zig.mod;

import com.mojang.authlib.GameProfile;
import eu.the5zig.mod.gui.ingame.ItemStack;
import eu.the5zig.mod.manager.DeathLocation;
import eu.the5zig.mod.manager.WorldType;
Expand Down Expand Up @@ -226,6 +228,11 @@ public static void onSetSlot(int slot, ItemStack itemStack) {
The5zigMod.getListener().onInventorySetSlot(slot, itemStack);
}

@BytecodeAccess
public static void onWorldSwitch() {
The5zigMod.getListener().onWorldSwitch();
}

@BytecodeAccess
public static void onGuiDisconnectedInit(Object parentScreen) {
The5zigMod.getDataManager().getAutoReconnectManager().startCountdown(parentScreen);
Expand Down
4 changes: 4 additions & 0 deletions mod/src/main/java/eu/the5zig/mod/listener/EventListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ public void onInventorySetSlot(int slot, ItemStack itemStack) {
}
}

public void onWorldSwitch() {
fireEvent(new PlayerWorldSwitchEvent());
}

public String[] onSignEdited(String[] lines) {
SignEditEvent event = fireEvent(new SignEditEvent(lines));
return event.getLines();
Expand Down
2 changes: 2 additions & 0 deletions mod/src/main/java/eu/the5zig/mod/listener/IListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ public interface IListener {

void onTitle(String title, String subTitle);

void onWorldSwitch();

}
4 changes: 4 additions & 0 deletions mod/src/main/java/eu/the5zig/mod/listener/Listener.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,8 @@ public void onPlayerListHeaderFooter(String header, String footer) {
@Override
public void onTitle(String title, String subTitle) {
}

@Override
public void onWorldSwitch() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,19 @@ public void call(AbstractGameListener callback) {
});
}

@EventHandler
public void onWorldSwitch(final PlayerWorldSwitchEvent event) {
if (!isCurrentServerInstance())
return;
executeAll(new Callback<AbstractGameListener>() {
@Override
@SuppressWarnings("unchecked")
public void call(AbstractGameListener callback) {
callback.onWorldSwitch(getCurrentGameMode());
}
});
}

private boolean tryMatch(final String message) {
final List<List<String>> matchedKeys = match(ChatColor.stripColor(message));
if (matchedKeys.isEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,8 @@ public void onServerConnect(GameMode gameMode) {
The5zigMod.getHypixelAPIManager().checkFriendSuggestions();
}

@Override
public void onWorldSwitch(GameMode gameMode) {
getGameListener().sendAndIgnore("/whereami", "lobby");
}
}
3 changes: 2 additions & 1 deletion mod/src/main/resources/mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"MixinGuiConnecting",
"MixinGuiDisconnected",
"MixinServerListEntry",
"MixinGuiGameOver"
"MixinGuiGameOver",
"MixinClientWorld"
]
}
3 changes: 2 additions & 1 deletion mod/src/main/resources/the5zigmod.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"MixinGuiDisconnected",
"MixinGuiGameOver",
"MixinGuiMainMenu",
"MixinGuiPlayerTabOverlay"
"MixinGuiPlayerTabOverlay",
"MixinClientWorld"
]
}