Fixing one permission check bug and adding some debug output in hope to find that bug.
This commit is contained in:
parent
709c1fe80d
commit
cf03bd5b8a
@ -145,8 +145,8 @@ public enum FPerm
|
|||||||
{
|
{
|
||||||
if (uplayer.isUsingAdminMode()) return true;
|
if (uplayer.isUsingAdminMode()) return true;
|
||||||
|
|
||||||
Faction faction = uplayer.getFaction();
|
Rel rel = uplayer.getRelationTo(hostFaction);
|
||||||
if (this.has(faction, hostFaction)) return true;
|
if (hostFaction.getPermittedRelations(this).contains(rel)) return true;
|
||||||
|
|
||||||
if (verboose) uplayer.sendMessage(this.createDeniedMessage(uplayer, hostFaction));
|
if (verboose) uplayer.sendMessage(this.createDeniedMessage(uplayer, hostFaction));
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ public class CmdFactionsPerm extends FCommand
|
|||||||
|
|
||||||
FPerm perm = this.arg(1, ARFPerm.get());
|
FPerm perm = this.arg(1, ARFPerm.get());
|
||||||
if (perm == null) return;
|
if (perm == null) return;
|
||||||
|
System.out.println("perm = "+perm);
|
||||||
|
|
||||||
if ( ! this.argIsSet(2))
|
if ( ! this.argIsSet(2))
|
||||||
{
|
{
|
||||||
@ -72,6 +73,7 @@ public class CmdFactionsPerm extends FCommand
|
|||||||
if (val == null) return;
|
if (val == null) return;
|
||||||
|
|
||||||
// Do the change
|
// Do the change
|
||||||
|
System.out.println("setRelationPermitted perm "+perm+", rel "+rel+", val "+val);
|
||||||
faction.setRelationPermitted(perm, rel, val);
|
faction.setRelationPermitted(perm, rel, val);
|
||||||
|
|
||||||
// The following is to make sure the leader always has the right to change perms if that is our goal.
|
// The following is to make sure the leader always has the right to change perms if that is our goal.
|
||||||
|
@ -22,6 +22,7 @@ import com.massivecraft.mcore.ps.PS;
|
|||||||
import com.massivecraft.mcore.store.Entity;
|
import com.massivecraft.mcore.store.Entity;
|
||||||
import com.massivecraft.mcore.util.MUtil;
|
import com.massivecraft.mcore.util.MUtil;
|
||||||
import com.massivecraft.mcore.util.SenderUtil;
|
import com.massivecraft.mcore.util.SenderUtil;
|
||||||
|
import com.massivecraft.mcore.xlib.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
|
||||||
public class Faction extends Entity<Faction> implements EconomyParticipator
|
public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||||
@ -660,6 +661,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("setPerms target:");
|
||||||
|
System.out.println(Factions.get().gson.toJson(target, new TypeToken<Map<FPerm, Set<Rel>>>(){}.getType()));
|
||||||
|
|
||||||
// Detect Nochange
|
// Detect Nochange
|
||||||
if (MUtil.equals(this.perms, target)) return;
|
if (MUtil.equals(this.perms, target)) return;
|
||||||
|
|
||||||
@ -694,6 +698,10 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
public void setRelationPermitted(FPerm perm, Rel rel, boolean permitted)
|
public void setRelationPermitted(FPerm perm, Rel rel, boolean permitted)
|
||||||
{
|
{
|
||||||
Map<FPerm, Set<Rel>> perms = this.getPerms();
|
Map<FPerm, Set<Rel>> perms = this.getPerms();
|
||||||
|
|
||||||
|
System.out.println("setRelationPermitted before:");
|
||||||
|
System.out.println(Factions.get().gson.toJson(perms, new TypeToken<Map<FPerm, Set<Rel>>>(){}.getType()));
|
||||||
|
|
||||||
Set<Rel> rels = perms.get(perm);
|
Set<Rel> rels = perms.get(perm);
|
||||||
|
|
||||||
if (permitted)
|
if (permitted)
|
||||||
@ -705,6 +713,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
rels.remove(rel);
|
rels.remove(rel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("setRelationPermitted after:");
|
||||||
|
System.out.println(Factions.get().gson.toJson(perms, new TypeToken<Map<FPerm, Set<Rel>>>(){}.getType()));
|
||||||
|
|
||||||
this.setPerms(perms);
|
this.setPerms(perms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user