MyEssentials / MyTown2

Version 2 of MyTown - A Minecraft Server Protection Mod
The Unlicense
35 stars 22 forks source link

[Request] New Town Flag or Global Config Flag: Allow Ops to Bypass #238

Closed djrecipe closed 9 years ago

djrecipe commented 9 years ago

Hello again.

Currently I am trying to use your mod on my server, but I want to force ops to be restricted by MyTown2 just like everyone else. Whether or not my ops are able to somehow circumvent a town's permissions simply by changing them (they would never do that) - I need a way to force them to obey all town restrictions set by other players, for the sake of roleplaying/gameplay.

I can think of two solutions for this issue: a) Easy: a global flag in the MyTown.cfg file b) Harder: a per-town permission flag that is only settable by an op (via /ta commandset probably)

djrecipe commented 9 years ago

See: https://github.com/MyEssentials/MyTown2/blob/master/src/main/java/mytown/entities/Town.java

public boolean checkPermission(Resident res, FlagType flagType, Object denialValue, int dim, int x, int y, int z) {
        Plot plot = getPlotAtCoords(dim, x, y, z);
        if (plot == null || flagType.isTownOnly()) {
            if(getValue(flagType).equals(denialValue) && !hasResident(res) && (!residentHasFriendInTown(res) || ((Boolean) getValue(FlagType.RESTRICTIONS) && !(getMayor() == res)))) {
                return PlayerUtils.isOp(res.getPlayer());
            }
        } else {
            if (plot.getValue(flagType).equals(denialValue) && !plot.hasResident(res) && !plot.residentHasFriendInPlot(res))
                return PlayerUtils.isOp(res.getPlayer());
        }
        return true;
    }
MuresanSergiu commented 9 years ago

I was thinking of simply adding it as a config option. I can even have it set as a permission string, but that might be a little more difficult.

MuresanSergiu commented 9 years ago

Added in MyPermissions through the bypass perms.