Compare commits

...

21 Commits

Author SHA1 Message Date
Driftay
4f675dfd66 Version Change 2020-02-11 22:23:14 -05:00
Driftay
22957b641b Merge remote-tracking branch 'origin/1.6.x' into 1.6.x 2020-02-11 22:17:21 -05:00
Driftay
0fc3e47289 Fixed Spawner Mining Error 2020-02-11 22:17:01 -05:00
DroppingAnvil
730693aed1 Merge pull request #47 from N0tMyFaultOG/1.6.x
Fix typo in issue template
2020-02-07 13:10:41 -06:00
NotMyFault
61570be012 Fixed upercase version
Kinda triggering my ocd
2020-02-04 02:37:00 +01:00
Driftay
bcc04e6174 Updated TimeUtil 2020-02-01 03:01:36 -05:00
Driftay
d30780e06e Created Time Utility for Shields 2020-01-30 04:18:18 -05:00
Driftay
ed73baf5f1 SeeChunk 1.15 Fix 2020-01-29 14:32:32 -05:00
Driftay
94d2035c78 Version Change 2020-01-27 00:52:52 -05:00
Driftay
8ff8c78a44 Fixed Mouse Movement for Wild Teleportation & Properly initialized tntfill aliases 2020-01-27 00:47:48 -05:00
Driftay
591dc2172f Fixed F Disband w/Admins Disbanding Other Factions 2020-01-26 16:17:08 -05:00
Driftay
1a4c860c46 Fixed F Power Upgrade 2020-01-26 16:08:03 -05:00
Driftay
ad56264c5d 1.15 Support for Permissable Items & Fixed F Upgrades GUI Rows 2020-01-26 15:54:54 -05:00
Driftay
def1a8b15a Merge remote-tracking branch 'origin/1.6.x' into 1.6.x 2020-01-26 12:51:58 -05:00
Driftay
8b577d360b Added Barrels to Container Permissible Action & Fixed NPE When running f seechunk on 1.15.1 2020-01-26 12:51:41 -05:00
DroppingAnvil
f34ebc73fa Remove unused import. 2020-01-26 00:48:21 -06:00
DroppingAnvil
c86db7ab51 Fix system factions with custom names fly permissions. 2020-01-26 00:48:21 -06:00
Driftay
070f239948 Merge remote-tracking branch 'origin/1.6.x' into 1.6.x 2020-01-20 03:47:25 -05:00
Driftay
018f08699d 1.15 Item Conversion Complete 2020-01-20 03:46:53 -05:00
Driftay
5542245b2a Update README.md 2020-01-20 03:07:36 -05:00
Driftay
6eb204587d Update README.md 2020-01-20 02:33:32 -05:00
27 changed files with 1640 additions and 1079 deletions

View File

@@ -23,7 +23,7 @@ A clear and concise description of what you expected to happen.
**Screenshots** **Screenshots**
If applicable, add screenshots to help explain your problem. If applicable, add screenshots to help explain your problem.
**Server VErsion (please complete the following information):** **Server Version (please complete the following information):**
- Spigot Version: [e.g. Paperspigot 1.8.8] - Spigot Version: [e.g. Paperspigot 1.8.8]
- Factions Version [use /f version] - Factions Version [use /f version]
- Minecraft Version: [If a bug is dependent on client version] - Minecraft Version: [If a bug is dependent on client version]

View File

@@ -1,9 +1,8 @@
# SaberFactions # SaberFactions
![Downloads](https://img.shields.io/github/downloads/driftay/saber-factions/total.svg) [![CodeFactor](https://www.codefactor.io/repository/github/driftay/saber-factions/badge)](https://www.codefactor.io/repository/github/driftay/saber-factions) ![Downloads](https://img.shields.io/github/downloads/driftay/saber-factions/total.svg) [![CodeFactor](https://www.codefactor.io/repository/github/driftay/saber-factions/badge)](https://www.codefactor.io/repository/github/driftay/saber-factions) [![License](https://img.shields.io/badge/license-GNU%20General%20Public%20License%20v3.0-brightgreen)](https://github.com/SaberLLC/Saber-Factions/blob/1.6.x/LICENSE) ![GitHub commit activity](https://img.shields.io/github/commit-activity/m/SaberLLC/Saber-Factions)
SaberFactions is a fork of both FactionsUUID and SavageFactions. Creators of those plugins include DtrShock and ProSavage. Credits to them. SaberFactions is an exotic, performance optmized, and feature rich factions plugin that focuses on not only making the player experience as great as possibly but maintaining this aspect with the cost of NOTHING! We strive to continue development for SaberFactions as the factions community is strongly growing and seeking new players every day.
SaberFactions is the newest, latest and greatest factions plugin designed for the best and most functional factions experience minecraft has seen!
## Some Exciting Features ## Some Exciting Features
Some of our features include the following Some of our features include the following
@@ -14,6 +13,12 @@ Some of our features include the following
* More F Upgrades - Unbreakable Redstone Upgrade, Members Upgrade, and Power Upgrade. * More F Upgrades - Unbreakable Redstone Upgrade, Members Upgrade, and Power Upgrade.
* Factions Corner - In the corner of a world? No Problem /f corner will claim your entire buffer for you! * Factions Corner - In the corner of a world? No Problem /f corner will claim your entire buffer for you!
* Command Cooldowns - Configurable Command Cooldowns for most "spam" commands. And so Much More to Come! * Command Cooldowns - Configurable Command Cooldowns for most "spam" commands. And so Much More to Come!
* Faction Points - A point based currency that can be used for any aspect of factions gameplay!
* Faction Shop - A shop that essentially lets players buy in-game items in exchange for faction points!
* Faction Discord Integration - A discord intergrated factions bot for each faction to have their own personalized discord bot within their faction!
* Faction Audit - A full based logging system (GUI designed) to see every aspect of what happens in your faction!
* Factions Check System - An automated check system that alerts players when to check walls/buffers!
* Faction Reserves - A system designed to reserve a specific faction name for a specific player!
## Dependency With Maven ## Dependency With Maven
``` ```
@@ -25,9 +30,9 @@ Some of our features include the following
</repositories> </repositories>
<dependency> <dependency>
<groupId>com.github.Driftay</groupId> <groupId>com.github.SaberLLC</groupId>
<artifactId>Saber-Factions</artifactId> <artifactId>Saber-Factions</artifactId>
<version>1.4.1</version> <version>2.2.7-STABLE</version>
</dependency> </dependency>
``` ```
## Moving Forward ## Moving Forward
@@ -36,8 +41,8 @@ Moving forward we plan to take all suggestions into consideration, as they come
We Plan on Releasing the latest and greatest factions/skyblock/prison plugins minecraft has to offer and wont settle for anything less We Plan on Releasing the latest and greatest factions/skyblock/prison plugins minecraft has to offer and wont settle for anything less
## Support ## Support
Our Discord is Currently In Progress of a Massive Overhaul, but we still encourage our community to join and express any concerns/questions/suggestions they may have Have a problem, question, or concer? We encourage our community to join and express any inquiry you may have
https://Discord.Saber.pw https://discord.saber.pw
Look forward to a bright future and a journey with all of you! Look forward to a bright future and a journey with all of you!

View File

@@ -4,7 +4,7 @@
<groupId>com.massivecraft</groupId> <groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId> <artifactId>Factions</artifactId>
<version>1.6.9.5-2.2.7-RC</version> <version>1.6.9.5-2.2.9-RC</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>SaberFactions</name> <name>SaberFactions</name>

View File

@@ -78,6 +78,7 @@ public class FactionsPlugin extends MPlugin {
public boolean mc112 = false; public boolean mc112 = false;
public boolean mc113 = false; public boolean mc113 = false;
public boolean mc114 = false; public boolean mc114 = false;
public boolean mc115 = false;
public boolean useNonPacketParticles = false; public boolean useNonPacketParticles = false;
public boolean factionsFlight = false; public boolean factionsFlight = false;
SkriptAddon skriptAddon; SkriptAddon skriptAddon;
@@ -164,6 +165,10 @@ public class FactionsPlugin extends MPlugin {
FactionsPlugin.instance.log("Minecraft Version 1.14 found."); FactionsPlugin.instance.log("Minecraft Version 1.14 found.");
mc114 = true; mc114 = true;
break; break;
case 15:
FactionsPlugin.instance.log("Minecraft Version 1.15 found.");
mc115 = true;
break;
} }
migrateFPlayerLeaders(); migrateFPlayerLeaders();
log("==== End Setup ===="); log("==== End Setup ====");
@@ -464,7 +469,7 @@ public class FactionsPlugin extends MPlugin {
} }
public ItemStack createItem(Material material, int amount, short datavalue, String name, List<String> lore) { public ItemStack createItem(Material material, int amount, short datavalue, String name, List<String> lore) {
ItemStack item = new ItemStack(XMaterial.matchXMaterial(material.toString()).parseMaterial(), amount, datavalue); ItemStack item = new ItemStack(XMaterial.matchXMaterial(material.toString()).get().parseMaterial(), amount, datavalue);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
meta.setDisplayName(color(name)); meta.setDisplayName(color(name));
meta.setLore(colorList(lore)); meta.setLore(colorList(lore));

View File

@@ -72,13 +72,14 @@ public class CmdDisband extends FCommand {
return; return;
} }
boolean access = false; boolean access = false;
if (context.fPlayer.getPlayer().hasMetadata("disband_confirm") && (time = context.fPlayer.getPlayer().getMetadata("disband_confirm").get(0).asLong()) != 0L && System.currentTimeMillis() - time <= TimeUnit.SECONDS.toMillis(3L)) { if (context.fPlayer.getPlayer().hasMetadata("disband_confirm") && (time = context.fPlayer.getPlayer().getMetadata("disband_confirm").get(0).asLong()) != 0L && System.currentTimeMillis() - time <= TimeUnit.SECONDS.toMillis(3L)) {
access = true; access = true;
} }
if (!access) { if (!access) {
if(Conf.useDisbandGUI) { if(Conf.useDisbandGUI && !context.fPlayer.isAdminBypassing() || !context.player.isOp()) {
if (!disbandMap.containsKey(context.player.getUniqueId().toString())) { if (!disbandMap.containsKey(context.player.getUniqueId().toString())) {
new FDisbandFrame(context.faction).buildGUI(context.fPlayer); new FDisbandFrame(context.faction).buildGUI(context.fPlayer);
return; return;

View File

@@ -9,7 +9,6 @@ import com.massivecraft.factions.zcore.fperms.Access;
import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -103,7 +102,7 @@ public class CmdFly extends FCommand {
if (toFac.getAccess(fme, PermissableAction.FLY) == Access.ALLOW) return true; if (toFac.getAccess(fme, PermissableAction.FLY) == Access.ALLOW) return true;
if (fme.getFaction().isWilderness()) return false; if (fme.getFaction().isWilderness()) return false;
if (toFac.isSystemFaction()) if (toFac.isSystemFaction())
return me.hasPermission(Permission.valueOf("FLY_" + ChatColor.stripColor(toFac.getTag()).toUpperCase()).node); return me.hasPermission(toFac.isWilderness() ? Permission.FLY_WILDERNESS.node : toFac.isSafeZone() ? Permission.FLY_SAFEZONE.node : Permission.FLY_WARZONE.node);
Relation relationTo = toFac.getRelationTo(fme.getFaction()); Relation relationTo = toFac.getRelationTo(fme.getFaction());
if (!relationTo.isEnemy() && !relationTo.isMember()) if (!relationTo.isEnemy() && !relationTo.isMember())
return me.hasPermission(Permission.valueOf("FLY_" + relationTo.name()).node); return me.hasPermission(Permission.valueOf("FLY_" + relationTo.name()).node);

View File

@@ -74,8 +74,10 @@ public class CmdSeeChunk extends FCommand {
for (Object nameObject : seeChunkMap.keySet()) { for (Object nameObject : seeChunkMap.keySet()) {
String name = nameObject + ""; String name = nameObject + "";
Player player = Bukkit.getPlayer(name); Player player = Bukkit.getPlayer(name);
if (player != null) {
showBorders(player); showBorders(player);
} }
}
manageTask(); manageTask();
}, 0, interval); }, 0, interval);
} }
@@ -110,24 +112,19 @@ public class CmdSeeChunk extends FCommand {
private void showPillar(Player player, World world, int blockX, int blockZ) { private void showPillar(Player player, World world, int blockX, int blockZ) {
for (int blockY = 0; blockY < player.getLocation().getBlockY() + 30; blockY++) { for (int blockY = 0; blockY < player.getLocation().getBlockY() + 30; blockY++) {
Location loc = new Location(world, blockX, blockY, blockZ).add(0.5, 0, 0.5); Location loc = new Location(world, blockX, blockY, blockZ).add(0.5, 0, 0.5);
if (loc.getBlock().getType() != Material.AIR) { if (loc.getBlock().getType() != Material.AIR) continue;
continue;
}
if (useParticles) { if (useParticles) {
if (FactionsPlugin.getInstance().useNonPacketParticles) { if (FactionsPlugin.getInstance().useNonPacketParticles) {
// Dust options only exists in the 1.13 API, so we use an // Dust options only exists in the 1.13 API, so we use an
// alternative method to achieve this in lower versions. // alternative method to achieve this in lower versions.
if (FactionsPlugin.getInstance().mc113 || FactionsPlugin.getInstance().mc114) { if (FactionsPlugin.getInstance().mc113 || FactionsPlugin.getInstance().mc114 || FactionsPlugin.getInstance().mc115) {
player.spawnParticle(Particle.REDSTONE, loc, 0, new Particle.DustOptions(Color.RED, 1)); player.spawnParticle(Particle.REDSTONE, loc, 0, new Particle.DustOptions(Color.RED, 1));
} else { } else {
player.getWorld().spawnParticle(Particle.REDSTONE, loc, 0, 255, 0, 0, 1); player.getWorld().spawnParticle(Particle.REDSTONE, loc, 0, 255, 0, 0, 1);
} }
} else { } else {
this.effect.display(0, 0, 0, 0, 1, loc, player); this.effect.display(0, 0, 0, 0, 1, loc, player);
} }
} else { } else {
Material type = blockY % 5 == 0 ? XMaterial.REDSTONE_LAMP.parseMaterial() : XMaterial.BLACK_STAINED_GLASS.parseMaterial(); Material type = blockY % 5 == 0 ? XMaterial.REDSTONE_LAMP.parseMaterial() : XMaterial.BLACK_STAINED_GLASS.parseMaterial();
VisualizeUtil.addLocation(player, loc, type); VisualizeUtil.addLocation(player, loc, type);

View File

@@ -62,7 +62,7 @@ public enum FLogType {
} }
public Material getMaterial() { public Material getMaterial() {
return XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("faudit-gui.materials." + name().toLowerCase())).parseMaterial(); return XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("faudit-gui.materials." + name().toLowerCase())).get().parseMaterial();
} }
public String getMsg() { public String getMsg() {

View File

@@ -52,19 +52,19 @@ public class CheckSettingsFrame implements InventoryHolder, FactionGUI {
public void build() { public void build() {
Faction faction = fPlayer.getFaction(); Faction faction = fPlayer.getFaction();
ItemStack wallsStack = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("f-check.wall-check.Type")).parseItem(); ItemStack wallsStack = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("f-check.wall-check.Type")).get().parseItem();
ItemMeta wallsMeta = wallsStack.getItemMeta(); ItemMeta wallsMeta = wallsStack.getItemMeta();
wallsMeta.setDisplayName(TL.CHECK_WALL_CHECK_GUI_ICON.toString()); wallsMeta.setDisplayName(TL.CHECK_WALL_CHECK_GUI_ICON.toString());
wallsMeta.setLore(Collections.singletonList(TL.CHECK_CHECK_LORE_LINE.format(getFormatted(faction.getWallCheckMinutes())))); wallsMeta.setLore(Collections.singletonList(TL.CHECK_CHECK_LORE_LINE.format(getFormatted(faction.getWallCheckMinutes()))));
wallsStack.setItemMeta(wallsMeta); wallsStack.setItemMeta(wallsMeta);
inventory.setItem(FactionsPlugin.getInstance().getConfig().getInt("f-check.wall-check.slot"), wallsStack); inventory.setItem(FactionsPlugin.getInstance().getConfig().getInt("f-check.wall-check.slot"), wallsStack);
ItemStack bufferStack = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("f-check.buffer-check.Type")).parseItem(); ItemStack bufferStack = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("f-check.buffer-check.Type")).get().parseItem();
ItemMeta bufferMeta = bufferStack.getItemMeta(); ItemMeta bufferMeta = bufferStack.getItemMeta();
bufferMeta.setDisplayName(TL.CHECK_BUFFER_CHECK_GUI_ICON.toString()); bufferMeta.setDisplayName(TL.CHECK_BUFFER_CHECK_GUI_ICON.toString());
bufferMeta.setLore(Collections.singletonList(TL.CHECK_CHECK_LORE_LINE.format(getFormatted(faction.getBufferCheckMinutes())))); bufferMeta.setLore(Collections.singletonList(TL.CHECK_CHECK_LORE_LINE.format(getFormatted(faction.getBufferCheckMinutes()))));
bufferStack.setItemMeta(bufferMeta); bufferStack.setItemMeta(bufferMeta);
inventory.setItem(FactionsPlugin.getInstance().getConfig().getInt("f-check.buffer-check.slot"), bufferStack); inventory.setItem(FactionsPlugin.getInstance().getConfig().getInt("f-check.buffer-check.slot"), bufferStack);
ItemStack historyStack = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("f-check.history.Type")).parseItem(); ItemStack historyStack = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("f-check.history.Type")).get().parseItem();
ItemMeta historyMeta = historyStack.getItemMeta(); ItemMeta historyMeta = historyStack.getItemMeta();
historyMeta.setDisplayName(TL.CHECK_HISTORY_GUI_ICON.toString()); historyMeta.setDisplayName(TL.CHECK_HISTORY_GUI_ICON.toString());
historyStack.setItemMeta(historyMeta); historyStack.setItemMeta(historyMeta);

View File

@@ -26,7 +26,7 @@ public class CmdTntFill extends FCommand {
public CmdTntFill() { public CmdTntFill() {
super(); super();
this.aliases.add("tntfill"); this.aliases.addAll(Aliases.tnt_tntfill);
this.requiredArgs.add("radius"); this.requiredArgs.add("radius");
this.requiredArgs.add("amount"); this.requiredArgs.add("amount");

View File

@@ -46,7 +46,7 @@ public class WildGUI implements FactionGUI {
@Override @Override
public void build() { public void build() {
inv = Bukkit.createInventory(this, FactionsPlugin.getInstance().getConfig().getInt("Wild.GUI.Size"), FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("Wild.GUI.Name"))); inv = Bukkit.createInventory(this, FactionsPlugin.getInstance().getConfig().getInt("Wild.GUI.Size"), FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("Wild.GUI.Name")));
ItemStack fillItem = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("Wild.GUI.FillMaterial")).parseItem(); ItemStack fillItem = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("Wild.GUI.FillMaterial")).get().parseItem();
ItemMeta meta = fillItem.getItemMeta(); ItemMeta meta = fillItem.getItemMeta();
if (meta == null) return; if (meta == null) return;
meta.setDisplayName(""); meta.setDisplayName("");
@@ -55,7 +55,7 @@ public class WildGUI implements FactionGUI {
inv.setItem(fill, fillItem); inv.setItem(fill, fillItem);
} }
for (String key : Objects.requireNonNull(FactionsPlugin.getInstance().getConfig().getConfigurationSection("Wild.Zones")).getKeys(false)) { for (String key : Objects.requireNonNull(FactionsPlugin.getInstance().getConfig().getConfigurationSection("Wild.Zones")).getKeys(false)) {
ItemStack zoneItem = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("Wild.Zones." + key + ".Material")).parseItem(); ItemStack zoneItem = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("Wild.Zones." + key + ".Material")).get().parseItem();
ItemMeta zoneMeta = zoneItem.getItemMeta(); ItemMeta zoneMeta = zoneItem.getItemMeta();
if (zoneMeta == null) return; if (zoneMeta == null) return;
List<String> lore = new ArrayList<>(); List<String> lore = new ArrayList<>();

View File

@@ -40,6 +40,7 @@ import org.bukkit.potion.PotionEffectType;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -161,20 +162,22 @@ public class FactionsBlockListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) { public void onBlockPlace(BlockPlaceEvent event) {
Faction at = Board.getInstance().getFactionAt(new FLocation(event.getBlockPlaced()));
if (!event.canBuild()) return; if (!event.canBuild()) return;
if (event.getBlockPlaced().getType() == Material.FIRE) return; if (event.getBlockPlaced().getType() == Material.FIRE) return;
boolean isSpawner = event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial());
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false)) { if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false)) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
if (event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial()) && Conf.spawnerLock) {
if (isSpawner) {
if (Conf.spawnerLock) {
event.setCancelled(true); event.setCancelled(true);
event.getPlayer().sendMessage(FactionsPlugin.getInstance().color(TL.COMMAND_SPAWNER_LOCK_CANNOT_PLACE.toString())); event.getPlayer().sendMessage(FactionsPlugin.getInstance().color(TL.COMMAND_SPAWNER_LOCK_CANNOT_PLACE.toString()));
} }
} }
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockFromTo(BlockFromToEvent event) { public void onBlockFromTo(BlockFromToEvent event) {
@@ -377,7 +380,7 @@ public class FactionsBlockListener implements Listener {
int radius = FactionsPlugin.getInstance().getConfig().getInt("fbanners.Banner-Effect-Radius"); int radius = FactionsPlugin.getInstance().getConfig().getInt("fbanners.Banner-Effect-Radius");
List<String> effects = FactionsPlugin.getInstance().getConfig().getStringList("fbanners.Effects"); List<String> effects = FactionsPlugin.getInstance().getConfig().getStringList("fbanners.Effects");
int affectorTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(FactionsPlugin.getInstance(), () -> { int affectorTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(FactionsPlugin.getInstance(), () -> {
for (Entity e1 : banner.getLocation().getWorld().getNearbyEntities(banner.getLocation(), radius, 255.0, radius)) { for (Entity e1 : Objects.requireNonNull(banner.getLocation().getWorld()).getNearbyEntities(banner.getLocation(), radius, 255.0, radius)) {
if (e1 instanceof Player) { if (e1 instanceof Player) {
Player player = (Player) e1; Player player = (Player) e1;
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player); FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
@@ -386,7 +389,7 @@ public class FactionsBlockListener implements Listener {
} }
for (String effect : effects) { for (String effect : effects) {
String[] components = effect.split(":"); String[] components = effect.split(":");
player.addPotionEffect(new PotionEffect(PotionEffectType.getByName(components[0]), 100, Integer.parseInt(components[1]))); player.addPotionEffect(new PotionEffect(Objects.requireNonNull(PotionEffectType.getByName(components[0])), 100, Integer.parseInt(components[1])));
} }
ParticleEffect.LAVA.display(1.0f, 1.0f, 1.0f, 1.0f, 10, banner.getLocation(), 16.0); ParticleEffect.LAVA.display(1.0f, 1.0f, 1.0f, 1.0f, 10, banner.getLocation(), 16.0);
ParticleEffect.FLAME.display(1.0f, 1.0f, 1.0f, 1.0f, 10, banner.getLocation(), 16.0); ParticleEffect.FLAME.display(1.0f, 1.0f, 1.0f, 1.0f, 10, banner.getLocation(), 16.0);
@@ -493,13 +496,25 @@ public class FactionsBlockListener implements Listener {
Block block = event.getBlock(); Block block = event.getBlock();
Faction at = Board.getInstance().getFactionAt(new FLocation(block)); Faction at = Board.getInstance().getFactionAt(new FLocation(block));
boolean isSpawner = event.getBlock().getType() == XMaterial.SPAWNER.parseMaterial(); boolean isSpawner = event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial());
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), !isSpawner ? "destroy" : "mine spawners", false)) {
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
if (block != null && isSpawner) {
ItemStack item = new ItemStack(block.getType(), 1, (short) block.getData()); FPlayer fme = FPlayers.getInstance().getByPlayer(event.getPlayer());
if (fme == null || !fme.hasFaction()) return;
if (isSpawner) {
Access access = fme.getFaction().getAccess(fme, PermissableAction.SPAWNER);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "mine spawners");
}
}
if (isSpawner && !fme.isAdminBypassing()) {
ItemStack item = new ItemStack(block.getType(), 1, block.getData());
if (at != null && at.isNormal()) { if (at != null && at.isNormal()) {
FPlayer fplayer = FPlayers.getInstance().getByPlayer(event.getPlayer()); FPlayer fplayer = FPlayers.getInstance().getByPlayer(event.getPlayer());
if (fplayer != null) { if (fplayer != null) {

View File

@@ -338,7 +338,7 @@ public class FactionsPlayerListener implements Listener {
return PermissableAction.DOOR; return PermissableAction.DOOR;
if (material.name().toUpperCase().contains("BUTTON") || material.name().toUpperCase().contains("PRESSURE") || material.name().contains("DIODE") || material.name().contains("COMPARATOR")) if (material.name().toUpperCase().contains("BUTTON") || material.name().toUpperCase().contains("PRESSURE") || material.name().contains("DIODE") || material.name().contains("COMPARATOR"))
return PermissableAction.BUTTON; return PermissableAction.BUTTON;
if (FactionsPlugin.instance.mc113 || FactionsPlugin.instance.mc114) { if (FactionsPlugin.instance.mc113 || FactionsPlugin.instance.mc114 || FactionsPlugin.getInstance().mc115) {
switch (material) { switch (material) {
case LEVER: case LEVER:
return PermissableAction.LEVER; return PermissableAction.LEVER;
@@ -381,6 +381,8 @@ public class FactionsPlayerListener implements Listener {
case TRAPPED_CHEST: case TRAPPED_CHEST:
case CHEST_MINECART: case CHEST_MINECART:
case BARREL:
case SHULKER_BOX: case SHULKER_BOX:
case BLACK_SHULKER_BOX: case BLACK_SHULKER_BOX:
case BLUE_SHULKER_BOX: case BLUE_SHULKER_BOX:
@@ -819,7 +821,7 @@ public class FactionsPlayerListener implements Listener {
Material type; Material type;
if (event.getItem() != null) { if (event.getItem() != null) {
// Convert 1.8 Material Names -> 1.14 // Convert 1.8 Material Names -> 1.14
type = XMaterial.matchXMaterial(event.getItem().getType().toString()).parseMaterial(); type = XMaterial.matchXMaterial(event.getItem().getType().toString()).get().parseMaterial();
} else { } else {
type = null; type = null;
} }
@@ -918,13 +920,22 @@ public class FactionsPlayerListener implements Listener {
} }
} }
@EventHandler @EventHandler
public void onLogoutMove(PlayerMoveEvent e) { public void onLogoutMove(PlayerMoveEvent e) {
LogoutHandler handler = LogoutHandler.getByName(e.getPlayer().getName()); LogoutHandler handler = LogoutHandler.getByName(e.getPlayer().getName());
if (Objects.requireNonNull(e.getTo()).getBlockX() == e.getFrom().getBlockX() &&
e.getTo().getBlockY() == e.getFrom().getBlockY() &&
e.getTo().getBlockZ() == e.getFrom().getBlockZ())
return;
if (handler.isLogoutActive(e.getPlayer())) { if (handler.isLogoutActive(e.getPlayer())) {
handler.cancelLogout(e.getPlayer()); handler.cancelLogout(e.getPlayer());
e.getPlayer().sendMessage(String.valueOf(TL.COMMAND_LOGOUT_MOVED)); e.getPlayer().sendMessage(String.valueOf(TL.COMMAND_LOGOUT_MOVED));
} }
if (CmdWild.waitingTeleport.containsKey(e.getPlayer())) { if (CmdWild.waitingTeleport.containsKey(e.getPlayer())) {
CmdWild.waitingTeleport.remove(e.getPlayer()); CmdWild.waitingTeleport.remove(e.getPlayer());
FPlayers.getInstance().getByPlayer(e.getPlayer()).msg(TL.COMMAND_WILD_INTERUPTED); FPlayers.getInstance().getByPlayer(e.getPlayer()).msg(TL.COMMAND_WILD_INTERUPTED);

View File

@@ -96,7 +96,7 @@ public class MissionGUI implements FactionGUI {
if (configurationSection == null) { if (configurationSection == null) {
return; return;
} }
ItemStack fillItem = XMaterial.matchXMaterial(configurationSection.getString("FillItem.Material")).parseItem(); ItemStack fillItem = XMaterial.matchXMaterial(configurationSection.getString("FillItem.Material")).get().parseItem();
ItemMeta fillmeta = fillItem.getItemMeta(); ItemMeta fillmeta = fillItem.getItemMeta();
fillmeta.setDisplayName(""); fillmeta.setDisplayName("");
fillItem.setItemMeta(fillmeta); fillItem.setItemMeta(fillmeta);
@@ -109,7 +109,7 @@ public class MissionGUI implements FactionGUI {
ConfigurationSection section = configurationSection.getConfigurationSection(key); ConfigurationSection section = configurationSection.getConfigurationSection(key);
int slot = section.getInt("Slot"); int slot = section.getInt("Slot");
ItemStack itemStack = XMaterial.matchXMaterial(section.getString("Material")).parseItem(); ItemStack itemStack = XMaterial.matchXMaterial(section.getString("Material")).get().parseItem();
ItemMeta itemMeta = itemStack.getItemMeta(); ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', section.getString("Name"))); itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', section.getString("Name")));
List<String> loreLines = new ArrayList<>(); List<String> loreLines = new ArrayList<>();
@@ -134,7 +134,7 @@ public class MissionGUI implements FactionGUI {
if (plugin.getConfig().getBoolean("Randomization.Enabled")) { if (plugin.getConfig().getBoolean("Randomization.Enabled")) {
ItemStack start; ItemStack start;
ItemMeta meta; ItemMeta meta;
start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Allowed.Material")).parseItem(); start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Allowed.Material")).get().parseItem();
meta = start.getItemMeta(); meta = start.getItemMeta();
meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Allowed.Name"))); meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Allowed.Name")));
List<String> loree = new ArrayList<>(); List<String> loree = new ArrayList<>();
@@ -144,7 +144,7 @@ public class MissionGUI implements FactionGUI {
meta.setLore(loree); meta.setLore(loree);
start.setItemMeta(meta); start.setItemMeta(meta);
if (fPlayer.getFaction().getCompletedMissions().size() >= configurationSection.getKeys(false).size() - 1 && plugin.getConfig().getBoolean("DenyMissionsMoreThenOnce")) { if (fPlayer.getFaction().getCompletedMissions().size() >= configurationSection.getKeys(false).size() - 1 && plugin.getConfig().getBoolean("DenyMissionsMoreThenOnce")) {
start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Material")).parseItem(); start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Material")).get().parseItem();
meta = start.getItemMeta(); meta = start.getItemMeta();
meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Name"))); meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Name")));
List<String> lore = new ArrayList<>(); List<String> lore = new ArrayList<>();
@@ -155,7 +155,7 @@ public class MissionGUI implements FactionGUI {
start.setItemMeta(meta); start.setItemMeta(meta);
} }
if (fPlayer.getFaction().getMissions().size() >= plugin.getConfig().getInt("MaximumMissionsAllowedAtOnce")) { if (fPlayer.getFaction().getMissions().size() >= plugin.getConfig().getInt("MaximumMissionsAllowedAtOnce")) {
start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Material")).parseItem(); start = XMaterial.matchXMaterial(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Material")).get().parseItem();
meta = start.getItemMeta(); meta = start.getItemMeta();
meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Name"))); meta.setDisplayName(plugin.color(plugin.getConfig().getString("Randomization.Start-Item.Disallowed.Name")));
List<String> lore = new ArrayList<>(); List<String> lore = new ArrayList<>();

View File

@@ -47,7 +47,7 @@ public class ShopGUIFrame {
for (int a = 1; a <= items; a++) { for (int a = 1; a <= items; a++) {
String s = a + ""; String s = a + "";
int slot = ShopConfig.getShop().getInt("items." + s + ".slot"); int slot = ShopConfig.getShop().getInt("items." + s + ".slot");
Material material = XMaterial.matchXMaterial(ShopConfig.getShop().getString("items." + s + ".block")).parseMaterial(); Material material = XMaterial.matchXMaterial(ShopConfig.getShop().getString("items." + s + ".block")).get().parseMaterial();
int cost = ShopConfig.getShop().getInt("items." + s + ".cost"); int cost = ShopConfig.getShop().getInt("items." + s + ".cost");
String name = ShopConfig.getShop().getString("items." + s + ".name"); String name = ShopConfig.getShop().getString("items." + s + ".name");
boolean glowing = ShopConfig.getShop().getBoolean("items." + s + ".glowing"); boolean glowing = ShopConfig.getShop().getBoolean("items." + s + ".glowing");
@@ -93,7 +93,7 @@ public class ShopGUIFrame {
private ItemStack buildDummyItem(Faction f) { private ItemStack buildDummyItem(Faction f) {
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("F-Shop.GUI.dummy-item"); ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("F-Shop.GUI.dummy-item");
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem(); ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
if (meta != null) { if (meta != null) {
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore"))); meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));

View File

@@ -210,7 +210,7 @@ public enum Relation implements Permissable {
String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", "")); String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", ""));
List<String> lore = new ArrayList<>(); List<String> lore = new ArrayList<>();
Material material = XMaterial.matchXMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase())).parseMaterial(); Material material = XMaterial.matchXMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase())).get().parseMaterial();
if (material == null) { if (material == null) {
return null; return null;
} }

View File

@@ -128,7 +128,7 @@ public enum Role implements Permissable {
String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", "")); String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", ""));
List<String> lore = new ArrayList<>(); List<String> lore = new ArrayList<>();
Material material = XMaterial.matchXMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase(), "STAINED_CLAY")).parseMaterial(); Material material = XMaterial.matchXMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase(), "STAINED_CLAY")).get().parseMaterial();
if (material == null) { if (material == null) {
return null; return null;
} }

View File

@@ -72,7 +72,7 @@ public class FactionWarpsFrame {
private ItemStack buildWarpAsset(final Map.Entry<String, LazyLocation> warp, final Faction faction) { private ItemStack buildWarpAsset(final Map.Entry<String, LazyLocation> warp, final Faction faction) {
final ConfigurationSection config = this.section.getConfigurationSection("warp-item"); final ConfigurationSection config = this.section.getConfigurationSection("warp-item");
final ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem(); final ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
final ItemMeta meta = item.getItemMeta(); final ItemMeta meta = item.getItemMeta();
meta.setLore(FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().replacePlaceholders(config.getStringList("Lore"), new Placeholder("{warp-protected}", faction.hasWarpPassword(warp.getKey()) ? "Enabled" : "Disabled"), new Placeholder("{warp-cost}", FactionsPlugin.getInstance().getConfig().getBoolean("warp-cost.enabled", false) ? Integer.toString(FactionsPlugin.getInstance().getConfig().getInt("warp-cost.warp", 5)) : "Disabled")))); meta.setLore(FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().replacePlaceholders(config.getStringList("Lore"), new Placeholder("{warp-protected}", faction.hasWarpPassword(warp.getKey()) ? "Enabled" : "Disabled"), new Placeholder("{warp-cost}", FactionsPlugin.getInstance().getConfig().getBoolean("warp-cost.enabled", false) ? Integer.toString(FactionsPlugin.getInstance().getConfig().getInt("warp-cost.warp", 5)) : "Disabled"))));
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name").replace("{warp}", warp.getKey()))); meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name").replace("{warp}", warp.getKey())));
@@ -82,7 +82,7 @@ public class FactionWarpsFrame {
private ItemStack buildDummyItem() { private ItemStack buildDummyItem() {
final ConfigurationSection config = this.section.getConfigurationSection("dummy-item"); final ConfigurationSection config = this.section.getConfigurationSection("dummy-item");
final ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem(); final ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
final ItemMeta meta = item.getItemMeta(); final ItemMeta meta = item.getItemMeta();
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore"))); meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name"))); meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));

View File

@@ -0,0 +1,108 @@
package com.massivecraft.factions.util;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Factions - Developed by Driftay.
* All rights reserved 2020.
* Creation Date: 1/30/2020
*/
public class TimeUtil {
public static long parseDateDiff(String time, boolean future) throws Exception {
Pattern timePattern = Pattern.compile("(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)?", 2);
Matcher m = timePattern.matcher(time);
int years = 0;
int months = 0;
int weeks = 0;
int days = 0;
int hours = 0;
int minutes = 0;
int seconds = 0;
boolean found = false;
while (m.find()) {
if (m.group() != null) {
if (m.group().isEmpty()) continue;
for (int i = 0; i < m.groupCount(); ++i) {
if (m.group(i) != null && !m.group(i).isEmpty()) {
found = true;
break;
}
}
if (!found) continue;
if (m.group(1) != null && !m.group(1).isEmpty()) years = Integer.parseInt(m.group(1));
if (m.group(2) != null && !m.group(2).isEmpty()) months = Integer.parseInt(m.group(2));
if (m.group(3) != null && !m.group(3).isEmpty()) weeks = Integer.parseInt(m.group(3));
if (m.group(4) != null && !m.group(4).isEmpty()) days = Integer.parseInt(m.group(4));
if (m.group(5) != null && !m.group(5).isEmpty()) hours = Integer.parseInt(m.group(5));
if (m.group(6) != null && !m.group(6).isEmpty()) minutes = Integer.parseInt(m.group(6));
if (m.group(7) != null && !m.group(7).isEmpty()) {
seconds = Integer.parseInt(m.group(7));
break;
}
break;
}
}
if (!found) throw new Exception("Illegal Date");
if (years > 20) throw new Exception("Illegal Date");
Calendar c = new GregorianCalendar();
if (years > 0) c.add(Calendar.YEAR, years * (future ? 1 : -1));
if (months > 0) c.add(Calendar.MONTH, months * (future ? 1 : -1));
if (weeks > 0) c.add(Calendar.WEEK_OF_YEAR, weeks * (future ? 1 : -1));
if (days > 0) c.add(Calendar.DATE, days * (future ? 1 : -1));
if (hours > 0) c.add(Calendar.HOUR_OF_DAY, hours * (future ? 1 : -1));
if (minutes > 0) c.add(Calendar.MINUTE, minutes * (future ? 1 : -1));
if (seconds > 0) c.add(Calendar.SECOND, seconds * (future ? 1 : -1));
System.out.println("current: " + c.getTimeInMillis() + " Time: " + System.currentTimeMillis() + " Form: " + formatTime(c.getTimeInMillis() / 1000L));
return c.getTimeInMillis() / 1000L;
}
public static String formatDifference(long time) {
if (time == 0L) return "Never";
long day = TimeUnit.SECONDS.toDays(time);
long hours = TimeUnit.SECONDS.toHours(time) - day * 24L;
long minutes = TimeUnit.SECONDS.toMinutes(time) - TimeUnit.SECONDS.toHours(time) * 60L;
long seconds = TimeUnit.SECONDS.toSeconds(time) - TimeUnit.SECONDS.toMinutes(time) * 60L;
StringBuilder sb = new StringBuilder();
if (day > 0L) sb.append(day).append((day == 1L) ? "day" : "days").append(" ");
if (hours > 0L) sb.append(hours).append((hours == 1L) ? "h" : "h").append(" ");
if (minutes > 0L) sb.append(minutes).append((minutes == 1L) ? "m" : "m").append(" ");
if (seconds > 0L) sb.append(seconds).append((seconds == 1L) ? "s" : "s");
String diff = sb.toString().trim();
return diff.isEmpty() ? "Now" : diff;
}
public static String formatTime(long time) {
if (time == System.currentTimeMillis()) return "Now";
if (time == -1L) return "Never";
return formatDifference(time - System.currentTimeMillis() / 1000L);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -61,7 +61,7 @@ public class FDisbandFrame {
private ItemStack buildConfirmDummyItem(Faction faction) { private ItemStack buildConfirmDummyItem(Faction faction) {
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("f-disband-gui.confirm-item"); ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("f-disband-gui.confirm-item");
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem(); ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
if (meta != null) { if (meta != null) {
List<String> lore = new ArrayList<>(); List<String> lore = new ArrayList<>();
@@ -77,7 +77,7 @@ public class FDisbandFrame {
private ItemStack buildDenyDummyItem() { private ItemStack buildDenyDummyItem() {
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("f-disband-gui.deny-item"); ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("f-disband-gui.deny-item");
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem(); ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
if (meta != null) { if (meta != null) {
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore"))); meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));

View File

@@ -104,7 +104,7 @@ public enum PermissableAction {
public ItemStack buildAsset(FPlayer fme, Permissable perm) { public ItemStack buildAsset(FPlayer fme, Permissable perm) {
ConfigurationSection section = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.action"); ConfigurationSection section = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.action");
ItemStack item = XMaterial.matchXMaterial(section.getString("Materials." + this.name)).parseItem(); ItemStack item = XMaterial.matchXMaterial(section.getString("Materials." + this.name)).get().parseItem();
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
meta.setDisplayName(FactionsPlugin.getInstance().color(section.getString("placeholder-item.name").replace("{action}", this.name))); meta.setDisplayName(FactionsPlugin.getInstance().color(section.getString("placeholder-item.name").replace("{action}", this.name)));

View File

@@ -91,7 +91,7 @@ public class PermissableActionFrame {
private ItemStack buildDummyItem() { private ItemStack buildDummyItem() {
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.dummy-item"); ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.dummy-item");
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem(); ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore"))); meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name"))); meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
@@ -101,7 +101,7 @@ public class PermissableActionFrame {
private ItemStack buildBackItem() { private ItemStack buildBackItem() {
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.back-item"); ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.back-item");
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem(); ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore"))); meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name"))); meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));

View File

@@ -56,7 +56,7 @@ public class PermissableRelationFrame {
} }
private ItemStack buildAsset(String loc, String relation) { private ItemStack buildAsset(String loc, String relation) {
ItemStack item = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString(loc)).parseItem(); ItemStack item = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString(loc)).get().parseItem();
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
meta.setDisplayName(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fperm-gui.relation.Placeholder-Item.Name").replace("{relation}", relation))); meta.setDisplayName(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fperm-gui.relation.Placeholder-Item.Name").replace("{relation}", relation)));
item.setItemMeta(meta); item.setItemMeta(meta);
@@ -65,7 +65,7 @@ public class PermissableRelationFrame {
private ItemStack buildDummyItem() { private ItemStack buildDummyItem() {
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.dummy-item"); ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.dummy-item");
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem(); ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore"))); meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name"))); meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));

View File

@@ -25,7 +25,7 @@ public class FUpgradeFrame {
public FUpgradeFrame(Faction f) { public FUpgradeFrame(Faction f) {
this.gui = new Gui(FactionsPlugin.getInstance(), this.gui = new Gui(FactionsPlugin.getInstance(),
FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.rows", 5), FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Rows", 5),
FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Title").replace("{faction}", f.getTag())); FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Title").replace("{faction}", f.getTag()));
} }
@@ -95,13 +95,13 @@ public class FUpgradeFrame {
private void updateFactionPowerBoost(Faction f) { private void updateFactionPowerBoost(Faction f) {
double boost = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.Power.Power-Boost.level-" + (f.getUpgrade(UpgradeType.POWER) + 1)); double boost = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.Power.Power-Boost.level-" + (f.getUpgrade(UpgradeType.POWER) + 1));
if (boost < 0.0) return; if (boost < 0.0) return;
f.setPowerBoost(f.getPower() + boost); f.setPowerBoost(boost);
} }
private ItemStack buildDummyItem() { private ItemStack buildDummyItem() {
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fupgrades.MainMenu.DummyItem"); ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fupgrades.MainMenu.DummyItem");
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem(); ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
if (meta != null) { if (meta != null) {
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore"))); meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));

View File

@@ -58,7 +58,7 @@ public enum UpgradeType {
public ItemStack buildAsset(Faction f) { public ItemStack buildAsset(Faction f) {
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fupgrades.MainMenu." + this.id + ".DisplayItem"); ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fupgrades.MainMenu." + this.id + ".DisplayItem");
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).parseItem(); ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
int level = f.getUpgrade(this); int level = f.getUpgrade(this);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
if (meta != null) { if (meta != null) {

View File

@@ -2,7 +2,7 @@ name: Factions
version: ${project.version} version: ${project.version}
api-version: 1.13 api-version: 1.13
main: com.massivecraft.factions.FactionsPlugin main: com.massivecraft.factions.FactionsPlugin
authors: [Olof Larsson, Brett Flannigan, drtshock, ProSavage, SvenjaReißaus, FroggyKnight, Driftay] authors: [Olof Larsson, Brett Flannigan, drtshock, ProSavage, SvenjaReißaus, Driftay]
softdepend: [Skript, CoreProtect, PlayerVaults, PlaceholderAPI, MVdWPlaceholderAPI, PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag, dynmap, FactionsTop] softdepend: [Skript, CoreProtect, PlayerVaults, PlaceholderAPI, MVdWPlaceholderAPI, PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag, dynmap, FactionsTop]
commands: commands: