Browse Source

Improvements in bot functionality and checks.

pull/1/head
Stefatorus 3 years ago
parent
commit
f31d33cc54
  1. 36
      cogs/timings.py

36
cogs/timings.py

@ -73,6 +73,10 @@ class Timings(commands.Cog):
if version.count('.') == 1:
version = version[:-1]
version = version + ".0)"
if "Gem" in version or "Stellar" in version:
embed_var.add_field(name="⚠️ Publicly Sold Custom Jar", value=f'You are using `{version}`. Publicly sold custom jars have been known to have major instability issues, often leading to crashes. Many have skirted the copyright law in the past, and have been implement plugin features for extremely large prices (x10-x20 market value). This does not necessarily mean they are bad, but please be careful.')
if "version" in TIMINGS_CHECK and version:
version_result = VERSION_REGEX.search(version)
version_result = version_result.group() if version_result else None
@ -80,7 +84,6 @@ class Timings(commands.Cog):
if compare_versions(version_result, TIMINGS_CHECK["version"]) == -1:
version = version.replace("git-", "").replace("MC: ", "")
embed_var.add_field(name="❌ Outdated",
value=f'You are using `{version}`. Update to `{TIMINGS_CHECK["version"]}`.')
else:
embed_var.add_field(name="❗ Value Error",
value=f'Could not locate version from `{version}`')
@ -102,7 +105,10 @@ class Timings(commands.Cog):
try:
jvm_version = request["timingsMaster"]["system"]["jvmversion"]
if jvm_version.startswith("1.8.") or jvm_version.startswith("9.") or jvm_version.startswith("10."):
if "openj9" in jvm_version:
embed_var.add_field(name="⚠️ Java Version",
value=f"You are using OpenJ9. This JVM implementation favors low ram usage vs throughput. This can reduce RAM usage by up to 50%, but at the cost of max players. This is useful to offset servers where RAM is the bottleneck. This is one tool for reducing lag that requires extensive knowledge to use properly.")
else if jvm_version.startswith("1.8.") or jvm_version.startswith("9.") or jvm_version.startswith("10."):
embed_var.add_field(name="❌ Java Version",
value=f"You are using Java {jvm_version}. Update to [Java 16](https://adoptopenjdk.net/installation.html).")
except KeyError as key:
@ -115,7 +121,7 @@ class Timings(commands.Cog):
java_version = jvm_version.split(".")[0]
if int(java_version) < 14:
embed_var.add_field(name="❌ Java " + java_version,
value="ZGC should only be used on Java 15.")
value="ZGC should only be used on Java 15+")
if "-Xmx" in flags:
max_mem = 0
flaglist = flags.split(" ")
@ -163,7 +169,7 @@ class Timings(commands.Cog):
players = (player_ticks / timed_ticks)
max_online_players = max(players, max_online_players)
index = index + 1
if 1000 * max_online_players / int(max_mem) > 6 and int(max_mem) < 10000:
if 1000 * max_online_players / int(max_mem) > 8 and int(max_mem) < 10000:
embed_var.add_field(name="❌ Low memory",
value="You should be using more RAM with this many players.")
if "-Xms" in flags:
@ -191,11 +197,11 @@ class Timings(commands.Cog):
try:
cpu = int(request["timingsMaster"]["system"]["cpu"])
if cpu == 1:
embed_var.add_field(name="❌ Threads",
value=f"You have only {cpu} thread. Find a [better host](https://www.birdflop.com).")
embed_var.add_field(name="❌ Too Few Threads",
value=f"You have only {cpu} thread. Even if you're virtualizing a bigger CPU, this is not enough to handle a larger playerbase.")
if cpu == 2:
embed_var.add_field(name=" Threads",
value=f"You have only {cpu} threads. Find a [better host](https://www.birdflop.com).")
embed_var.add_field(name="⚠ Few Threads",
value=f"You have only {cpu} threads. This is on the border of the minimum, but if you have a hefty CPU, it can work well.")
except KeyError as key:
logging.info("Missing: " + str(key))
@ -254,8 +260,8 @@ class Timings(commands.Cog):
value="Stacking plugins actually causes more lag. "
"Remove UltimateStacker.")
else:
embed_var.add_field(name=" " + plugin,
value="This plugin was made by Songoda. Songoda has a bad history- find an alternative.")
embed_var.add_field(name=" " + plugin,
value="Songoda focuses mainly on small friends servers (under 10 players). Most of their plugins do not fare well in production systems, and are known to cause issues when used for many players.")
except KeyError as key:
logging.info("Missing: " + str(key))
@ -266,15 +272,15 @@ class Timings(commands.Cog):
for world in worlds:
tvd = int(request_raw["worlds"][world]["ticking-distance"])
ntvd = int(request_raw["worlds"][world]["notick-viewdistance"])
if ntvd <= tvd and tvd >= 5:
if ntvd <= tvd and tvd >= 3:
if spigot["world-settings"]["default"]["view-distance"] == "default":
embed_var.add_field(name="❌ no-tick-view-distance",
value=f"Set in paper.yml. Recommended: {tvd}. "
f"And reduce view-distance from default ({tvd}) in spigot.yml. Recommended: 4.")
f"And reduce view-distance from default ({tvd}) in spigot.yml. Recommended: 3.")
else:
embed_var.add_field(name="❌ no-tick-view-distance",
value=f"Set in paper.yml. Recommended: {tvd}. "
f"And reduce view-distance from {tvd} in spigot.yml. Recommended: 4.")
f"And reduce view-distance from {tvd} in spigot.yml. Recommended: 3.")
break
except KeyError as key:
logging.info("Missing: " + str(key))
@ -284,11 +290,11 @@ class Timings(commands.Cog):
high_mec = False
for world in worlds:
max_entity_cramming = int(request_raw["worlds"][world]["gamerules"]["maxEntityCramming"])
if max_entity_cramming >= 24:
if max_entity_cramming >= 10:
high_mec = True
if high_mec:
embed_var.add_field(name="❌ maxEntityCramming",
value=f"Decrease this by running the /gamerule command in each world. Recommended: 8. ")
value=f"Decrease this by running the /gamerule command in each world. Recommended: 6. ")
except KeyError as key:
logging.info("Missing: " + str(key))

Loading…
Cancel
Save