Advertisement
JackOUT

Untitled

May 21st, 2023
936
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.81 KB | None | 0 0
  1. package games.coob.portals;
  2.  
  3. import games.coob.portals.model.PortalData;
  4. import games.coob.portals.settings.Settings;
  5. import games.coob.portals.task.CosmicTeleportTask;
  6. import games.coob.portals.task.HologramTask;
  7. import games.coob.portals.task.RouletteTeleportTask;
  8. import games.coob.portals.task.TargetedTeleportTask;
  9. import org.bukkit.Bukkit;
  10. import org.mineacademy.fo.Common;
  11. import org.mineacademy.fo.MinecraftVersion;
  12. import org.mineacademy.fo.plugin.SimplePlugin;
  13.  
  14. /**
  15.  * PluginTemplate is a simple template you can use every time you make
  16.  * a new plugin. This will save you time because you no longer have to
  17.  * recreate the same skeleton and features each time.
  18.  * <p>
  19.  * It uses Foundation for fast and efficient development process.
  20.  */
  21. public final class AnchorPortals extends SimplePlugin {
  22.  
  23.     /**
  24.      * Automatically perform login ONCE when the plugin starts.
  25.      */
  26.     @Override
  27.     protected void onPluginStart() {
  28.         Common.setLogPrefix("[AnchorPortals]");
  29.  
  30.         if (!MinecraftVersion.atLeast(MinecraftVersion.V.v1_16)) {
  31.             Common.log("Disabled because the version you are using is too old.");
  32.             this.setEnabled(false);
  33.         }
  34.  
  35.         if (!Bukkit.getPluginManager().isPluginEnabled("DecentHolograms")) {
  36.             Common.log("Disabled do to DecentHolograms not being installed or not enabled.");
  37.             this.setEnabled(false);
  38.         }
  39.     }
  40.  
  41.     @Override
  42.     protected void onPluginStop() {
  43.         //  Hologram.deleteAll();
  44.     }
  45.  
  46.     @Override
  47.     protected void onPluginReload() {
  48.         //  Hologram.deleteAll();
  49.     }
  50.  
  51.     /**
  52.      * Automatically perform login when the plugin starts and each time it is reloaded.
  53.      */
  54.     @Override
  55.     protected void onReloadablesStart() {
  56.         // You can check for necessary plugins and disable loading if they are missing
  57.         PortalData.loadPortals();
  58.  
  59.         Common.runTimer(Settings.PortalSection.CHARGE_SPEED, new HologramTask());
  60.         Common.runTimer(5, new RouletteTeleportTask());
  61.         Common.runTimer(5, new CosmicTeleportTask());
  62.         Common.runTimer(5, new TargetedTeleportTask());
  63.  
  64.         for (final PortalData portalData : PortalData.getPortals()) {
  65.             portalData.setChargePercentage(100);
  66.         }
  67.  
  68.         // Uncomment to load variables
  69.         // Variable.loadVariables();
  70.  
  71.         //
  72.         // Add your own plugin parts to load automatically here
  73.         // Please see @AutoRegister for parts you do not have to register manually
  74.         //
  75.     }
  76.  
  77.     /* ------------------------------------------------------------------------------- */
  78.     /* Static */
  79.     /* ------------------------------------------------------------------------------- */
  80.  
  81.     /**
  82.      * Return the instance of this plugin, which simply refers to a static
  83.      * field already created for you in SimplePlugin but casts it to your
  84.      * specific plugin instance for your convenience.
  85.      *
  86.      * @return
  87.      */
  88.     public static AnchorPortals getInstance() {
  89.         return (AnchorPortals) SimplePlugin.getInstance();
  90.     }
  91. }
  92.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement