Added alot

This commit is contained in:
Driftay 2019-05-15 03:10:10 -04:00
parent 26a9e4eba8
commit 23b92e1246
5 changed files with 41 additions and 31 deletions

View File

@ -42,6 +42,7 @@ import java.io.*;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Level;
import java.util.stream.Collectors;
@ -58,8 +59,6 @@ public class SavageFactions extends MPlugin {
public static boolean startupFinished = false;
// Persistence related
public static ArrayList<FPlayer> playersFlying = new ArrayList();
public boolean PlaceholderApi;
// Commands
@ -68,6 +67,7 @@ public class SavageFactions extends MPlugin {
public boolean mc17 = false;
public boolean mc18 = false;
public boolean mc113 = false;
public boolean mc114 = false;
public boolean useNonPacketParticles = false;
public boolean factionsFlight = false;
//multiversion material fields
@ -134,16 +134,25 @@ public class SavageFactions extends MPlugin {
}
int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]);
if (version == 7) {
SavageFactions.plugin.log("Minecraft Version 1.7 found, disabling banners, itemflags inside GUIs, and Titles.");
mc17 = true;
} else if (version == 8) {
SavageFactions.plugin.log("Minecraft Version 1.8 found, Title Fadeouttime etc will not be configurable.");
mc18 = true;
} else if (version == 13) {
SavageFactions.plugin.log("Minecraft Version 1.13 found, New Items will be used.");
mc113 = true;
changeItemIDSInConfig();
switch (version) {
case 7:
SavageFactions.plugin.log("Minecraft Version 1.7 found, disabling banners, itemflags inside GUIs, and Titles.");
mc17 = true;
break;
case 8:
SavageFactions.plugin.log("Minecraft Version 1.8 found, Title Fadeouttime etc will not be configurable.");
mc18 = true;
break;
case 13:
SavageFactions.plugin.log("Minecraft Version 1.13 found, New Items will be used.");
mc113 = true;
changeItemIDSInConfig();
break;
case 14:
SavageFactions.plugin.log("Minecraft Version 1.14 found.");
mc114 = true;
changeItemIDSInConfig();
break;
}
setupMultiversionMaterials();
migrateFPlayerLeaders();
@ -172,10 +181,6 @@ public class SavageFactions extends MPlugin {
}
faction.addFPlayer(fPlayer);
}
playersFlying.clear();
for (FPlayer fPlayer : FPlayers.getInstance().getAllFPlayers()) {
playersFlying.add(fPlayer);
}
UtilFly.run();
Board.getInstance().load();
@ -336,7 +341,7 @@ public class SavageFactions extends MPlugin {
private void migrateFPlayerLeaders() {
List<String> lines = new ArrayList<>();
File fplayerFile = new File("plugins\\Factions\\players.json");
File fplayerFile = new File("plugins" + File.pathSeparator + "Factions" + File.pathSeparator + "players.json");
try {
BufferedReader br = new BufferedReader(new FileReader(fplayerFile));
@ -740,7 +745,13 @@ public class SavageFactions extends MPlugin {
}
public String getPrimaryGroup(OfflinePlayer player) {
return perms == null || !perms.hasGroupSupport() ? " " : perms.getPrimaryGroup(Bukkit.getWorlds().get(0).toString(), player);
AtomicReference<String> primaryGroup = new AtomicReference<>();
if (perms == null || !perms.hasGroupSupport()) return " ";
else {
Bukkit.getScheduler().runTaskAsynchronously(this, () -> primaryGroup.set(perms.getPrimaryGroup(Bukkit.getWorlds().get(0).toString(), player)));
return primaryGroup.get();
}
}
public void debug(Level level, String s) {

View File

@ -30,15 +30,17 @@ public class CmdShowClaims extends FCommand {
}
for (String world : chunkMap.keySet()) {
String message = TL.COMMAND_SHOWCLAIMS_FORMAT.toString().replace("{world}", world);
sendMessage(message.replace("{chunks}", "")); // made {chunks} blank as I removed the placeholder and people wont update their config :shrug:
// made {chunks} blank as I removed the placeholder and people wont update their config :shrug:
sendMessage(message.replace("{chunks}", ""));
StringBuilder chunks = new StringBuilder();
for (String chunkString : chunkMap.get(world)) {
chunks.append(chunkString + ", ");
chunks.append(chunkString).append(", ");
if (chunks.toString().length() >= 2000) {
sendMessage(chunks.toString());
chunks.setLength(0);
}
}
if (chunks.length() != 0) sendMessage(chunks.toString());
sendMessage("");
}

View File

@ -1,6 +1,7 @@
package com.massivecraft.factions.util;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.struct.Relation;
@ -12,18 +13,15 @@ import java.util.Iterator;
public class UtilFly {
public static ArrayList<FPlayer> playersFlying = SavageFactions.playersFlying;
public static void run() {
if (!SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight"))
return;
playersFlying.clear();
Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> {
for (FPlayer fp : playersFlying) {
if (fp != null)
fp.checkIfNearbyEnemies();
for (FPlayer fp : FPlayers.getInstance().getAllFPlayers()) {
if (fp.isFlying()) fp.checkIfNearbyEnemies();
}
}, 0, SavageFactions.plugin.getConfig().getInt("fly-task-interval", 10));
}
@ -36,11 +34,6 @@ public class UtilFly {
fp.getPlayer().setFlying(fly);
fp.setFlying(fly);
if (fly) {
playersFlying.add(fp);
} else {
playersFlying.remove(fp);
}
if (!silent) {
if (!damage) {

View File

@ -2,6 +2,7 @@ package com.massivecraft.factions.zcore.fperms;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.util.MultiversionMaterials;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
@ -106,7 +107,7 @@ public enum PermissableAction {
}
Material material = Material.matchMaterial(section.getString("materials." + name().toLowerCase().replace('_', '-')));
if (material == null) {
material = SavageFactions.plugin.STAINED_CLAY;
material = MultiversionMaterials.fromString(SavageFactions.plugin.getConfig().getString("fperm-gui.action.materials")).parseMaterial();
}
Access access = fme.getFaction().getAccess(permissable, this);

View File

@ -523,6 +523,9 @@ fperm-gui:
home: 49
# Material to show, if the material is colorable eg: Wool, Stained Clay it will update with it's access color
materials:
# This is important to change, depending on what you use. If you use clay, make it clay, if its glass make it glass.
default: STAINED_GLASS
# These below are for different actual permissions.
build: STAINED_GLASS
destroy: STAINED_GLASS
frost-walk: STAINED_GLASS