Aternos All In One

Adblock, Auto Start, Auto Confirm, and automatically extends the server time. | basically just "Aternos Ultimate Script 2024" by MITEBOSS with some improvement on Auto Confirm the queue, credits to MITEBOSS.

  1. // ==UserScript==
  2. // @name Aternos All In One
  3. // @namespace heyxferdi Scripts
  4. // @version 1.0
  5. // @description Adblock, Auto Start, Auto Confirm, and automatically extends the server time. | basically just "Aternos Ultimate Script 2024" by MITEBOSS with some improvement on Auto Confirm the queue, credits to MITEBOSS.
  6. // @author heyxferdi
  7. // @license MIT
  8. // @match https://aternos.org/*
  9. // @icon https://static.wikia.nocookie.net/minecraft_gamepedia/images/c/c7/Grass_Block.png/revision/latest?cb=20230226144250
  10. // @grant none
  11. // @run-at document-start
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. // Overriding Date.now to prevent adblock detection
  18. let oldDateNow = Date.now;
  19. unsafeWindow.Date.now = function () {
  20. try {
  21. throw new Error();
  22. } catch (e) {
  23. if (e.stack.includes('data:text/javascript')) {
  24. throw new Error();
  25. } else {
  26. return oldDateNow();
  27. }
  28. }
  29. };
  30.  
  31. // Intersection Observer to handle extend button
  32. const extendButtonObserver = new IntersectionObserver(handleIntersection, {
  33. root: null,
  34. rootMargin: '0px',
  35. threshold: 0.1
  36. });
  37.  
  38. function handleIntersection(entries, observer) {
  39. entries.forEach(entry => {
  40. if (entry.isIntersecting) {
  41. const extendButton = entry.target;
  42. if (extendButton.textContent.trim().toLowerCase() !== "stop") {
  43. extendButton.click();
  44. }
  45. observer.unobserve(extendButton);
  46. }
  47. });
  48. }
  49.  
  50. // Function to observe extend button visibility
  51. function checkButtonVisibility() {
  52. const extendButton = document.querySelector('.btn.btn-tiny.btn-success.server-extend-end');
  53. if (extendButton) {
  54. extendButtonObserver.observe(extendButton);
  55. } else {
  56. console.error('[Aternos Extend Server Time] Button not found.');
  57. }
  58. }
  59.  
  60. // Function to check the timer and extend server time at 1:00
  61. function checkTimerAndExtend() {
  62. const timerElement = document.querySelector('.server-end-countdown');
  63. if (timerElement) {
  64. const timerValue = timerElement.textContent.trim();
  65. if (timerValue === '1:00') {
  66. const extendButton = document.querySelector('.btn.btn-tiny.btn-success.server-extend-end');
  67. if (extendButton && extendButton.textContent.trim().toLowerCase() !== "stop") {
  68. extendButton.click();
  69. }
  70. }
  71. }
  72. }
  73.  
  74. // Function to check for white screen and refresh the page if detected
  75. function checkForWhiteScreen() {
  76. const whiteScreenElement = document.querySelector('.white-screen-element');
  77. if (whiteScreenElement) {
  78. console.error('[Aternos White Screen] White screen detected. Refreshing page...');
  79. window.location.reload();
  80. }
  81. }
  82.  
  83. // Function to check if the server is offline and click the "Start" button if it is
  84. function checkAndStartServerIfOffline() {
  85. const serverStatus = document.querySelector('.server-actions');
  86. if (serverStatus && serverStatus.classList.contains('offline')) {
  87. const startButton = document.querySelector('#start');
  88. if (startButton && startButton.offsetParent !== null) {
  89. startButton.click();
  90. }
  91. }
  92. }
  93.  
  94. // Function to check if the server is Ready and click the "Confirm" button if it is
  95. function checkAndClickConfirmButton() {
  96. const serverStatus = document.querySelector('.server-actions');
  97. if (serverStatus && serverStatus.classList.contains('queueing')) {
  98. const confirmButton = document.querySelector('#confirm');
  99. if (confirmButton && confirmButton.offsetParent !== null) {
  100. confirmButton.click();
  101. }
  102. }
  103. }
  104.  
  105. // Function to click the "No" button if the alert dialog is present
  106. function clickNoButtonIfAlertPresent() {
  107. const alertDialog = document.querySelector('dialog.alert.alert-danger');
  108. if (alertDialog && alertDialog.open) {
  109. const noButton = alertDialog.querySelector('.btn-danger');
  110. if (noButton) {
  111. noButton.click();
  112. }
  113. }
  114. }
  115.  
  116. // Set up intervals to check continuously
  117. const checkInterval = 3000; // 3 second
  118. setInterval(checkButtonVisibility, checkInterval);
  119. setInterval(checkTimerAndExtend, checkInterval);
  120. setInterval(checkForWhiteScreen, checkInterval);
  121. setInterval(checkAndStartServerIfOffline, checkInterval);
  122. setInterval(clickNoButtonIfAlertPresent, checkInterval);
  123. setInterval(checkAndClickConfirmButton, checkInterval);
  124. })();