Merge remote-tracking branch 'origin/1.6.x' into 1.6.x
This commit is contained in:
commit
dfbfbf9981
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -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]
|
||||||
|
2
pom.xml
2
pom.xml
@ -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>
|
||||||
|
@ -52,6 +52,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.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.OpenOption;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
@ -430,6 +431,18 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
try {
|
||||||
|
String path = Paths.get(getDataFolder().getAbsolutePath()).toAbsolutePath().toString() + File.separator + "reserves.json";
|
||||||
|
File file = new File(path);
|
||||||
|
if (!file.exists()) {
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
file.createNewFile();
|
||||||
|
}
|
||||||
|
Files.write(Paths.get(file.getPath()),getGsonBuilder().create().toJson(reserveObjects).getBytes());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
// only save data if plugin actually completely loaded successfully
|
// only save data if plugin actually completely loaded successfully
|
||||||
if (this.loadSuccessful) Conf.saveSync();
|
if (this.loadSuccessful) Conf.saveSync();
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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);
|
||||||
|
@ -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");
|
||||||
|
@ -162,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) {
|
||||||
@ -494,12 +496,24 @@ 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) {
|
|
||||||
|
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());
|
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());
|
||||||
|
@ -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:
|
||||||
@ -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);
|
||||||
@ -1060,13 +1071,13 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
FPlayer fp = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
FPlayer fp = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
||||||
|
|
||||||
if(fp == null) return;
|
if (fp == null) return;
|
||||||
|
|
||||||
if (fp.getChatMode() != ChatMode.FACTION) {
|
if (fp.getChatMode() != ChatMode.FACTION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Faction f = fp.getFaction();
|
Faction f = fp.getFaction();
|
||||||
if(f == null) return;
|
if (f == null) return;
|
||||||
if (f.isSystemFaction()) {
|
if (f.isSystemFaction()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1085,7 +1096,7 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Member m : t.getMembers()) {
|
for (Member m : t.getMembers()) {
|
||||||
if (m.getEffectiveName().contains(target) | m.getUser().getName().contains(target)){
|
if (m.getEffectiveName().contains(target) | m.getUser().getName().contains(target)) {
|
||||||
targets.add("@" + m.getUser().getName() + "#" + m.getUser().getDiscriminator());
|
targets.add("@" + m.getUser().getName() + "#" + m.getUser().getDiscriminator());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
108
src/main/java/com/massivecraft/factions/util/TimeUtil.java
Normal file
108
src/main/java/com/massivecraft/factions/util/TimeUtil.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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,7 +95,7 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user