Skip to content

Commit

Permalink
4.0.1
Browse files Browse the repository at this point in the history
- Update to fabric-api 0.78.0. Able to depend on 0.76 or above.

- Loader can be 0.14.12 or above.
- Small changes to api util
  • Loading branch information
Owen3H committed Apr 14, 2023
1 parent cc3686e commit d1a5ee9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ run/
# Extra
/remappedSrc

local.properties
local.properties

src/test/
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ org.gradle.workers.max=4
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.2
loader_version=0.14.19
fabric_version=0.76.0+1.19.4
fabric_version=0.78.0+1.19.4

# Mod Properties
name = EarthMCEssentials
mod_version = 4.0.0
mod_version = 4.0.1
maven_group = net.emc.emce

# Library versions
Expand Down
33 changes: 18 additions & 15 deletions src/main/java/net/emc/emce/utils/EarthMCAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.github.emcw.entities.*;
import io.github.emcw.exceptions.APIException;
import io.github.emcw.exceptions.MissingEntryException;
import io.github.emcw.map.Players;
import io.github.emcw.utils.Request;
import net.emc.emce.config.ModConfig;
import net.emc.emce.objects.API.APIData;
Expand Down Expand Up @@ -33,6 +34,19 @@ public static EMCMap currentMap() {
: instance().wrapper.getAurora();
}

private static void clear() {
currentMap().Players.clear();
}

private static void refresh() {
currentMap().Players.updateCache(true);
}

private static Players players() {
refresh();
return currentMap().Players;
}

public static @Nullable Town getTown(String name) {
try { return currentMap().Towns.single(name); }
catch (MissingEntryException e) {
Expand All @@ -49,32 +63,21 @@ public static EMCMap currentMap() {
}
}

private static void refresh() {
currentMap().Players.updateCache(true);
}

private static void clear() {
currentMap().Players.clear();
}

public static Map<String, Player> allPlayers() {
refresh();
return currentMap().Players.all();
return players().all();
}

public static Map<String, Player> getTownless() {
refresh();
return currentMap().Players.townless();
return players().townless();
}

public static Map<String, Player> onlinePlayers() {
refresh();
return currentMap().Players.online();
return players().online();
}

@Nullable
public static Player getOnlinePlayer(String playerName) {
return currentMap().Players.getOnline(playerName);
return players().getOnline(playerName);
}

public static boolean clientOnline(String map) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"emce.mixins.json"
],
"depends": {
"fabricloader": ">=0.14.19",
"fabric-api": "0.76.0",
"fabricloader": ">=0.14.12",
"fabric-api": ">=0.76.0",
"minecraft": ">=1.19.3",
"java": ">=17"
},
Expand Down

0 comments on commit d1a5ee9

Please sign in to comment.