Merge remote-tracking branch 'origin/1.6.x' into 1.6.x
This commit is contained in:
commit
24aaa0ed6f
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.3.6-RC</version>
|
<version>1.6.9.5-2.3.7-RC</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>SaberFactions</name>
|
<name>SaberFactions</name>
|
||||||
|
@ -8,11 +8,9 @@ import com.massivecraft.factions.zcore.util.TL;
|
|||||||
import com.massivecraft.factions.zcore.util.TagReplacer;
|
import com.massivecraft.factions.zcore.util.TagReplacer;
|
||||||
import com.massivecraft.factions.zcore.util.TagUtil;
|
import com.massivecraft.factions.zcore.util.TagUtil;
|
||||||
import mkremins.fanciful.FancyMessage;
|
import mkremins.fanciful.FancyMessage;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class CmdShow extends FCommand {
|
public class CmdShow extends FCommand {
|
||||||
|
|
||||||
@ -85,9 +83,9 @@ public class CmdShow extends FCommand {
|
|||||||
return; // we only show header for non-normal factions
|
return; // we only show header for non-normal factions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<FancyMessage> fancy = new ArrayList<>();
|
||||||
List<String> finalShow = show;
|
List<String> finalShow = show;
|
||||||
Faction finalFaction = faction;
|
Faction finalFaction = faction;
|
||||||
List<FancyMessage> fancy = new ArrayList<>();
|
|
||||||
instance.getServer().getScheduler().runTaskAsynchronously(instance, () -> {
|
instance.getServer().getScheduler().runTaskAsynchronously(instance, () -> {
|
||||||
for (String raw : finalShow) {
|
for (String raw : finalShow) {
|
||||||
String parsed = TagUtil.parsePlain(finalFaction, context.fPlayer, raw); // use relations
|
String parsed = TagUtil.parsePlain(finalFaction, context.fPlayer, raw); // use relations
|
||||||
|
@ -39,9 +39,9 @@ public abstract class FRelationCommand extends FCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
Faction them = context.argAsFaction(0);
|
Faction them = context.argAsFaction(0);
|
||||||
if (them == null) {
|
if (them == null) return;
|
||||||
return;
|
|
||||||
}
|
if(!context.faction.isNormal()) return;
|
||||||
|
|
||||||
if (!them.isNormal()) {
|
if (!them.isNormal()) {
|
||||||
context.msg(TL.COMMAND_RELATIONS_ALLTHENOPE);
|
context.msg(TL.COMMAND_RELATIONS_ALLTHENOPE);
|
||||||
|
@ -11,7 +11,6 @@ import com.massivecraft.factions.util.wait.WaitedTask;
|
|||||||
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.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.massivecraft.factions.event;
|
package com.massivecraft.factions.event;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
@ -10,51 +9,20 @@ import org.bukkit.event.Cancellable;
|
|||||||
*/
|
*/
|
||||||
public class PowerRegenEvent extends FactionPlayerEvent implements Cancellable {
|
public class PowerRegenEvent extends FactionPlayerEvent implements Cancellable {
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Illyria Team
|
|
||||||
*/
|
|
||||||
|
|
||||||
private boolean cancelled = false;
|
private boolean cancelled = false;
|
||||||
private double modified = 0;
|
private double delta;
|
||||||
|
|
||||||
public PowerRegenEvent(Faction f, FPlayer p) {
|
public PowerRegenEvent(Faction f, FPlayer p, double delta) {
|
||||||
super(f, p);
|
super(f, p);
|
||||||
|
this.delta = delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public double getDelta() {
|
||||||
* Get the amount of power this player will regen by default
|
return delta;
|
||||||
*
|
|
||||||
* @return power amount gained as a Double.
|
|
||||||
*/
|
|
||||||
public double getDefaultPowerGained() {
|
|
||||||
return fPlayer.getMillisPassed() * Conf.powerPerMinute / 60000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void setDelta(double delta) {
|
||||||
* Get the amount of custom power this player will gain. Ignored if less than or equal to 0.
|
this.delta = delta;
|
||||||
*
|
|
||||||
* @return Custom power as a double
|
|
||||||
*/
|
|
||||||
public double getCustomPower() {
|
|
||||||
return modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the custom power gain for this event.
|
|
||||||
*
|
|
||||||
* @param gain Amount of power to be added to player.
|
|
||||||
*/
|
|
||||||
public void setCustomPower(Double gain) {
|
|
||||||
modified = gain;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get if we will be using the custom power gain instead of default.
|
|
||||||
*
|
|
||||||
* @return If we will process the event custom returned as a Boolean.
|
|
||||||
*/
|
|
||||||
public boolean usingCustomPower() {
|
|
||||||
return modified > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -259,8 +259,6 @@ public class FactionsEntityListener implements Listener {
|
|||||||
private boolean checkExplosionForBlock(Entity boomer, Block block) {
|
private boolean checkExplosionForBlock(Entity boomer, Block block) {
|
||||||
Faction faction = Board.getInstance().getFactionAt(new FLocation(block.getLocation()));
|
Faction faction = Board.getInstance().getFactionAt(new FLocation(block.getLocation()));
|
||||||
|
|
||||||
if(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining() > 0) return false;
|
|
||||||
|
|
||||||
if (faction.noExplosionsInTerritory() || (faction.isPeaceful() && Conf.peacefulTerritoryDisableBoom))
|
if (faction.noExplosionsInTerritory() || (faction.isPeaceful() && Conf.peacefulTerritoryDisableBoom))
|
||||||
return false;
|
return false;
|
||||||
// faction is peaceful and has explosions set to disabled
|
// faction is peaceful and has explosions set to disabled
|
||||||
|
@ -176,15 +176,13 @@ public abstract class MPlugin extends JavaPlugin {
|
|||||||
this.getServer().getScheduler().cancelTask(saveTask);
|
this.getServer().getScheduler().cancelTask(saveTask);
|
||||||
saveTask = null;
|
saveTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getServer().getScheduler().cancelTasks(this);
|
|
||||||
|
|
||||||
// only save data if plugin actually loaded successfully
|
// only save data if plugin actually loaded successfully
|
||||||
if (loadSuccessful) {
|
if (loadSuccessful) {
|
||||||
Factions.getInstance().forceSave();
|
Factions.getInstance().forceSave();
|
||||||
FPlayers.getInstance().forceSave();
|
FPlayers.getInstance().forceSave();
|
||||||
Board.getInstance().forceSave();
|
Board.getInstance().forceSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
log("Disabled");
|
log("Disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -663,25 +663,34 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
public void updatePower() {
|
public void updatePower() {
|
||||||
if (this.isOffline()) {
|
if (this.isOffline()) {
|
||||||
losePowerFromBeingOffline();
|
losePowerFromBeingOffline();
|
||||||
if (!Conf.powerRegenOffline) return;
|
if (!Conf.powerRegenOffline) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else if (hasFaction() && getFaction().isPowerFrozen()) {
|
} else if (hasFaction() && getFaction().isPowerFrozen()) {
|
||||||
return; // Don't let power regen if faction power is frozen.
|
return; // Don't let power regen if faction power is frozen.
|
||||||
}
|
}
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
this.millisPassed = now - this.lastPowerUpdateTime;
|
long millisPassed = now - this.lastPowerUpdateTime;
|
||||||
this.lastPowerUpdateTime = now;
|
this.lastPowerUpdateTime = now;
|
||||||
|
|
||||||
Player thisPlayer = this.getPlayer();
|
Player thisPlayer = this.getPlayer();
|
||||||
if (thisPlayer != null && thisPlayer.isDead())
|
if (thisPlayer != null && thisPlayer.isDead()) {
|
||||||
return; // don't let dead players regain power until they respawn
|
return; // don't let dead players regain power until they respawn
|
||||||
PowerRegenEvent powerRegenEvent = new PowerRegenEvent(getFaction(), this);
|
}
|
||||||
Bukkit.getScheduler().runTask(FactionsPlugin.getInstance(), () -> Bukkit.getServer().getPluginManager().callEvent(powerRegenEvent));
|
|
||||||
|
|
||||||
if (!powerRegenEvent.isCancelled())
|
double delta = millisPassed * Conf.powerPerMinute / 60000; // millisPerMinute : 60 * 1000
|
||||||
if (!powerRegenEvent.usingCustomPower())
|
if (Bukkit.getPluginManager().getPlugin("FactionsPlugin") != null) {
|
||||||
this.alterPower(millisPassed * Conf.powerPerMinute / 60000); // millisPerMinute : 60 * 1000
|
Bukkit.getScheduler().runTask(FactionsPlugin.getInstance(), () -> {
|
||||||
else this.alterPower(+powerRegenEvent.getCustomPower());
|
PowerRegenEvent powerRegenEvent = new PowerRegenEvent(getFaction(), this, delta);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(powerRegenEvent);
|
||||||
|
if (!powerRegenEvent.isCancelled()) {
|
||||||
|
this.alterPower(powerRegenEvent.getDelta());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.alterPower(delta);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void losePowerFromBeingOffline() {
|
public void losePowerFromBeingOffline() {
|
||||||
|
@ -65,10 +65,14 @@ public class TextUtil {
|
|||||||
text = "";
|
text = "";
|
||||||
}
|
}
|
||||||
ChatColor tempColor = ChatColor.getByChar(chars[i + 1]);
|
ChatColor tempColor = ChatColor.getByChar(chars[i + 1]);
|
||||||
if (tempColor.isColor()) {
|
if (tempColor != null) {
|
||||||
color = tempColor;
|
if (tempColor == ChatColor.RESET) {
|
||||||
} else {
|
color = ChatColor.WHITE;
|
||||||
style = tempColor;
|
} else if (tempColor.isColor()) {
|
||||||
|
color = tempColor;
|
||||||
|
} else {
|
||||||
|
style = tempColor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
i++; // skip color char
|
i++; // skip color char
|
||||||
} else {
|
} else {
|
||||||
|
@ -1448,7 +1448,7 @@ Wild:
|
|||||||
Zones:
|
Zones:
|
||||||
# You may create your own zones here please just follow the original format #
|
# You may create your own zones here please just follow the original format #
|
||||||
Close:
|
Close:
|
||||||
World: World
|
World: world
|
||||||
Range:
|
Range:
|
||||||
MinX: -200
|
MinX: -200
|
||||||
MaxX: 200
|
MaxX: 200
|
||||||
@ -1463,7 +1463,7 @@ Wild:
|
|||||||
Name: '&cLow Range'
|
Name: '&cLow Range'
|
||||||
Slot: 1
|
Slot: 1
|
||||||
Medium:
|
Medium:
|
||||||
World: World
|
World: world
|
||||||
Range:
|
Range:
|
||||||
MinX: -400
|
MinX: -400
|
||||||
MaxX: 400
|
MaxX: 400
|
||||||
@ -1478,7 +1478,7 @@ Wild:
|
|||||||
Name: '&cMedium Range'
|
Name: '&cMedium Range'
|
||||||
Slot: 4
|
Slot: 4
|
||||||
Far:
|
Far:
|
||||||
World: World
|
World: world
|
||||||
Range:
|
Range:
|
||||||
MinX: -800
|
MinX: -800
|
||||||
MaxX: 800
|
MaxX: 800
|
||||||
|
@ -89,8 +89,8 @@ COMMAND:
|
|||||||
INUSE: <b>That tag is already in use.
|
INUSE: <b>That tag is already in use.
|
||||||
TOCREATE: to create a new faction
|
TOCREATE: to create a new faction
|
||||||
FORCREATE: for creating a new faction
|
FORCREATE: for creating a new faction
|
||||||
ERROR: <b>There was an internal error while trying to create your faction. Please try again.
|
ERROR: '<b>There was an internal error while trying to create your faction. Please try again.'
|
||||||
CREATED: %s<i> created a new faction %s
|
CREATED: '%s<i> created a new faction %s'
|
||||||
CREATEDLOG: ' は新しい党派を造りました: '
|
CREATEDLOG: ' は新しい党派を造りました: '
|
||||||
YOUSHOULD: '<i>You should now: %s'
|
YOUSHOULD: '<i>You should now: %s'
|
||||||
DEINVITE:
|
DEINVITE:
|
||||||
|
Loading…
Reference in New Issue
Block a user