Semi-rename home/warp MPerms
So the names for MPerms have been renamed, but their id's have not
This commit is contained in:
parent
19de471de0
commit
442e90759d
@ -46,7 +46,7 @@ public class CmdFactionsWarpAdd extends FactionsCommandWarp
|
|||||||
Warp warp = new Warp(name, ps);
|
Warp warp = new Warp(name, ps);
|
||||||
|
|
||||||
// MPerm
|
// MPerm
|
||||||
if ( ! MPerm.getPermSethome().has(msender, faction, true)) return;
|
if ( ! MPerm.getPermSetwarp().has(msender, faction, true)) return;
|
||||||
|
|
||||||
if (faction.getWarps().getAll().stream().map(Warp::getName).anyMatch(s -> s.equalsIgnoreCase(name)))
|
if (faction.getWarps().getAll().stream().map(Warp::getName).anyMatch(s -> s.equalsIgnoreCase(name)))
|
||||||
{
|
{
|
||||||
|
@ -54,7 +54,7 @@ public class CmdFactionsWarpGo extends FactionsCommandWarp
|
|||||||
String warpDesc = Txt.parse("<h>%s <i>in <reset>%s<i>.", warp.getName(), faction.describeTo(msender, false));
|
String warpDesc = Txt.parse("<h>%s <i>in <reset>%s<i>.", warp.getName(), faction.describeTo(msender, false));
|
||||||
|
|
||||||
// Any and MPerm
|
// Any and MPerm
|
||||||
if ( ! MPerm.getPermHome().has(msender, faction, true)) return;
|
if ( ! MPerm.getPermWarp().has(msender, faction, true)) return;
|
||||||
|
|
||||||
if ( ! MConf.get().warpsTeleportAllowedFromEnemyTerritory && msender.isInEnemyTerritory())
|
if ( ! MConf.get().warpsTeleportAllowedFromEnemyTerritory && msender.isInEnemyTerritory())
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ public class CmdFactionsWarpList extends FactionsCommandWarp
|
|||||||
int idx = this.readArg();
|
int idx = this.readArg();
|
||||||
|
|
||||||
// Any and MPerm
|
// Any and MPerm
|
||||||
if ( ! MPerm.getPermHome().has(msender, faction, true)) return;
|
if ( ! MPerm.getPermWarp().has(msender, faction, true)) return;
|
||||||
|
|
||||||
Pager<Warp> pager = new Pager<>(this, "Warps for " + faction.getName(), idx, faction.getWarps().getAll());
|
Pager<Warp> pager = new Pager<>(this, "Warps for " + faction.getName(), idx, faction.getWarps().getAll());
|
||||||
pager.setMsonifier((Stringifier<Warp>) (warp, i) ->
|
pager.setMsonifier((Stringifier<Warp>) (warp, i) ->
|
||||||
|
@ -33,7 +33,7 @@ public class CmdFactionsWarpRemove extends FactionsCommandWarp
|
|||||||
Warp warp = TypeWarp.get(faction).read(this.argAt(0), sender);
|
Warp warp = TypeWarp.get(faction).read(this.argAt(0), sender);
|
||||||
|
|
||||||
// Any and MPerm
|
// Any and MPerm
|
||||||
if ( ! MPerm.getPermSethome().has(msender, faction, true)) return;
|
if ( ! MPerm.getPermSetwarp().has(msender, faction, true)) return;
|
||||||
|
|
||||||
// Event
|
// Event
|
||||||
EventFactionsWarpRemove event = new EventFactionsWarpRemove(sender, faction, warp);
|
EventFactionsWarpRemove event = new EventFactionsWarpRemove(sender, faction, warp);
|
||||||
|
@ -46,8 +46,8 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable, N
|
|||||||
public final static transient String ID_KICK = "kick";
|
public final static transient String ID_KICK = "kick";
|
||||||
public final static transient String ID_RANK = "rank";
|
public final static transient String ID_RANK = "rank";
|
||||||
public final static transient String ID_TITLE = "title";
|
public final static transient String ID_TITLE = "title";
|
||||||
public final static transient String ID_HOME = "home";
|
public final static transient String ID_WARP = "home";
|
||||||
public final static transient String ID_SETHOME = "sethome";
|
public final static transient String ID_SETWARP = "sethome";
|
||||||
public final static transient String ID_DEPOSIT = "deposit";
|
public final static transient String ID_DEPOSIT = "deposit";
|
||||||
public final static transient String ID_WITHDRAW = "withdraw";
|
public final static transient String ID_WITHDRAW = "withdraw";
|
||||||
public final static transient String ID_TERRITORY = "territory";
|
public final static transient String ID_TERRITORY = "territory";
|
||||||
@ -72,8 +72,8 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable, N
|
|||||||
public final static transient int PRIORITY_KICK = 11000;
|
public final static transient int PRIORITY_KICK = 11000;
|
||||||
public final static transient int PRIORITY_RANK = 11500;
|
public final static transient int PRIORITY_RANK = 11500;
|
||||||
public final static transient int PRIORITY_TITLE = 12000;
|
public final static transient int PRIORITY_TITLE = 12000;
|
||||||
public final static transient int PRIORITY_HOME = 13000;
|
public final static transient int PRIORITY_WARP = 13000;
|
||||||
public final static transient int PRIORITY_SETHOME = 14000;
|
public final static transient int PRIORITY_SETWARP = 14000;
|
||||||
public final static transient int PRIORITY_DEPOSIT = 15000;
|
public final static transient int PRIORITY_DEPOSIT = 15000;
|
||||||
public final static transient int PRIORITY_WITHDRAW = 16000;
|
public final static transient int PRIORITY_WITHDRAW = 16000;
|
||||||
public final static transient int PRIORITY_TERRITORY = 17000;
|
public final static transient int PRIORITY_TERRITORY = 17000;
|
||||||
@ -122,8 +122,8 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable, N
|
|||||||
getPermKick();
|
getPermKick();
|
||||||
getPermRank();
|
getPermRank();
|
||||||
getPermTitle();
|
getPermTitle();
|
||||||
getPermHome();
|
getPermWarp();
|
||||||
getPermSethome();
|
getPermSetwarp();
|
||||||
getPermDeposit();
|
getPermDeposit();
|
||||||
getPermWithdraw();
|
getPermWithdraw();
|
||||||
getPermTerritory();
|
getPermTerritory();
|
||||||
@ -149,8 +149,8 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable, N
|
|||||||
public static MPerm getPermKick() { return getCreative(PRIORITY_KICK, ID_KICK, ID_KICK, "kick members", MUtil.set("LEADER", "OFFICER"), false, true, true); }
|
public static MPerm getPermKick() { return getCreative(PRIORITY_KICK, ID_KICK, ID_KICK, "kick members", MUtil.set("LEADER", "OFFICER"), false, true, true); }
|
||||||
public static MPerm getPermRank() { return getCreative(PRIORITY_RANK, ID_RANK, ID_RANK, "change ranks", MUtil.set("LEADER", "OFFICER"), false, true, true); }
|
public static MPerm getPermRank() { return getCreative(PRIORITY_RANK, ID_RANK, ID_RANK, "change ranks", MUtil.set("LEADER", "OFFICER"), false, true, true); }
|
||||||
public static MPerm getPermTitle() { return getCreative(PRIORITY_TITLE, ID_TITLE, ID_TITLE, "set titles", MUtil.set("LEADER", "OFFICER"), false, true, true); }
|
public static MPerm getPermTitle() { return getCreative(PRIORITY_TITLE, ID_TITLE, ID_TITLE, "set titles", MUtil.set("LEADER", "OFFICER"), false, true, true); }
|
||||||
public static MPerm getPermHome() { return getCreative(PRIORITY_HOME, ID_HOME, ID_HOME, "teleport home", MUtil.set("LEADER", "OFFICER", "MEMBER", "RECRUIT", "ALLY"), false, true, true); }
|
public static MPerm getPermWarp() { return getCreative(PRIORITY_WARP, ID_WARP, "warp", "teleport to warp", MUtil.set("LEADER", "OFFICER", "MEMBER", "RECRUIT", "ALLY"), false, true, true); }
|
||||||
public static MPerm getPermSethome() { return getCreative(PRIORITY_SETHOME, ID_SETHOME, ID_SETHOME, "set the home", MUtil.set("LEADER", "OFFICER"), false, true, true); }
|
public static MPerm getPermSetwarp() { return getCreative(PRIORITY_SETWARP, ID_SETWARP, "setwarp", "set warps", MUtil.set("LEADER", "OFFICER"), false, true, true); }
|
||||||
public static MPerm getPermDeposit() { return getCreative(PRIORITY_DEPOSIT, ID_DEPOSIT, ID_DEPOSIT, "deposit money", MUtil.set("LEADER", "OFFICER", "MEMBER", "RECRUIT", "ALLY", "TRUCE", "NEUTRAL", "ENEMY"), false, false, false); } // non editable, non visible.
|
public static MPerm getPermDeposit() { return getCreative(PRIORITY_DEPOSIT, ID_DEPOSIT, ID_DEPOSIT, "deposit money", MUtil.set("LEADER", "OFFICER", "MEMBER", "RECRUIT", "ALLY", "TRUCE", "NEUTRAL", "ENEMY"), false, false, false); } // non editable, non visible.
|
||||||
public static MPerm getPermWithdraw() { return getCreative(PRIORITY_WITHDRAW, ID_WITHDRAW, ID_WITHDRAW, "withdraw money", MUtil.set("LEADER"), false, true, true); }
|
public static MPerm getPermWithdraw() { return getCreative(PRIORITY_WITHDRAW, ID_WITHDRAW, ID_WITHDRAW, "withdraw money", MUtil.set("LEADER"), false, true, true); }
|
||||||
public static MPerm getPermTerritory() { return getCreative(PRIORITY_TERRITORY, ID_TERRITORY, ID_TERRITORY, "claim or unclaim", MUtil.set("LEADER", "OFFICER"), false, true, true); }
|
public static MPerm getPermTerritory() { return getCreative(PRIORITY_TERRITORY, ID_TERRITORY, ID_TERRITORY, "claim or unclaim", MUtil.set("LEADER", "OFFICER"), false, true, true); }
|
||||||
@ -203,6 +203,12 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable, N
|
|||||||
private transient boolean registered = false;
|
private transient boolean registered = false;
|
||||||
public boolean isRegistered() { return this.registered; }
|
public boolean isRegistered() { return this.registered; }
|
||||||
public void setRegistered(boolean registered) { this.registered = registered; }
|
public void setRegistered(boolean registered) { this.registered = registered; }
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// VERSION
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public int version = 1;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// FIELDS
|
// FIELDS
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.massivecraft.factions.entity.migrator;
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.massivecraft.factions.entity.MPerm;
|
||||||
|
import com.massivecraft.massivecore.store.migrator.MigratorRoot;
|
||||||
|
|
||||||
|
public class MigratorMPerm001Warps extends MigratorRoot
|
||||||
|
{
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// INSTANCE & CONSTRUCT
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
private static MigratorMPerm001Warps i = new MigratorMPerm001Warps();
|
||||||
|
public static MigratorMPerm001Warps get() { return i; }
|
||||||
|
private MigratorMPerm001Warps()
|
||||||
|
{
|
||||||
|
super(MPerm.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// OVERRIDE
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void migrateInner(JsonObject entity)
|
||||||
|
{
|
||||||
|
JsonElement jsonName = entity.get("name");
|
||||||
|
String name = jsonName.getAsString();
|
||||||
|
if (name.equalsIgnoreCase("home")) name = "warp";
|
||||||
|
if (name.equalsIgnoreCase("sethome")) name = "setwarp";
|
||||||
|
|
||||||
|
entity.addProperty("name", name);
|
||||||
|
|
||||||
|
JsonElement jsonDesc = entity.get("desc");
|
||||||
|
String desc = jsonDesc.getAsString();
|
||||||
|
if (desc.equalsIgnoreCase("teleport home")) desc = "teleport to warp";
|
||||||
|
if (desc.equalsIgnoreCase("set the home")) desc = "set warps";
|
||||||
|
|
||||||
|
entity.addProperty("desc", desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user