2015-10-19 17:43:46 +00:00
|
|
|
package me.totalfreedom.totalfreedommod;
|
|
|
|
|
2018-07-31 07:01:29 +00:00
|
|
|
import java.io.File;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.util.Properties;
|
2019-07-11 02:13:57 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.admin.ActivityLog;
|
2015-10-19 17:43:46 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.admin.AdminList;
|
|
|
|
import me.totalfreedom.totalfreedommod.banning.BanManager;
|
2016-03-06 15:56:15 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.banning.PermbanList;
|
2018-07-31 07:05:28 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.blocking.BlockBlocker;
|
|
|
|
import me.totalfreedom.totalfreedommod.blocking.EditBlocker;
|
|
|
|
import me.totalfreedom.totalfreedommod.blocking.EventBlocker;
|
|
|
|
import me.totalfreedom.totalfreedommod.blocking.InteractBlocker;
|
|
|
|
import me.totalfreedom.totalfreedommod.blocking.MobBlocker;
|
|
|
|
import me.totalfreedom.totalfreedommod.blocking.PVPBlocker;
|
|
|
|
import me.totalfreedom.totalfreedommod.blocking.PotionBlocker;
|
|
|
|
import me.totalfreedom.totalfreedommod.blocking.SignBlocker;
|
2016-03-06 15:56:15 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.blocking.command.CommandBlocker;
|
2018-07-31 07:05:28 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.bridge.BukkitTelnetBridge;
|
|
|
|
import me.totalfreedom.totalfreedommod.bridge.CoreProtectBridge;
|
|
|
|
import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge;
|
|
|
|
import me.totalfreedom.totalfreedommod.bridge.LibsDisguisesBridge;
|
|
|
|
import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge;
|
|
|
|
import me.totalfreedom.totalfreedommod.bridge.WorldGuardBridge;
|
2015-11-15 23:32:04 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.caging.Cager;
|
2016-03-02 19:28:01 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.command.CommandLoader;
|
2016-05-12 19:40:39 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.config.MainConfig;
|
2017-12-29 18:12:47 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.discord.Discord;
|
2015-11-15 23:32:04 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.freeze.Freezer;
|
2019-07-11 02:13:57 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.fun.CurseListener;
|
2018-07-31 07:05:28 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.fun.ItemFun;
|
|
|
|
import me.totalfreedom.totalfreedommod.fun.Jumppads;
|
|
|
|
import me.totalfreedom.totalfreedommod.fun.Landminer;
|
|
|
|
import me.totalfreedom.totalfreedommod.fun.MP44;
|
|
|
|
import me.totalfreedom.totalfreedommod.fun.MobStacker;
|
2020-01-12 14:51:29 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.fun.RealTimer;
|
2018-07-31 07:05:28 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.fun.Trailer;
|
2015-10-19 17:43:46 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
|
2018-07-28 07:11:48 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
|
2018-05-13 19:49:13 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilderList;
|
2020-04-29 23:29:43 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.world.WorldRestrictions;
|
2020-04-14 06:40:22 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.permissions.PermissionConfig;
|
|
|
|
import me.totalfreedom.totalfreedommod.permissions.PermissionManager;
|
2015-10-19 17:43:46 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.player.PlayerList;
|
2018-03-24 15:41:45 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.playerverification.PlayerVerification;
|
2018-03-03 04:29:08 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentList;
|
2016-03-06 15:56:15 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.rank.RankManager;
|
2019-11-02 01:28:07 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.shop.Shop;
|
2020-05-29 10:14:21 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.sql.SQLite;
|
2015-11-15 23:32:04 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
|
|
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
2016-05-12 19:40:39 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.util.MethodTimer;
|
2018-07-25 21:23:23 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.world.CleanroomChunkGenerator;
|
2015-11-15 23:32:04 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.world.WorldManager;
|
2015-10-19 17:43:46 +00:00
|
|
|
import net.pravian.aero.component.service.ServiceManager;
|
|
|
|
import net.pravian.aero.plugin.AeroPlugin;
|
2018-07-31 07:01:29 +00:00
|
|
|
import org.bstats.Metrics;
|
2016-05-12 19:40:39 +00:00
|
|
|
import org.bukkit.Bukkit;
|
2018-07-25 21:23:23 +00:00
|
|
|
import org.bukkit.generator.ChunkGenerator;
|
2016-05-12 19:40:39 +00:00
|
|
|
import org.bukkit.plugin.Plugin;
|
2015-10-19 17:43:46 +00:00
|
|
|
import org.bukkit.scheduler.BukkitRunnable;
|
2017-10-14 11:21:07 +00:00
|
|
|
import org.spigotmc.SpigotConfig;
|
2015-10-19 17:43:46 +00:00
|
|
|
|
|
|
|
public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
|
|
|
{
|
2015-11-22 18:26:47 +00:00
|
|
|
|
2015-10-19 17:43:46 +00:00
|
|
|
public static final String CONFIG_FILENAME = "config.yml";
|
|
|
|
//
|
|
|
|
public static final BuildProperties build = new BuildProperties();
|
|
|
|
//
|
|
|
|
public static String pluginName;
|
|
|
|
public static String pluginVersion;
|
|
|
|
//
|
2016-05-12 19:40:39 +00:00
|
|
|
public MainConfig config;
|
2020-04-14 06:40:22 +00:00
|
|
|
public PermissionConfig permissions;
|
2016-05-12 19:40:39 +00:00
|
|
|
//
|
2015-10-19 17:43:46 +00:00
|
|
|
// Services
|
|
|
|
public ServiceManager<TotalFreedomMod> services;
|
|
|
|
public ServerInterface si;
|
2016-05-12 19:40:39 +00:00
|
|
|
public SavedFlags sf;
|
2015-11-15 23:32:04 +00:00
|
|
|
public WorldManager wm;
|
2016-05-12 19:40:39 +00:00
|
|
|
public LogViewer lv;
|
2015-10-19 17:43:46 +00:00
|
|
|
public AdminList al;
|
2019-07-11 02:13:57 +00:00
|
|
|
public ActivityLog acl;
|
2016-05-12 19:40:39 +00:00
|
|
|
public RankManager rm;
|
|
|
|
public CommandLoader cl;
|
|
|
|
public CommandBlocker cb;
|
2015-11-15 23:32:04 +00:00
|
|
|
public EventBlocker eb;
|
|
|
|
public BlockBlocker bb;
|
|
|
|
public MobBlocker mb;
|
|
|
|
public InteractBlocker ib;
|
2016-05-12 19:40:39 +00:00
|
|
|
public PotionBlocker pb;
|
2015-11-15 23:32:04 +00:00
|
|
|
public LoginProcess lp;
|
|
|
|
public AntiNuke nu;
|
|
|
|
public AntiSpam as;
|
2015-10-19 17:43:46 +00:00
|
|
|
public PlayerList pl;
|
2019-11-02 01:28:07 +00:00
|
|
|
public Shop sh;
|
2020-05-29 10:14:21 +00:00
|
|
|
public SQLite sql;
|
2015-10-19 17:43:46 +00:00
|
|
|
public Announcer an;
|
2016-03-07 20:32:05 +00:00
|
|
|
public ChatManager cm;
|
2017-12-29 18:12:47 +00:00
|
|
|
public Discord dc;
|
2018-03-03 04:29:08 +00:00
|
|
|
public PunishmentList pul;
|
2016-03-07 20:32:05 +00:00
|
|
|
public BanManager bm;
|
2016-05-12 19:40:39 +00:00
|
|
|
public PermbanList pm;
|
2020-04-14 06:40:22 +00:00
|
|
|
public PermissionManager pem;
|
2015-10-19 17:43:46 +00:00
|
|
|
public ProtectArea pa;
|
|
|
|
public GameRuleHandler gr;
|
2016-03-07 20:32:05 +00:00
|
|
|
public CommandSpy cs;
|
2015-11-15 23:32:04 +00:00
|
|
|
public Cager ca;
|
|
|
|
public Freezer fm;
|
2017-10-14 11:21:07 +00:00
|
|
|
public EditBlocker ebl;
|
2017-12-28 05:50:39 +00:00
|
|
|
public PVPBlocker pbl;
|
2016-03-07 20:32:05 +00:00
|
|
|
public Orbiter or;
|
|
|
|
public Muter mu;
|
2015-11-15 23:32:04 +00:00
|
|
|
public Fuckoff fo;
|
2016-03-07 20:32:05 +00:00
|
|
|
public AutoKick ak;
|
2016-05-12 19:40:39 +00:00
|
|
|
public AutoEject ae;
|
2017-12-31 03:58:20 +00:00
|
|
|
public Monitors mo;
|
2016-03-07 20:32:05 +00:00
|
|
|
public MovementValidator mv;
|
2015-11-15 23:32:04 +00:00
|
|
|
public ServerPing sp;
|
2019-07-11 02:13:57 +00:00
|
|
|
public CurseListener cul;
|
2015-11-15 23:32:04 +00:00
|
|
|
public ItemFun it;
|
|
|
|
public Landminer lm;
|
2018-07-22 00:45:56 +00:00
|
|
|
public MobStacker ms;
|
2015-11-15 23:32:04 +00:00
|
|
|
public MP44 mp;
|
2016-03-07 20:32:05 +00:00
|
|
|
public Jumppads jp;
|
2016-05-12 19:40:39 +00:00
|
|
|
public Trailer tr;
|
2015-10-19 17:43:46 +00:00
|
|
|
public HTTPDaemon hd;
|
2018-05-13 19:49:13 +00:00
|
|
|
public MasterBuilderList mbl;
|
2020-04-29 23:29:43 +00:00
|
|
|
public WorldRestrictions wr;
|
2017-12-28 05:50:39 +00:00
|
|
|
public SignBlocker snp;
|
2018-03-24 15:41:45 +00:00
|
|
|
public PlayerVerification pv;
|
2020-01-09 11:56:25 +00:00
|
|
|
public EntityWiper ew;
|
2020-01-12 14:51:29 +00:00
|
|
|
public RealTimer rt;
|
2019-11-03 21:40:05 +00:00
|
|
|
//public HubWorldRestrictions hwr;
|
2015-10-19 17:43:46 +00:00
|
|
|
//
|
|
|
|
// Bridges
|
|
|
|
public ServiceManager<TotalFreedomMod> bridges;
|
|
|
|
public BukkitTelnetBridge btb;
|
|
|
|
public EssentialsBridge esb;
|
2016-07-21 21:53:25 +00:00
|
|
|
public LibsDisguisesBridge ldb;
|
2017-10-14 11:21:07 +00:00
|
|
|
public CoreProtectBridge cpb;
|
2015-10-19 17:43:46 +00:00
|
|
|
public WorldEditBridge web;
|
2018-02-09 08:21:44 +00:00
|
|
|
public WorldGuardBridge wgb;
|
2015-10-19 17:43:46 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void load()
|
|
|
|
{
|
|
|
|
TotalFreedomMod.pluginName = plugin.getDescription().getName();
|
|
|
|
TotalFreedomMod.pluginVersion = plugin.getDescription().getVersion();
|
|
|
|
|
|
|
|
FLog.setPluginLogger(plugin.getLogger());
|
|
|
|
FLog.setServerLogger(server.getLogger());
|
|
|
|
|
2016-05-12 19:40:39 +00:00
|
|
|
build.load(plugin);
|
2015-10-19 17:43:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void enable()
|
|
|
|
{
|
|
|
|
FLog.info("Created by Madgeek1450 and Prozza");
|
2017-10-14 11:21:07 +00:00
|
|
|
FLog.info("Version " + build.version);
|
2015-11-22 18:26:47 +00:00
|
|
|
FLog.info("Compiled " + build.date + " by " + build.author);
|
2015-10-19 17:43:46 +00:00
|
|
|
|
2016-05-12 19:40:39 +00:00
|
|
|
final MethodTimer timer = new MethodTimer();
|
2015-10-19 17:43:46 +00:00
|
|
|
timer.start();
|
|
|
|
|
2016-03-06 15:56:15 +00:00
|
|
|
// Warn if we're running on a wrong version
|
|
|
|
ServerInterface.warnVersion();
|
2015-10-19 17:43:46 +00:00
|
|
|
|
2016-03-06 15:56:15 +00:00
|
|
|
// Delete unused files
|
2015-10-19 17:43:46 +00:00
|
|
|
FUtil.deleteCoreDumps();
|
|
|
|
FUtil.deleteFolder(new File("./_deleteme"));
|
|
|
|
|
2016-05-12 19:40:39 +00:00
|
|
|
BackupManager backups = new BackupManager(this);
|
|
|
|
backups.createBackups(TotalFreedomMod.CONFIG_FILENAME, true);
|
|
|
|
backups.createBackups(AdminList.CONFIG_FILENAME);
|
|
|
|
backups.createBackups(PermbanList.CONFIG_FILENAME);
|
2020-04-14 06:40:22 +00:00
|
|
|
backups.createBackups(PermissionConfig.PERMISSIONS_FILENAME, true);
|
2018-07-28 07:11:48 +00:00
|
|
|
backups.createBackups(MasterBuilder.CONFIG_FILENAME);
|
|
|
|
backups.createBackups(PunishmentList.CONFIG_FILENAME);
|
2020-05-29 10:14:21 +00:00
|
|
|
backups.createBackups("");
|
2016-05-12 19:40:39 +00:00
|
|
|
|
|
|
|
config = new MainConfig(this);
|
|
|
|
config.load();
|
2015-10-19 17:43:46 +00:00
|
|
|
|
2020-04-14 06:40:22 +00:00
|
|
|
permissions = new PermissionConfig(this);
|
|
|
|
permissions.load();
|
|
|
|
|
2016-03-07 20:32:05 +00:00
|
|
|
// Start services
|
2016-03-02 19:28:01 +00:00
|
|
|
services = new ServiceManager<>(plugin);
|
2015-11-15 23:32:04 +00:00
|
|
|
si = services.registerService(ServerInterface.class);
|
2016-05-12 19:40:39 +00:00
|
|
|
sf = services.registerService(SavedFlags.class);
|
2015-11-15 23:32:04 +00:00
|
|
|
wm = services.registerService(WorldManager.class);
|
2016-05-12 19:40:39 +00:00
|
|
|
lv = services.registerService(LogViewer.class);
|
2020-05-29 10:14:21 +00:00
|
|
|
sql = services.registerService(SQLite.class);
|
2015-11-15 23:32:04 +00:00
|
|
|
al = services.registerService(AdminList.class);
|
2019-07-11 02:13:57 +00:00
|
|
|
acl = services.registerService(ActivityLog.class);
|
2016-05-12 19:40:39 +00:00
|
|
|
rm = services.registerService(RankManager.class);
|
|
|
|
cl = services.registerService(CommandLoader.class);
|
|
|
|
cb = services.registerService(CommandBlocker.class);
|
2015-11-15 23:32:04 +00:00
|
|
|
eb = services.registerService(EventBlocker.class);
|
|
|
|
bb = services.registerService(BlockBlocker.class);
|
|
|
|
mb = services.registerService(MobBlocker.class);
|
|
|
|
ib = services.registerService(InteractBlocker.class);
|
2016-05-12 19:40:39 +00:00
|
|
|
pb = services.registerService(PotionBlocker.class);
|
2015-11-15 23:32:04 +00:00
|
|
|
lp = services.registerService(LoginProcess.class);
|
|
|
|
nu = services.registerService(AntiNuke.class);
|
|
|
|
as = services.registerService(AntiSpam.class);
|
2018-05-13 19:49:13 +00:00
|
|
|
mbl = services.registerService(MasterBuilderList.class);
|
2020-04-29 23:29:43 +00:00
|
|
|
wr = services.registerService(WorldRestrictions.class);
|
2015-11-15 23:32:04 +00:00
|
|
|
pl = services.registerService(PlayerList.class);
|
2019-11-03 14:10:56 +00:00
|
|
|
sh = services.registerService(Shop.class);
|
2015-11-15 23:32:04 +00:00
|
|
|
an = services.registerService(Announcer.class);
|
2016-03-07 20:32:05 +00:00
|
|
|
cm = services.registerService(ChatManager.class);
|
2017-12-29 18:12:47 +00:00
|
|
|
dc = services.registerService(Discord.class);
|
2018-03-03 04:29:08 +00:00
|
|
|
pul = services.registerService(PunishmentList.class);
|
2016-03-07 20:32:05 +00:00
|
|
|
bm = services.registerService(BanManager.class);
|
2016-05-12 19:40:39 +00:00
|
|
|
pm = services.registerService(PermbanList.class);
|
2020-04-14 06:40:22 +00:00
|
|
|
pem = services.registerService(PermissionManager.class);
|
2015-11-15 23:32:04 +00:00
|
|
|
pa = services.registerService(ProtectArea.class);
|
|
|
|
gr = services.registerService(GameRuleHandler.class);
|
2017-12-28 05:50:39 +00:00
|
|
|
snp = services.registerService(SignBlocker.class);
|
2020-01-09 11:56:25 +00:00
|
|
|
ew = services.registerService(EntityWiper.class);
|
2017-10-21 17:31:17 +00:00
|
|
|
|
2016-03-07 20:32:05 +00:00
|
|
|
// Single admin utils
|
|
|
|
cs = services.registerService(CommandSpy.class);
|
2015-11-15 23:32:04 +00:00
|
|
|
ca = services.registerService(Cager.class);
|
|
|
|
fm = services.registerService(Freezer.class);
|
2016-03-07 20:32:05 +00:00
|
|
|
or = services.registerService(Orbiter.class);
|
|
|
|
mu = services.registerService(Muter.class);
|
2017-10-14 11:21:07 +00:00
|
|
|
ebl = services.registerService(EditBlocker.class);
|
2017-12-28 05:50:39 +00:00
|
|
|
pbl = services.registerService(PVPBlocker.class);
|
2015-11-15 23:32:04 +00:00
|
|
|
fo = services.registerService(Fuckoff.class);
|
2016-03-07 20:32:05 +00:00
|
|
|
ak = services.registerService(AutoKick.class);
|
2016-05-12 19:40:39 +00:00
|
|
|
ae = services.registerService(AutoEject.class);
|
2017-12-31 03:58:20 +00:00
|
|
|
mo = services.registerService(Monitors.class);
|
2018-07-31 06:41:56 +00:00
|
|
|
|
|
|
|
|
2016-03-07 20:32:05 +00:00
|
|
|
mv = services.registerService(MovementValidator.class);
|
2015-11-15 23:32:04 +00:00
|
|
|
sp = services.registerService(ServerPing.class);
|
2018-03-24 15:41:45 +00:00
|
|
|
pv = services.registerService(PlayerVerification.class);
|
2016-03-07 20:32:05 +00:00
|
|
|
|
|
|
|
// Fun
|
2019-07-11 02:13:57 +00:00
|
|
|
cul = services.registerService(CurseListener.class);
|
2015-11-15 23:32:04 +00:00
|
|
|
it = services.registerService(ItemFun.class);
|
|
|
|
lm = services.registerService(Landminer.class);
|
2018-07-22 00:45:56 +00:00
|
|
|
ms = services.registerService(MobStacker.class);
|
2015-11-15 23:32:04 +00:00
|
|
|
mp = services.registerService(MP44.class);
|
2016-03-07 20:32:05 +00:00
|
|
|
jp = services.registerService(Jumppads.class);
|
2016-05-12 19:40:39 +00:00
|
|
|
tr = services.registerService(Trailer.class);
|
2020-01-12 14:51:29 +00:00
|
|
|
rt = services.registerService(RealTimer.class);
|
2016-03-07 20:32:05 +00:00
|
|
|
|
|
|
|
// HTTPD
|
2015-11-15 23:32:04 +00:00
|
|
|
hd = services.registerService(HTTPDaemon.class);
|
2015-10-19 17:43:46 +00:00
|
|
|
services.start();
|
|
|
|
|
2016-03-07 20:32:05 +00:00
|
|
|
// Start bridges
|
2016-03-02 19:28:01 +00:00
|
|
|
bridges = new ServiceManager<>(plugin);
|
2015-11-15 23:32:04 +00:00
|
|
|
btb = bridges.registerService(BukkitTelnetBridge.class);
|
2017-10-14 11:21:07 +00:00
|
|
|
cpb = bridges.registerService(CoreProtectBridge.class);
|
2015-11-15 23:32:04 +00:00
|
|
|
esb = bridges.registerService(EssentialsBridge.class);
|
2018-12-29 19:41:48 +00:00
|
|
|
ldb = bridges.registerService(LibsDisguisesBridge.class);
|
|
|
|
web = bridges.registerService(WorldEditBridge.class);
|
2019-01-12 03:05:12 +00:00
|
|
|
wgb = bridges.registerService(WorldGuardBridge.class);
|
2015-11-15 23:32:04 +00:00
|
|
|
bridges.start();
|
2015-10-19 17:43:46 +00:00
|
|
|
|
|
|
|
timer.update();
|
|
|
|
FLog.info("Version " + pluginVersion + " for " + ServerInterface.COMPILE_NMS_VERSION + " enabled in " + timer.getTotal() + "ms");
|
|
|
|
|
2018-07-27 07:31:18 +00:00
|
|
|
// Metrics @ https://bstats.org/plugin/bukkit/TotalFreedomMod
|
|
|
|
new Metrics(this);
|
2015-10-19 17:43:46 +00:00
|
|
|
|
|
|
|
// Add spawnpoints later - https://github.com/TotalFreedom/TotalFreedomMod/issues/438
|
|
|
|
new BukkitRunnable()
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
plugin.pa.autoAddSpawnpoints();
|
|
|
|
}
|
|
|
|
}.runTaskLater(plugin, 60L);
|
2018-03-26 11:26:21 +00:00
|
|
|
// little workaround to stop spigot from autorestarting - causing AMP to detach from process.
|
2017-10-14 11:21:07 +00:00
|
|
|
SpigotConfig.config.set("settings.restart-on-crash", false);
|
2015-10-19 17:43:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void disable()
|
|
|
|
{
|
|
|
|
// Stop services and bridges
|
|
|
|
bridges.stop();
|
2016-02-29 20:48:17 +00:00
|
|
|
services.stop();
|
2015-10-19 17:43:46 +00:00
|
|
|
|
|
|
|
server.getScheduler().cancelTasks(plugin);
|
|
|
|
|
|
|
|
FLog.info("Plugin disabled");
|
|
|
|
}
|
|
|
|
|
|
|
|
public static class BuildProperties
|
|
|
|
{
|
2015-11-22 18:26:47 +00:00
|
|
|
|
|
|
|
public String author;
|
2016-05-12 19:40:39 +00:00
|
|
|
public String codename;
|
2015-11-22 18:26:47 +00:00
|
|
|
public String version;
|
2015-10-19 17:43:46 +00:00
|
|
|
public String number;
|
|
|
|
public String date;
|
2015-11-22 18:26:47 +00:00
|
|
|
public String head;
|
2015-10-19 17:43:46 +00:00
|
|
|
|
2016-05-12 19:40:39 +00:00
|
|
|
public void load(TotalFreedomMod plugin)
|
2015-10-19 17:43:46 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2016-05-12 19:40:39 +00:00
|
|
|
final Properties props;
|
2018-07-25 02:44:00 +00:00
|
|
|
|
2016-05-12 19:40:39 +00:00
|
|
|
try (InputStream in = plugin.getResource("build.properties"))
|
|
|
|
{
|
|
|
|
props = new Properties();
|
|
|
|
props.load(in);
|
|
|
|
}
|
2018-07-25 02:44:00 +00:00
|
|
|
|
|
|
|
author = props.getProperty("buildAuthor", "unknown");
|
|
|
|
codename = props.getProperty("buildCodeName", "unknown");
|
|
|
|
version = props.getProperty("buildVersion", pluginVersion);
|
|
|
|
number = props.getProperty("buildNumber", "1");
|
|
|
|
date = props.getProperty("buildDate", "unknown");
|
2018-08-09 06:26:12 +00:00
|
|
|
// Need to do this or it will display ${git.commit.id.abbrev}
|
|
|
|
head = props.getProperty("buildHead", "unknown").replace("${git.commit.id.abbrev}", "unknown");
|
2018-07-25 02:44:00 +00:00
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
FLog.severe("Could not load build properties! Did you compile with NetBeans/Maven?");
|
|
|
|
FLog.severe(ex);
|
|
|
|
}
|
2015-10-19 17:43:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public String formattedVersion()
|
|
|
|
{
|
|
|
|
return pluginVersion + "." + number + " (" + head + ")";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-12 19:40:39 +00:00
|
|
|
public static TotalFreedomMod plugin()
|
|
|
|
{
|
|
|
|
for (Plugin plugin : Bukkit.getPluginManager().getPlugins())
|
|
|
|
{
|
|
|
|
if (plugin.getName().equalsIgnoreCase(pluginName))
|
|
|
|
{
|
2018-07-31 07:01:29 +00:00
|
|
|
return (TotalFreedomMod)plugin;
|
2016-05-12 19:40:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2018-07-25 21:23:23 +00:00
|
|
|
@Override
|
|
|
|
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id)
|
|
|
|
{
|
|
|
|
return new CleanroomChunkGenerator(id);
|
|
|
|
}
|
2015-10-19 17:43:46 +00:00
|
|
|
}
|