Added alot
This commit is contained in:
parent
26a9e4eba8
commit
23b92e1246
@ -42,6 +42,7 @@ import java.io.*;
|
|||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -58,8 +59,6 @@ public class SavageFactions extends MPlugin {
|
|||||||
public static boolean startupFinished = false;
|
public static boolean startupFinished = false;
|
||||||
|
|
||||||
|
|
||||||
// Persistence related
|
|
||||||
public static ArrayList<FPlayer> playersFlying = new ArrayList();
|
|
||||||
|
|
||||||
public boolean PlaceholderApi;
|
public boolean PlaceholderApi;
|
||||||
// Commands
|
// Commands
|
||||||
@ -68,6 +67,7 @@ public class SavageFactions extends MPlugin {
|
|||||||
public boolean mc17 = false;
|
public boolean mc17 = false;
|
||||||
public boolean mc18 = false;
|
public boolean mc18 = false;
|
||||||
public boolean mc113 = false;
|
public boolean mc113 = false;
|
||||||
|
public boolean mc114 = false;
|
||||||
public boolean useNonPacketParticles = false;
|
public boolean useNonPacketParticles = false;
|
||||||
public boolean factionsFlight = false;
|
public boolean factionsFlight = false;
|
||||||
//multiversion material fields
|
//multiversion material fields
|
||||||
@ -134,16 +134,25 @@ public class SavageFactions extends MPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]);
|
int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]);
|
||||||
if (version == 7) {
|
switch (version) {
|
||||||
|
case 7:
|
||||||
SavageFactions.plugin.log("Minecraft Version 1.7 found, disabling banners, itemflags inside GUIs, and Titles.");
|
SavageFactions.plugin.log("Minecraft Version 1.7 found, disabling banners, itemflags inside GUIs, and Titles.");
|
||||||
mc17 = true;
|
mc17 = true;
|
||||||
} else if (version == 8) {
|
break;
|
||||||
|
case 8:
|
||||||
SavageFactions.plugin.log("Minecraft Version 1.8 found, Title Fadeouttime etc will not be configurable.");
|
SavageFactions.plugin.log("Minecraft Version 1.8 found, Title Fadeouttime etc will not be configurable.");
|
||||||
mc18 = true;
|
mc18 = true;
|
||||||
} else if (version == 13) {
|
break;
|
||||||
|
case 13:
|
||||||
SavageFactions.plugin.log("Minecraft Version 1.13 found, New Items will be used.");
|
SavageFactions.plugin.log("Minecraft Version 1.13 found, New Items will be used.");
|
||||||
mc113 = true;
|
mc113 = true;
|
||||||
changeItemIDSInConfig();
|
changeItemIDSInConfig();
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
SavageFactions.plugin.log("Minecraft Version 1.14 found.");
|
||||||
|
mc114 = true;
|
||||||
|
changeItemIDSInConfig();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
setupMultiversionMaterials();
|
setupMultiversionMaterials();
|
||||||
migrateFPlayerLeaders();
|
migrateFPlayerLeaders();
|
||||||
@ -172,10 +181,6 @@ public class SavageFactions extends MPlugin {
|
|||||||
}
|
}
|
||||||
faction.addFPlayer(fPlayer);
|
faction.addFPlayer(fPlayer);
|
||||||
}
|
}
|
||||||
playersFlying.clear();
|
|
||||||
for (FPlayer fPlayer : FPlayers.getInstance().getAllFPlayers()) {
|
|
||||||
playersFlying.add(fPlayer);
|
|
||||||
}
|
|
||||||
UtilFly.run();
|
UtilFly.run();
|
||||||
|
|
||||||
Board.getInstance().load();
|
Board.getInstance().load();
|
||||||
@ -336,7 +341,7 @@ public class SavageFactions extends MPlugin {
|
|||||||
|
|
||||||
private void migrateFPlayerLeaders() {
|
private void migrateFPlayerLeaders() {
|
||||||
List<String> lines = new ArrayList<>();
|
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 {
|
try {
|
||||||
BufferedReader br = new BufferedReader(new FileReader(fplayerFile));
|
BufferedReader br = new BufferedReader(new FileReader(fplayerFile));
|
||||||
@ -740,7 +745,13 @@ public class SavageFactions extends MPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getPrimaryGroup(OfflinePlayer player) {
|
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) {
|
public void debug(Level level, String s) {
|
||||||
|
@ -30,15 +30,17 @@ public class CmdShowClaims extends FCommand {
|
|||||||
}
|
}
|
||||||
for (String world : chunkMap.keySet()) {
|
for (String world : chunkMap.keySet()) {
|
||||||
String message = TL.COMMAND_SHOWCLAIMS_FORMAT.toString().replace("{world}", world);
|
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();
|
StringBuilder chunks = new StringBuilder();
|
||||||
for (String chunkString : chunkMap.get(world)) {
|
for (String chunkString : chunkMap.get(world)) {
|
||||||
chunks.append(chunkString + ", ");
|
chunks.append(chunkString).append(", ");
|
||||||
if (chunks.toString().length() >= 2000) {
|
if (chunks.toString().length() >= 2000) {
|
||||||
sendMessage(chunks.toString());
|
sendMessage(chunks.toString());
|
||||||
chunks.setLength(0);
|
chunks.setLength(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (chunks.length() != 0) sendMessage(chunks.toString());
|
||||||
sendMessage("");
|
sendMessage("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions.util;
|
package com.massivecraft.factions.util;
|
||||||
|
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.SavageFactions;
|
import com.massivecraft.factions.SavageFactions;
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
@ -12,18 +13,15 @@ import java.util.Iterator;
|
|||||||
|
|
||||||
public class UtilFly {
|
public class UtilFly {
|
||||||
|
|
||||||
public static ArrayList<FPlayer> playersFlying = SavageFactions.playersFlying;
|
|
||||||
|
|
||||||
public static void run() {
|
public static void run() {
|
||||||
if (!SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight"))
|
if (!SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
playersFlying.clear();
|
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> {
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> {
|
||||||
for (FPlayer fp : playersFlying) {
|
for (FPlayer fp : FPlayers.getInstance().getAllFPlayers()) {
|
||||||
if (fp != null)
|
if (fp.isFlying()) fp.checkIfNearbyEnemies();
|
||||||
fp.checkIfNearbyEnemies();
|
|
||||||
}
|
}
|
||||||
}, 0, SavageFactions.plugin.getConfig().getInt("fly-task-interval", 10));
|
}, 0, SavageFactions.plugin.getConfig().getInt("fly-task-interval", 10));
|
||||||
}
|
}
|
||||||
@ -36,11 +34,6 @@ public class UtilFly {
|
|||||||
fp.getPlayer().setFlying(fly);
|
fp.getPlayer().setFlying(fly);
|
||||||
fp.setFlying(fly);
|
fp.setFlying(fly);
|
||||||
|
|
||||||
if (fly) {
|
|
||||||
playersFlying.add(fp);
|
|
||||||
} else {
|
|
||||||
playersFlying.remove(fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
if (!damage) {
|
if (!damage) {
|
||||||
|
@ -2,6 +2,7 @@ package com.massivecraft.factions.zcore.fperms;
|
|||||||
|
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.SavageFactions;
|
import com.massivecraft.factions.SavageFactions;
|
||||||
|
import com.massivecraft.factions.util.MultiversionMaterials;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
@ -106,7 +107,7 @@ public enum PermissableAction {
|
|||||||
}
|
}
|
||||||
Material material = Material.matchMaterial(section.getString("materials." + name().toLowerCase().replace('_', '-')));
|
Material material = Material.matchMaterial(section.getString("materials." + name().toLowerCase().replace('_', '-')));
|
||||||
if (material == null) {
|
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);
|
Access access = fme.getFaction().getAccess(permissable, this);
|
||||||
|
@ -523,6 +523,9 @@ fperm-gui:
|
|||||||
home: 49
|
home: 49
|
||||||
# Material to show, if the material is colorable eg: Wool, Stained Clay it will update with it's access color
|
# Material to show, if the material is colorable eg: Wool, Stained Clay it will update with it's access color
|
||||||
materials:
|
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
|
build: STAINED_GLASS
|
||||||
destroy: STAINED_GLASS
|
destroy: STAINED_GLASS
|
||||||
frost-walk: STAINED_GLASS
|
frost-walk: STAINED_GLASS
|
||||||
|
Loading…
Reference in New Issue
Block a user