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;
|
2020-08-15 22:41:23 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.admin.ActivityLog;
|
|
|
|
import me.totalfreedom.totalfreedommod.admin.AdminList;
|
2015-10-19 17:43:46 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.banning.BanManager;
|
2020-08-10 00:49:52 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.banning.IndefiniteBanList;
|
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;
|
2020-07-29 00:45:16 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.bridge.FAWEBridge;
|
2018-07-31 07:05:28 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.bridge.LibsDisguisesBridge;
|
2020-07-21 19:21:51 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.bridge.TFGuildsBridge;
|
2020-08-15 22:41:26 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.bridge.VanishBridge;
|
2018-07-31 07:05:28 +00:00
|
|
|
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.Trailer;
|
2015-10-19 17:43:46 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
|
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-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-07-07 05:21:35 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.shop.Votifier;
|
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;
|
2020-07-01 03:38:29 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.world.WorldRestrictions;
|
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;
|
2020-07-01 01:51:06 +00:00
|
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
2020-08-15 22:41:23 +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
|
|
|
|
2020-07-01 01:51:06 +00:00
|
|
|
public class TotalFreedomMod extends JavaPlugin
|
2015-10-19 17:43:46 +00:00
|
|
|
{
|
2020-07-01 01:51:06 +00:00
|
|
|
private static TotalFreedomMod plugin;
|
2020-08-04 06:31:26 +00:00
|
|
|
|
2020-07-01 01:51:06 +00:00
|
|
|
public static TotalFreedomMod getPlugin()
|
|
|
|
{
|
|
|
|
return plugin;
|
|
|
|
}
|
2020-08-04 06:31:26 +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
|
|
|
//
|
2020-07-01 01:51:06 +00:00
|
|
|
// Service Handler
|
|
|
|
public FreedomServiceHandler fsh;
|
|
|
|
// Command Loader
|
|
|
|
public CommandLoader cl;
|
2015-10-19 17:43:46 +00:00
|
|
|
// 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;
|
2020-08-15 22:41:23 +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 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-07-07 05:21:35 +00:00
|
|
|
public Votifier vo;
|
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;
|
2020-08-10 00:49:52 +00:00
|
|
|
public IndefiniteBanList im;
|
2020-04-14 06:40:22 +00:00
|
|
|
public PermissionManager pem;
|
2020-08-15 22:41:23 +00:00
|
|
|
public ProtectArea pa;
|
2020-08-04 22:16:11 +00:00
|
|
|
public Reddit rd;
|
2015-10-19 17:43:46 +00:00
|
|
|
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;
|
|
|
|
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;
|
2020-04-29 23:29:43 +00:00
|
|
|
public WorldRestrictions wr;
|
2017-12-28 05:50:39 +00:00
|
|
|
public SignBlocker snp;
|
2020-01-09 11:56:25 +00:00
|
|
|
public EntityWiper ew;
|
2020-07-16 04:06:58 +00:00
|
|
|
public Sitter st;
|
2020-08-15 22:41:26 +00:00
|
|
|
public VanishBridge vb;
|
2020-08-08 05:51:09 +00:00
|
|
|
public AMP amp;
|
2020-07-21 19:21:51 +00:00
|
|
|
|
2019-11-03 21:40:05 +00:00
|
|
|
//public HubWorldRestrictions hwr;
|
2015-10-19 17:43:46 +00:00
|
|
|
//
|
|
|
|
// 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;
|
2020-07-21 19:21:51 +00:00
|
|
|
public TFGuildsBridge tfg;
|
2015-10-19 17:43:46 +00:00
|
|
|
public WorldEditBridge web;
|
2020-07-29 00:45:16 +00:00
|
|
|
public FAWEBridge fab;
|
2018-02-09 08:21:44 +00:00
|
|
|
public WorldGuardBridge wgb;
|
2015-10-19 17:43:46 +00:00
|
|
|
|
|
|
|
@Override
|
2020-07-01 01:51:06 +00:00
|
|
|
public void onLoad()
|
2015-10-19 17:43:46 +00:00
|
|
|
{
|
2020-07-01 01:51:06 +00:00
|
|
|
plugin = this;
|
2015-10-19 17:43:46 +00:00
|
|
|
TotalFreedomMod.pluginName = plugin.getDescription().getName();
|
|
|
|
TotalFreedomMod.pluginVersion = plugin.getDescription().getVersion();
|
|
|
|
|
|
|
|
FLog.setPluginLogger(plugin.getLogger());
|
2020-07-01 01:51:06 +00:00
|
|
|
FLog.setServerLogger(getServer().getLogger());
|
2015-10-19 17:43:46 +00:00
|
|
|
|
2016-05-12 19:40:39 +00:00
|
|
|
build.load(plugin);
|
2015-10-19 17:43:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-07-01 01:51:06 +00:00
|
|
|
public void onEnable()
|
2015-10-19 17:43:46 +00:00
|
|
|
{
|
|
|
|
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"));
|
|
|
|
|
2020-07-01 01:51:06 +00:00
|
|
|
fsh = new FreedomServiceHandler();
|
|
|
|
|
2020-08-01 04:10:44 +00:00
|
|
|
config = new MainConfig();
|
|
|
|
config.load();
|
2020-07-01 01:51:06 +00:00
|
|
|
|
2020-08-04 06:31:26 +00:00
|
|
|
if (FUtil.inDeveloperMode())
|
|
|
|
{
|
|
|
|
FLog.debug("Developer mode enabled.");
|
|
|
|
}
|
|
|
|
|
2020-08-01 04:10:44 +00:00
|
|
|
cl = new CommandLoader();
|
|
|
|
cl.loadCommands();
|
2020-07-01 01:51:06 +00:00
|
|
|
|
|
|
|
BackupManager backups = new BackupManager();
|
2020-08-01 04:10:44 +00:00
|
|
|
backups.createAllBackups();
|
2016-05-12 19:40:39 +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
|
2020-07-01 01:51:06 +00:00
|
|
|
si = new ServerInterface();
|
|
|
|
sf = new SavedFlags();
|
|
|
|
wm = new WorldManager();
|
|
|
|
lv = new LogViewer();
|
|
|
|
sql = new SQLite();
|
2020-08-15 22:41:23 +00:00
|
|
|
al = new AdminList();
|
2020-07-01 01:51:06 +00:00
|
|
|
acl = new ActivityLog();
|
|
|
|
rm = new RankManager();
|
|
|
|
cb = new CommandBlocker();
|
|
|
|
eb = new EventBlocker();
|
|
|
|
bb = new BlockBlocker();
|
|
|
|
mb = new MobBlocker();
|
|
|
|
ib = new InteractBlocker();
|
|
|
|
pb = new PotionBlocker();
|
|
|
|
lp = new LoginProcess();
|
|
|
|
nu = new AntiNuke();
|
|
|
|
as = new AntiSpam();
|
|
|
|
wr = new WorldRestrictions();
|
|
|
|
pl = new PlayerList();
|
|
|
|
sh = new Shop();
|
2020-07-07 05:21:35 +00:00
|
|
|
vo = new Votifier();
|
2020-07-01 01:51:06 +00:00
|
|
|
an = new Announcer();
|
|
|
|
cm = new ChatManager();
|
|
|
|
dc = new Discord();
|
|
|
|
pul = new PunishmentList();
|
|
|
|
bm = new BanManager();
|
2020-08-10 00:49:52 +00:00
|
|
|
im = new IndefiniteBanList();
|
2020-07-01 01:51:06 +00:00
|
|
|
pem = new PermissionManager();
|
2020-08-15 22:41:23 +00:00
|
|
|
pa = new ProtectArea();
|
2020-08-04 22:16:11 +00:00
|
|
|
rd = new Reddit();
|
2020-07-01 01:51:06 +00:00
|
|
|
gr = new GameRuleHandler();
|
|
|
|
snp = new SignBlocker();
|
|
|
|
ew = new EntityWiper();
|
2020-07-16 04:06:58 +00:00
|
|
|
st = new Sitter();
|
2020-08-15 22:41:26 +00:00
|
|
|
vb = new VanishBridge();
|
2020-08-08 05:51:09 +00:00
|
|
|
amp = new AMP();
|
2017-10-21 17:31:17 +00:00
|
|
|
|
2016-03-07 20:32:05 +00:00
|
|
|
// Single admin utils
|
2020-07-01 01:51:06 +00:00
|
|
|
cs = new CommandSpy();
|
|
|
|
ca = new Cager();
|
|
|
|
fm = new Freezer();
|
|
|
|
or = new Orbiter();
|
|
|
|
mu = new Muter();
|
|
|
|
ebl = new EditBlocker();
|
|
|
|
pbl = new PVPBlocker();
|
|
|
|
fo = new Fuckoff();
|
|
|
|
ak = new AutoKick();
|
|
|
|
ae = new AutoEject();
|
|
|
|
mo = new Monitors();
|
|
|
|
|
|
|
|
mv = new MovementValidator();
|
|
|
|
sp = new ServerPing();
|
2016-03-07 20:32:05 +00:00
|
|
|
|
|
|
|
// Fun
|
2020-07-01 01:51:06 +00:00
|
|
|
cul = new CurseListener();
|
|
|
|
it = new ItemFun();
|
|
|
|
lm = new Landminer();
|
|
|
|
mp = new MP44();
|
|
|
|
jp = new Jumppads();
|
|
|
|
tr = new Trailer();
|
2016-03-07 20:32:05 +00:00
|
|
|
// HTTPD
|
2020-07-01 01:51:06 +00:00
|
|
|
hd = new HTTPDaemon();
|
2015-10-19 17:43:46 +00:00
|
|
|
|
2016-03-07 20:32:05 +00:00
|
|
|
// Start bridges
|
2020-07-01 01:51:06 +00:00
|
|
|
btb = new BukkitTelnetBridge();
|
|
|
|
cpb = new CoreProtectBridge();
|
|
|
|
esb = new EssentialsBridge();
|
|
|
|
ldb = new LibsDisguisesBridge();
|
2020-07-21 19:21:51 +00:00
|
|
|
tfg = new TFGuildsBridge();
|
2020-07-01 01:51:06 +00:00
|
|
|
web = new WorldEditBridge();
|
2020-07-29 00:45:16 +00:00
|
|
|
fab = new FAWEBridge();
|
2020-07-01 01:51:06 +00:00
|
|
|
wgb = new WorldGuardBridge();
|
|
|
|
|
2020-08-04 22:16:11 +00:00
|
|
|
fsh.startServices();
|
2020-07-01 01:51:06 +00:00
|
|
|
|
2020-08-05 07:01:21 +00:00
|
|
|
FLog.info("Started " + fsh.getServiceAmount() + " services.");
|
2015-10-19 17:43:46 +00:00
|
|
|
|
|
|
|
timer.update();
|
|
|
|
FLog.info("Version " + pluginVersion + " for " + ServerInterface.COMPILE_NMS_VERSION + " enabled in " + timer.getTotal() + "ms");
|
|
|
|
|
2020-08-04 06:31:26 +00:00
|
|
|
// Metrics @ https://bstats.org/plugin/bukkit/TotalFreedomMod/2966
|
|
|
|
new Metrics(this, 2966);
|
2015-10-19 17:43:46 +00:00
|
|
|
|
2020-08-15 22:41:23 +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
|
2020-07-01 01:51:06 +00:00
|
|
|
public void onDisable()
|
2015-10-19 17:43:46 +00:00
|
|
|
{
|
|
|
|
// Stop services and bridges
|
2020-08-04 22:16:11 +00:00
|
|
|
fsh.stopServices();
|
2015-10-19 17:43:46 +00:00
|
|
|
|
2020-07-01 01:51:06 +00:00
|
|
|
getServer().getScheduler().cancelTasks(plugin);
|
2015-10-19 17:43:46 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2020-07-21 19:21:51 +00:00
|
|
|
}
|