Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: MineTrax/plugin
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6.0.0
Choose a base ref
...
head repository: MineTrax/plugin
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6.0.1
Choose a head ref
  • 2 commits
  • 13 files changed
  • 1 contributor

Commits on Jun 3, 2024

  1. Minor fixes

    Xinecraft committed Jun 3, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    Exirel Florian Strzelecki
    Copy the full SHA
    fbff654 View commit details

Commits on Jun 7, 2024

  1. Copy the full SHA
    6391b91 View commit details
Original file line number Diff line number Diff line change
@@ -93,6 +93,7 @@ public final class MinetraxBukkit extends JavaPlugin implements Listener, Minetr
public String serverSessionId;
public Boolean isAllowOnlyWhitelistedCommandsFromWeb;
public Boolean isSendInventoryDataToPlayerIntel;
public Boolean isDisablePlayerMovementTracking;
public List<String> whitelistedCommandsFromWeb;
public HashMap<String, String> joinAddressCache = new HashMap<>();
public Boolean hasViaVersion;
@@ -333,6 +334,7 @@ private void initVariables() {
isAllowOnlyWhitelistedCommandsFromWeb = this.getConfig().getBoolean("allow-only-whitelisted-commands-from-web");
whitelistedCommandsFromWeb = this.getConfig().getStringList("whitelisted-commands-from-web");
isSendInventoryDataToPlayerIntel = this.getConfig().getBoolean("send-inventory-data-to-player-intel");
isDisablePlayerMovementTracking = this.getConfig().getBoolean("disable-player-movement-tracking");
isSkinsRestorerHookEnabled = this.getConfig().getBoolean("enable-skinsrestorer-hook");
serverSessionId = UUID.randomUUID().toString();
}
Original file line number Diff line number Diff line change
@@ -200,7 +200,7 @@ private void removePlayerAndSessionFromDataMap(PlayerQuitEvent event) {

PlayerData playerData = MinetraxBukkit.getPlugin().playersDataMap.get(key);
if (playerData != null) {
LoggingUtil.info("REPORT FINAL SESSION END ON PLAYER QUIT");
LoggingUtil.debug("REPORT FINAL SESSION END ON PLAYER QUIT");
PlayerSessionIntelData leftPlayerSessionIntelData = MinetraxBukkit.getPlugin().playerSessionIntelDataMap.get(playerData.session_uuid);
leftPlayerSessionIntelData.session_ended_at = new Date().getTime();

Original file line number Diff line number Diff line change
@@ -16,13 +16,19 @@ public class PlayerMoveListener implements Listener {

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if (event.getFrom().getBlockX() == event.getTo().getBlockY() && event.getFrom().getBlockZ() == event.getTo().getBlockZ() && event.getFrom().getBlockY() == event.getTo().getBlockY()) {
return;
}

Player player = event.getPlayer();
PlayerData playerData = MinetraxBukkit.getPlugin().playersDataMap.get(player.getUniqueId().toString());
if (playerData != null) {
playerData.last_active_timestamp = System.currentTimeMillis();

trackDistanceTravelled(event, player, playerData);
// Track distance travelled if not disabled.
if (! MinetraxBukkit.getPlugin().isDisablePlayerMovementTracking) {
trackDistanceTravelled(event, player, playerData);
}
}
}

Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ public class ServerIntelReportTask implements Runnable {

@Override
public void run() {
LoggingUtil.info("--- SENDING SERVER INTEL ---");
LoggingUtil.debug("--- SENDING SERVER INTEL ---");
ServerIntelData serverIntelData = new ServerIntelData();

serverIntelData.max_players = MinetraxBukkit.getPlugin().getServer().getMaxPlayers();
12 changes: 8 additions & 4 deletions bukkit/src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -33,6 +33,8 @@ report-server-intel: true
report-player-intel: true
# Sends player inventory to Intel for better analysis.
send-inventory-data-to-player-intel: false
# Disable tracking of player movement (used for reporting distance travelled). Useful for servers with large player base which want to optimize performance.
disable-player-movement-tracking: false
# Message format that will be sent when sending message from website to game
web-message-format: '&b[WEB]&r {USERNAME}: {MESSAGE}&r'
# Sends a reminder to player to link their account to website.
@@ -41,12 +43,14 @@ remind-player-to-link: true
remind-player-interval: 300
# The message send to player to remind them to link their account
remind-player-link-message:
- "&6Hey there! It seems you haven't linked your player in web yet. Please visit the link below to start the process."
- "&6**[{LINK_URL}]({LINK_URL} Click to visit)**"
- "&eHey there! It seems you haven't linked your player in web yet. Please visit the link below to start the process."
- ""
- "&e**[{LINK_URL}]({LINK_URL} Click to visit)**"
# Message when player send /account-link without otp parameter
player-link-init-message:
- "&6Please visit below link and follow the steps there to continue linking your account."
- "&6**[{LINK_URL}]({LINK_URL} Click to visit)**"
- "&bPlease visit below link and follow the steps there to continue linking your account."
- ""
- "&b**[{LINK_URL}]({LINK_URL} Click to visit)**"
# If get error message response from server
player-link-error-message:
- "&c&lOops! Some error occurred while linking your account:"
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@
import com.xinecraft.minetrax.common.interfaces.MinetraxPlugin;
import com.xinecraft.minetrax.common.enums.PlatformType;
import com.xinecraft.minetrax.common.webquery.WebQueryServer;
import lombok.AccessLevel;
import lombok.Getter;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.config.Configuration;
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ public class ServerIntelReportTask implements Runnable {

@Override
public void run() {
LoggingUtil.info("--- SENDING SERVER INTEL ---");
LoggingUtil.debug("--- SENDING SERVER INTEL ---");
ServerIntelData serverIntelData = new ServerIntelData();
ProxyServer proxyServer = MinetraxBungee.getPlugin().getProxy();

Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ public class ReportPlayerIntel {
private static final MinetraxCommon common = MinetraxCommon.getInstance();

public static void initSessionSync(PlayerSessionIntelData data) throws Exception {
LoggingUtil.info("--- STARTING SESSION FOR A PLAYER ---");
LoggingUtil.debug("--- STARTING SESSION FOR A PLAYER ---");
JsonObject payload = new JsonObject();
String payloadString = common.getGson().toJson(data);
HttpResponse resp = MinetraxHttpUtil.post(MinetraxHttpUtil.PLAYER_INTEL_SESSION_INIT_ROUTE, payloadString, null);
4 changes: 2 additions & 2 deletions velocity/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
dependencies {
implementation project(":common")
implementation 'org.bstats:bstats-velocity:3.0.0'
compileOnly "com.velocitypowered:velocity-api:3.3.0-SNAPSHOT"
annotationProcessor "com.velocitypowered:velocity-api:3.3.0-SNAPSHOT"
compileOnly "com.velocitypowered:velocity-api:3.0.0-SNAPSHOT"
annotationProcessor "com.velocitypowered:velocity-api:3.0.0-SNAPSHOT"
implementation "dev.dejvokep:boosted-yaml:1.3"
}

Original file line number Diff line number Diff line change
@@ -30,7 +30,6 @@
import dev.dejvokep.boostedyaml.settings.loader.LoaderSettings;
import dev.dejvokep.boostedyaml.settings.updater.UpdaterSettings;
import lombok.Getter;
import net.skinsrestorer.api.SkinsRestorer;
import net.skinsrestorer.api.SkinsRestorerProvider;
import net.skinsrestorer.api.VersionProvider;
import net.skinsrestorer.api.event.SkinApplyEvent;
@@ -93,11 +92,11 @@ public class MinetraxVelocity implements MinetraxPlugin {
public HashMap<String, String> joinAddressCache = new HashMap<>();
public Boolean hasSkinsRestorer = false;
public Boolean isSkinsRestorerHookEnabled;
public SkinsRestorer skinsRestorerApi;
public static final MinecraftChannelIdentifier PLUGIN_MESSAGE_CHANNEL = MinecraftChannelIdentifier.from(MinetraxCommon.PLUGIN_MESSAGE_CHANNEL);

@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
System.out.println("Minetrax plugin is starting...");
// GSON builder
gson = new GsonBuilder()
.serializeNulls()
@@ -136,6 +135,7 @@ public void onProxyInitialization(ProxyInitializeEvent event) {
// Start web query server
startWebQueryServer();

System.out.println("Checking skinsrestoareraasdf" + PluginUtil.checkIfPluginEnabled("skinsrestorer"));
// Hook into plugins
if (PluginUtil.checkIfPluginEnabled("skinsrestorer")) {
hasSkinsRestorer = setupSkinsRestorer();
@@ -209,8 +209,7 @@ private Boolean setupSkinsRestorer() {

// Add SkinsRestorerHook
try {
skinsRestorerApi = SkinsRestorerProvider.get();
skinsRestorerApi.getEventBus().subscribe(pluginContainer, SkinApplyEvent.class, new SkinsRestorerHook());
SkinsRestorerProvider.get().getEventBus().subscribe(pluginContainer, SkinApplyEvent.class, new SkinsRestorerHook());

// Warn if SkinsRestorer is not compatible with v15
if (!VersionProvider.isCompatibleWith("15")) {
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ public class ServerIntelReportTask implements Runnable {

@Override
public void run() {
LoggingUtil.info("--- SENDING SERVER INTEL ---");
LoggingUtil.debug("--- SENDING SERVER INTEL ---");
ServerIntelData serverIntelData = new ServerIntelData();
ProxyServer proxyServer = MinetraxVelocity.getPlugin().getProxyServer();

Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
import com.xinecraft.minetrax.common.utils.LoggingUtil;
import com.xinecraft.minetrax.velocity.MinetraxVelocity;
import net.skinsrestorer.api.SkinsRestorer;
import net.skinsrestorer.api.SkinsRestorerProvider;
import net.skinsrestorer.api.exception.DataRequestException;
import net.skinsrestorer.api.exception.MineSkinException;
import net.skinsrestorer.api.property.InputDataResult;
@@ -16,7 +17,7 @@

public class SkinUtil {
public static void setPlayerSkinUsingUrlOrName(String playerUuid, String value) throws MineSkinException, DataRequestException {
SkinsRestorer skinsRestorerApi = MinetraxVelocity.getPlugin().getSkinsRestorerApi();
SkinsRestorer skinsRestorerApi = SkinsRestorerProvider.get();
SkinStorage skinStorage = skinsRestorerApi.getSkinStorage();
PlayerStorage playerStorage = skinsRestorerApi.getPlayerStorage();
Optional<InputDataResult> result = skinStorage.findOrCreateSkinData(value);
@@ -35,7 +36,7 @@ public static void setPlayerSkinUsingUrlOrName(String playerUuid, String value)
}

public static void setPlayerSkinUsingCustom(String playerUuid, String value) throws DataRequestException {
SkinsRestorer skinsRestorerApi = MinetraxVelocity.getPlugin().getSkinsRestorerApi();
SkinsRestorer skinsRestorerApi = SkinsRestorerProvider.get();
SkinStorage skinStorage = skinsRestorerApi.getSkinStorage();
PlayerStorage playerStorage = skinsRestorerApi.getPlayerStorage();

@@ -61,7 +62,7 @@ public static void setPlayerSkinUsingCustom(String playerUuid, String value) thr
}

public static void clearPlayerSkin(String playerUuid) throws DataRequestException {
SkinsRestorer skinsRestorerApi = MinetraxVelocity.getPlugin().getSkinsRestorerApi();
SkinsRestorer skinsRestorerApi = SkinsRestorerProvider.get();
PlayerStorage playerStorage = skinsRestorerApi.getPlayerStorage();
playerStorage.removeSkinIdOfPlayer(UUID.fromString(playerUuid));

@@ -73,7 +74,7 @@ public static void clearPlayerSkin(String playerUuid) throws DataRequestExceptio
}

public static SkinProperty getSkinForPlayer(UUID playerUuid, String playerName) {
SkinsRestorer skinsRestorerAPI = MinetraxVelocity.getPlugin().getSkinsRestorerApi();
SkinsRestorer skinsRestorerAPI = SkinsRestorerProvider.get();
PlayerStorage playerStorage = skinsRestorerAPI.getPlayerStorage();
try {
Optional<SkinProperty> skin = playerStorage.getSkinForPlayer(playerUuid, playerName);
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
import net.kyori.adventure.text.Component;
import net.skinsrestorer.api.PropertyUtils;
import net.skinsrestorer.api.SkinsRestorer;
import net.skinsrestorer.api.SkinsRestorerProvider;
import net.skinsrestorer.api.property.SkinProperty;
import net.skinsrestorer.api.storage.PlayerStorage;

@@ -45,7 +46,7 @@ public String handleStatus() throws Exception {
playerJsonObject.addProperty("ip_address", Objects.requireNonNull(player.getRemoteAddress()).getHostString());

if (this.plugin.getHasSkinsRestorer()) {
SkinsRestorer skinsRestorerApi = this.plugin.getSkinsRestorerApi();
SkinsRestorer skinsRestorerApi = SkinsRestorerProvider.get();
PlayerStorage playerStorage = skinsRestorerApi.getPlayerStorage();
try {
Optional<SkinProperty> skin = playerStorage.getSkinForPlayer(player.getUniqueId(), player.getUsername());