Fix additional rank issues

This commit is contained in:
cnr 2017-09-01 12:19:58 -05:00
parent cad44497bd
commit 81110ea4a3
8 changed files with 10 additions and 36 deletions

View File

@ -739,7 +739,7 @@ public class CoreClientManager extends MiniPlugin
{
_repository.fetchGroups(accountId, (primaryGroup, additionalGroups) ->
{
if (primaryGroup == null)
if (primaryGroup != null)
{
UtilServer.runSync(() -> resultCallback.accept(primaryGroup, additionalGroups));
return;

View File

@ -360,7 +360,7 @@ public class AccountRepository extends MinecraftRepository
}
}
executeUpdate(c, UPDATE_PRIMARY_RANK, () -> {}, new ColumnVarChar("rankIdentifier", "player".length(), "player"), new ColumnInt("accountId", accountId));
executeUpdate(c, UPDATE_PRIMARY_RANK, () -> {}, new ColumnVarChar("rankIdentifier", 255, "PLAYER"), new ColumnInt("accountId", accountId));
executeUpdate(c, REMOVE_ADDITIONAL_RANKS, () -> success.set(false), new ColumnInt("accountId", accountId));
}
catch (SQLException e)

View File

@ -11,23 +11,19 @@ import mineplex.core.gadget.types.WinEffectGadget;
*/
public abstract class WinEffectRankBased extends WinEffectGadget
{
public static final String PERMISSION_BASE = "mineplex.core.gadget.wineffect.ranked.";
private static final String RANK_SCHEMATIC_PREFIX = "WinRank";
private PermissionGroup _rank;
private WinEffectType _winEffectType;
/**
* @param manager The gadget manager
* @param rank The rank needed for the win room
* @param winEffectType The win effect type, used to display in menus
* @param alternativeSalepackageNames
*/
public WinEffectRankBased(GadgetManager manager, String name, String[] lore, Material material, byte data, PermissionGroup rank, WinEffectType winEffectType, String... alternativeSalepackageNames)
public WinEffectRankBased(GadgetManager manager, String name, String[] lore, Material material, byte data, PermissionGroup rank, String... alternativeSalepackageNames)
{
super(manager, name, lore, -1, material, data, true, alternativeSalepackageNames);
_rank = rank;
_winEffectType = winEffectType;
_schematicName = winEffectType.getSchematic().replace("%r%", rank.name().substring(0, 1).toUpperCase() + rank.name().substring(1));
_schematicName = RANK_SCHEMATIC_PREFIX + rank.name();
}
public PermissionGroup getRank()
@ -39,26 +35,4 @@ public abstract class WinEffectRankBased extends WinEffectGadget
{
return _rank;
}
public WinEffectType getWinEffectType()
{
return _winEffectType;
}
public enum WinEffectType
{
RANK_WIN_EFFECT("WinRank%r%");
private String _schematic;
WinEffectType(String schematic)
{
_schematic = schematic;
}
public String getSchematic()
{
return _schematic;
}
}
}

View File

@ -40,7 +40,7 @@ public class WinEffectRankEternal extends WinEffectRankBased
{
super(manager, "Eternal Win Effect",
UtilText.splitLinesToArray(new String[]{C.cGray + "GWEN is ALWAYS watching."}, LineFormat.LORE),
Material.PRISMARINE_SHARD, (byte) 0, PermissionGroup.ETERNAL, WinEffectType.RANK_WIN_EFFECT);
Material.PRISMARINE_SHARD, (byte) 0, PermissionGroup.ETERNAL);
}
@Override

View File

@ -40,7 +40,7 @@ public class WinEffectRankHero extends WinEffectRankBased
{
super(manager, "Hero Win Effect",
UtilText.splitLinesToArray(new String[]{C.cGray + "To become a True Hero you must first defeat the Dragon."}, LineFormat.LORE),
Material.DRAGON_EGG, (byte) 0, PermissionGroup.HERO, WinEffectType.RANK_WIN_EFFECT);
Material.DRAGON_EGG, (byte) 0, PermissionGroup.HERO);
}
@Override

View File

@ -40,7 +40,7 @@ public class WinEffectRankLegend extends WinEffectRankBased
{
super(manager, "Legend Win Effect",
UtilText.splitLinesToArray(new String[]{C.cGray + "Can you weather this Withering Assault?"}, LineFormat.LORE),
Material.SKULL_ITEM, (byte) 1, PermissionGroup.LEGEND, WinEffectType.RANK_WIN_EFFECT);
Material.SKULL_ITEM, (byte) 1, PermissionGroup.LEGEND);
}
@Override

View File

@ -37,7 +37,7 @@ public class WinEffectRankTitan extends WinEffectRankBased
{
super(manager, "Titan Win Effect",
UtilText.splitLinesToArray(new String[]{C.cGray + "Legend has it that the Titans were so powerful they towered over even the gods."}, LineFormat.LORE),
Material.ROTTEN_FLESH, (byte) 0, PermissionGroup.TITAN, WinEffectType.RANK_WIN_EFFECT);
Material.ROTTEN_FLESH, (byte) 0, PermissionGroup.TITAN);
}
@Override

View File

@ -37,7 +37,7 @@ public class WinEffectRankUltra extends WinEffectRankBased
public WinEffectRankUltra(GadgetManager manager)
{
super(manager, "Ultra Win Effect", UtilText.splitLinesToArray(new String[]{C.cGray + "Always check behind you."}, LineFormat.LORE),
Material.SKULL_ITEM, (byte) 4, PermissionGroup.ULTRA, WinEffectType.RANK_WIN_EFFECT);
Material.SKULL_ITEM, (byte) 4, PermissionGroup.ULTRA);
}
@Override