1.0.23
configurable enemy check radius for fly, option added in conf.json Added a system faction check to neutral Added a enderpearl disable while flying option to conf.json Added my own repository to maven along with coreprotect for shading. --Factions Inspect Added--
This commit is contained in:
@@ -14,6 +14,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@@ -60,48 +61,48 @@ public class CmdFly extends FCommand {
|
||||
public static void startFlyCheck() {
|
||||
flyid = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
public void run() throws ConcurrentModificationException { //threw the exception for now, until I recode fly :( Cringe.
|
||||
checkTaskState();
|
||||
if (flyMap.keySet().size() != 0) {
|
||||
for (String name : flyMap.keySet()) {
|
||||
if (name == null) {
|
||||
continue;
|
||||
}
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
if (!player.isFlying()) {
|
||||
continue;
|
||||
}
|
||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||
for (String name : flyMap.keySet()) {
|
||||
if (name == null) {
|
||||
continue;
|
||||
}
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
if (!player.isFlying()) {
|
||||
continue;
|
||||
}
|
||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||
|
||||
if (fPlayer == null) {
|
||||
continue;
|
||||
}
|
||||
if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) {
|
||||
continue;
|
||||
}
|
||||
Faction myFaction = fPlayer.getFaction();
|
||||
if (myFaction.isWilderness()) {
|
||||
fPlayer.setFlying(false);
|
||||
flyMap.remove(name);
|
||||
continue;
|
||||
}
|
||||
if (fPlayer.checkIfNearbyEnemies()) {
|
||||
continue;
|
||||
}
|
||||
FLocation myFloc = new FLocation(player.getLocation());
|
||||
Faction toFac = Board.getInstance().getFactionAt(myFloc);
|
||||
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
|
||||
if (!checkBypassPerms(fPlayer, player, toFac)) {
|
||||
if (fPlayer == null) {
|
||||
continue;
|
||||
}
|
||||
if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) {
|
||||
continue;
|
||||
}
|
||||
Faction myFaction = fPlayer.getFaction();
|
||||
if (myFaction.isWilderness()) {
|
||||
fPlayer.setFlying(false);
|
||||
flyMap.remove(name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (fPlayer.checkIfNearbyEnemies()) {
|
||||
continue;
|
||||
}
|
||||
FLocation myFloc = new FLocation(player.getLocation());
|
||||
Faction toFac = Board.getInstance().getFactionAt(myFloc);
|
||||
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
|
||||
if (!checkBypassPerms(fPlayer, player, toFac)) {
|
||||
fPlayer.setFlying(false);
|
||||
flyMap.remove(name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
40
src/main/java/com/massivecraft/factions/cmd/CmdInspect.java
Normal file
40
src/main/java/com/massivecraft/factions/cmd/CmdInspect.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdInspect extends FCommand
|
||||
{
|
||||
public CmdInspect(){
|
||||
super();
|
||||
this.aliases.add("inspect");
|
||||
this.aliases.add("ins");
|
||||
|
||||
this.permission = Permission.INSPECT.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeColeader = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void perform(){
|
||||
if (fme.isInspectMode()){
|
||||
fme.setInspectMode(false);
|
||||
msg(TL.COMMAND_INSPECT_DISABLED);
|
||||
} else {
|
||||
fme.setInspectMode(true);
|
||||
msg(TL.COMMAND_INSPECT_ENABLED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_INSPECT_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ public class CmdVersion extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
msg(TL.COMMAND_VERSION_NAME); // Did this so people can differentiate between SavageFactions and FactionsUUID (( Requested Feature ))
|
||||
msg(TL.COMMAND_VERSION_VERSION, P.p.getDescription().getFullName());
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import net.coreprotect.CoreProtect;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -93,6 +94,10 @@ public class FCmdRoot extends FCommand {
|
||||
public CmdBanner cmdBanner = new CmdBanner();
|
||||
public CmdTpBanner cmdTpBanner = new CmdTpBanner();
|
||||
public CmdKillHolograms cmdKillHolograms = new CmdKillHolograms();
|
||||
public CmdInspect cmdInspect = new CmdInspect();
|
||||
|
||||
|
||||
|
||||
public FCmdRoot() {
|
||||
super();
|
||||
this.aliases.addAll(Conf.baseCommandAliases);
|
||||
@@ -197,7 +202,12 @@ public class FCmdRoot extends FCommand {
|
||||
this.addSubCommand(this.cmdTpBanner);
|
||||
this.addSubCommand(this.cmdKillHolograms);
|
||||
|
||||
|
||||
if (CoreProtect.getInstance() != null){
|
||||
P.p.log("Found CoreProtect, enabling Inspect");
|
||||
this.addSubCommand(this.cmdInspect);
|
||||
} else {
|
||||
P.p.log("CoreProtect not found, disabling Inspect");
|
||||
}
|
||||
|
||||
if (P.p.getConfig().getBoolean("enable-faction-flight", false)) {
|
||||
this.addSubCommand(this.cmdFly);
|
||||
|
||||
Reference in New Issue
Block a user