mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Cleanup progress feedback
This commit is contained in:
parent
dbd27b641e
commit
f4ff8518c2
@ -430,10 +430,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
convertedUsers++;
|
convertedUsers++;
|
||||||
if ((convertedUsers % DatabaseManager.progressInterval) == 0) {
|
Misc.printProgress(convertedUsers, progressInterval, startMillis);
|
||||||
// Can't use Bukkit.broadcastMessage because async
|
|
||||||
System.out.println(String.format("[mcMMO] Conversion progress: %d users at %.2f users/second", convertedUsers, convertedUsers / ((System.currentTimeMillis() - startMillis) / 1000D)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
@ -461,10 +461,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
convertedUsers++;
|
convertedUsers++;
|
||||||
if ((convertedUsers % DatabaseManager.progressInterval) == 0) {
|
Misc.printProgress(convertedUsers, progressInterval, startMillis);
|
||||||
// Can't use Bukkit.broadcastMessage because async
|
|
||||||
System.out.println(String.format("[mcMMO] Conversion progress: %d users at %.2f users/second", convertedUsers, convertedUsers / ((System.currentTimeMillis() - startMillis) / 1000D)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e) {
|
catch (SQLException e) {
|
||||||
|
@ -11,6 +11,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
public class FormulaConversionTask extends BukkitRunnable {
|
public class FormulaConversionTask extends BukkitRunnable {
|
||||||
@ -47,10 +48,7 @@ public class FormulaConversionTask extends BukkitRunnable {
|
|||||||
editValues(profile);
|
editValues(profile);
|
||||||
}
|
}
|
||||||
convertedUsers++;
|
convertedUsers++;
|
||||||
if ((convertedUsers % DatabaseManager.progressInterval) == 0) {
|
Misc.printProgress(convertedUsers, DatabaseManager.progressInterval, startMillis);
|
||||||
// Can't use Bukkit.broadcastMessage because async
|
|
||||||
System.out.println(String.format("[mcMMO] Conversion progress: %d users at %.2f users/second", convertedUsers, convertedUsers / ((System.currentTimeMillis() - startMillis) / 1000D)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mcMMO.getFormulaManager().setPreviousFormulaType(formulaType);
|
mcMMO.getFormulaManager().setPreviousFormulaType(formulaType);
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.metadata.MetadataValue;
|
import org.bukkit.metadata.MetadataValue;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.events.items.McMMOItemSpawnEvent;
|
import com.gmail.nossr50.events.items.McMMOItemSpawnEvent;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
@ -198,6 +198,12 @@ public final class Misc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void printProgress(int convertedUsers, int progressInterval, long startMillis) {
|
||||||
|
if ((convertedUsers % progressInterval) == 0) {
|
||||||
|
mcMMO.p.getLogger().info(String.format("Conversion progress: %d users at %.2f users/second", convertedUsers, convertedUsers / ((System.currentTimeMillis() - startMillis) / TIME_CONVERSION_FACTOR)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void resendChunkRadiusAt(Player player, int radius) {
|
public static void resendChunkRadiusAt(Player player, int radius) {
|
||||||
Chunk chunk = player.getLocation().getChunk();
|
Chunk chunk = player.getLocation().getChunk();
|
||||||
int chunkX = chunk.getX();
|
int chunkX = chunk.getX();
|
||||||
|
Loading…
Reference in New Issue
Block a user