Now 1.7 compatible again

This commit is contained in:
DroppingAnvil 2019-10-09 16:53:32 -05:00
parent 2b0bfae44c
commit f730023b42
3 changed files with 30 additions and 28 deletions

View File

@ -147,18 +147,10 @@ public class FactionsPlugin extends MPlugin {
public void onEnable() {
log("==== Setup ====");
// Vault dependency check.
if (getServer().getPluginManager().getPlugin("Vault") == null) {
log("Vault is not present, the plugin will not run properly.");
getServer().getPluginManager().disablePlugin(instance);
return;
}
int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]);
switch (version) {
case 7:
FactionsPlugin.instance.log("Minecraft Version 1.7 found, disabling banners, itemflags inside GUIs, and Titles.");
FactionsPlugin.instance.log("Minecraft Version 1.7 found, disabling banners, itemflags inside GUIs, corners, and Titles.");
mc17 = true;
break;
case 8:
@ -177,6 +169,18 @@ public class FactionsPlugin extends MPlugin {
mc114 = true;
break;
}
//Dependency checks
if (Bukkit.getPluginManager().isPluginEnabled("Vault") && Bukkit.getPluginManager().isPluginEnabled("Essentials")) {
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.this.getServer().getServicesManager().getRegistration(Economy.class);
FactionsPlugin.econ = rsp.getProvider();
} else {
divider();
System.out.println("You are missing dependencies!");
System.out.println("Please verify EssentialsX and Vault are installed!");
Bukkit.getPluginManager().disablePlugin(instance);
divider();
return;
}
migrateFPlayerLeaders();
log("==== End Setup ====");
@ -292,16 +296,6 @@ public class FactionsPlugin extends MPlugin {
if (!CommodoreProvider.isSupported()) this.getCommand(refCommand).setTabCompleter(this);
if (Bukkit.getPluginManager().isPluginEnabled("Vault") && FactionsPlugin.this.getServer().getServicesManager().getRegistration(Essentials.class) != null) {
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.this.getServer().getServicesManager().getRegistration(Economy.class);
FactionsPlugin.econ = rsp.getProvider();
} else {
divider();
System.out.println("You are missing dependencies!");
System.out.println("Please verify EssentialsX and Vault are installed!");
Bukkit.getPluginManager().disablePlugin(this);
}
if (getDescription().getFullName().contains("BETA")) {
divider();
System.out.println("You are using a BETA version of the plugin!");

View File

@ -9,6 +9,8 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.util.CornerTask;
import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Comparator;
@ -29,6 +31,10 @@ public class CmdCorner extends FCommand {
@Override
public void perform(CommandContext context) {
if (FactionsPlugin.getInstance().mc17) {
context.player.sendMessage(ChatColor.RED + "This command is disabled!");
return;
}
FLocation to = new FLocation(context.player.getLocation());
if (FactionsPlugin.getInstance().getFactionsPlayerListener().getCorners().contains(to)) {
Faction cornerAt = Board.getInstance().getFactionAt(to);

View File

@ -54,10 +54,11 @@ public class FactionsPlayerListener implements Listener {
private Map<String, InteractAttemptSpam> interactSpammers = new HashMap<>();
public FactionsPlayerListener() {
this.corners = new HashSet<>();
for (Player player : FactionsPlugin.getInstance().getServer().getOnlinePlayers()) {
initPlayer(player);
}
if (!FactionsPlugin.getInstance().mc17) {
this.corners = new HashSet<>();
for (World world : FactionsPlugin.getInstance().getServer().getWorlds()) {
WorldBorder border = world.getWorldBorder();
if (border != null) {
@ -69,6 +70,7 @@ public class FactionsPlayerListener implements Listener {
}
}
}
}
public static Boolean isSystemFaction(Faction faction) {
return faction.isSafeZone() ||