Assorted datatype cleanup.

This commit is contained in:
GJ 2012-03-19 12:54:33 -04:00
parent 253d0ea4c8
commit 05d16e7c15
4 changed files with 283 additions and 232 deletions

View File

@ -12,210 +12,281 @@ import com.gmail.nossr50.skills.Mining;
public enum AbilityType
{
BERSERK(LoadProperties.berserkCooldown, mcLocale.getString("Skills.BerserkOn"), mcLocale.getString("Skills.BerserkOff"), "Skills.BerserkPlayer", mcLocale.getString("Skills.YourBerserk"), "Skills.BerserkPlayerOff"),
SUPER_BREAKER(LoadProperties.superBreakerCooldown, mcLocale.getString("Skills.SuperBreakerOn"), mcLocale.getString("Skills.SuperBreakerOff"), "Skills.SuperBreakerPlayer", mcLocale.getString("Skills.YourSuperBreaker"), "Skills.SuperBreakerPlayerOff"),
GIGA_DRILL_BREAKER(LoadProperties.gigaDrillBreakerCooldown, mcLocale.getString("Skills.GigaDrillBreakerOn"), mcLocale.getString("Skills.GigaDrillBreakerOff"), "Skills.GigaDrillBreakerPlayer", mcLocale.getString("Skills.YourGigaDrillBreaker"), "Skills.GigaDrillBreakerPlayerOff"),
GREEN_TERRA(LoadProperties.greenTerraCooldown, mcLocale.getString("Skills.GreenTerraOn"), mcLocale.getString("Skills.GreenTerraOff"), "Skills.GreenTerraPlayer", mcLocale.getString("Skills.YourGreenTerra"), mcLocale.getString("Skills.GreenTerraPlayerOff")),
SKULL_SPLIITER(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SkullSplitterOn"), mcLocale.getString("Skills.SkullSplitterOff"), "Skills.SkullSplitterPlayer", mcLocale.getString("Skills.YourSkullSplitter"), "Skills.SkullSplitterPlayerOff"),
TREE_FELLER(LoadProperties.treeFellerCooldown, mcLocale.getString("Skills.TreeFellerOn"), mcLocale.getString("Skills.TreeFellerOff"), "Skills.TreeFellerPlayer", mcLocale.getString("Skills.YourTreeFeller"), "Skills.TreeFellerPlayerOff"),
SERRATED_STRIKES(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SerratedStrikesOn"), mcLocale.getString("Skills.SerratedStrikesOff"), "Skills.SerratedStrikesPlayer", mcLocale.getString("Skills.YourSerratedStrikes"), "Skills.SerratedStrikesPlayerOff"),
BLAST_MINING(LoadProperties.blastMiningCooldown, null, null, "Skills.BlastMiningPlayer", mcLocale.getString("Skills.YourBlastMining"), null),
LEAF_BLOWER(0, null, null, null, null, null);
BERSERK(LoadProperties.berserkCooldown, mcLocale.getString("Skills.BerserkOn"), mcLocale.getString("Skills.BerserkOff"), "Skills.BerserkPlayer", mcLocale.getString("Skills.YourBerserk"), "Skills.BerserkPlayerOff"),
SUPER_BREAKER(LoadProperties.superBreakerCooldown, mcLocale.getString("Skills.SuperBreakerOn"), mcLocale.getString("Skills.SuperBreakerOff"), "Skills.SuperBreakerPlayer", mcLocale.getString("Skills.YourSuperBreaker"), "Skills.SuperBreakerPlayerOff"),
GIGA_DRILL_BREAKER(LoadProperties.gigaDrillBreakerCooldown, mcLocale.getString("Skills.GigaDrillBreakerOn"), mcLocale.getString("Skills.GigaDrillBreakerOff"), "Skills.GigaDrillBreakerPlayer", mcLocale.getString("Skills.YourGigaDrillBreaker"), "Skills.GigaDrillBreakerPlayerOff"),
GREEN_TERRA(LoadProperties.greenTerraCooldown, mcLocale.getString("Skills.GreenTerraOn"), mcLocale.getString("Skills.GreenTerraOff"), "Skills.GreenTerraPlayer", mcLocale.getString("Skills.YourGreenTerra"), mcLocale.getString("Skills.GreenTerraPlayerOff")),
SKULL_SPLIITER(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SkullSplitterOn"), mcLocale.getString("Skills.SkullSplitterOff"), "Skills.SkullSplitterPlayer", mcLocale.getString("Skills.YourSkullSplitter"), "Skills.SkullSplitterPlayerOff"),
TREE_FELLER(LoadProperties.treeFellerCooldown, mcLocale.getString("Skills.TreeFellerOn"), mcLocale.getString("Skills.TreeFellerOff"), "Skills.TreeFellerPlayer", mcLocale.getString("Skills.YourTreeFeller"), "Skills.TreeFellerPlayerOff"),
SERRATED_STRIKES(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SerratedStrikesOn"), mcLocale.getString("Skills.SerratedStrikesOff"), "Skills.SerratedStrikesPlayer", mcLocale.getString("Skills.YourSerratedStrikes"), "Skills.SerratedStrikesPlayerOff"),
BLAST_MINING(LoadProperties.blastMiningCooldown, null, null, "Skills.BlastMiningPlayer", mcLocale.getString("Skills.YourBlastMining"), null),
LEAF_BLOWER(0, null, null, null, null, null);
private int cooldown;
private String abilityOn;
private String abilityOff;
private String abilityPlayer;
private String abilityRefresh;
private String abilityPlayerOff;
private AbilityType(int cooldown, String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff)
{
this.cooldown = cooldown;
this.abilityOn = abilityOn;
this.abilityOff = abilityOff;
this.abilityPlayer = abilityPlayer;
this.abilityRefresh = abilityRefresh;
this.abilityPlayerOff = abilityPlayerOff;
}
public int getCooldown()
{
return this.cooldown;
}
public String getAbilityOn()
{
return this.abilityOn;
}
public String getAbilityOff()
{
return this.abilityOff;
}
public String getAbilityPlayer(Player player)
{
return mcLocale.getString(this.abilityPlayer, new Object[] {player.getName()});
}
public String getAbilityPlayerOff(Player player)
{
return mcLocale.getString(this.abilityPlayerOff, new Object[] {player.getName()});
}
public String getAbilityRefresh()
{
return this.abilityRefresh;
}
public boolean getMode(PlayerProfile PP)
{
switch(this)
{
case BERSERK:
return PP.getBerserkMode();
case SUPER_BREAKER:
return PP.getSuperBreakerMode();
case GIGA_DRILL_BREAKER:
return PP.getGigaDrillBreakerMode();
case GREEN_TERRA:
return PP.getGreenTerraMode();
case SKULL_SPLIITER:
return PP.getSkullSplitterMode();
case TREE_FELLER:
return PP.getTreeFellerMode();
case SERRATED_STRIKES:
return PP.getSerratedStrikesMode();
}
return false;
}
private int cooldown;
private String abilityOn;
private String abilityOff;
private String abilityPlayer;
private String abilityRefresh;
private String abilityPlayerOff;
public void setMode(PlayerProfile PP, boolean bool)
{
switch(this)
{
case BERSERK:
PP.setBerserkMode(bool);
break;
case SUPER_BREAKER:
PP.setSuperBreakerMode(bool);
break;
case GIGA_DRILL_BREAKER:
PP.setGigaDrillBreakerMode(bool);
break;
case GREEN_TERRA:
PP.setGreenTerraMode(bool);
break;
case SKULL_SPLIITER:
PP.setSkullSplitterMode(bool);
break;
case TREE_FELLER:
PP.setTreeFellerMode(bool);
break;
case SERRATED_STRIKES:
PP.setSerratedStrikesMode(bool);
break;
}
}
public boolean getInformed(PlayerProfile PP)
{
switch(this)
{
case BERSERK:
return PP.getBerserkInformed();
case BLAST_MINING:
return PP.getBlastMiningInformed();
case SUPER_BREAKER:
return PP.getSuperBreakerInformed();
case GIGA_DRILL_BREAKER:
return PP.getGigaDrillBreakerInformed();
case GREEN_TERRA:
return PP.getGreenTerraInformed();
case SKULL_SPLIITER:
return PP.getSkullSplitterInformed();
case TREE_FELLER:
return PP.getTreeFellerInformed();
case SERRATED_STRIKES:
return PP.getSerratedStrikesInformed();
}
return false;
}
public void setInformed(PlayerProfile PP, boolean bool)
{
switch(this)
{
case BERSERK:
PP.setBerserkInformed(bool);
break;
case BLAST_MINING:
PP.setBlastMiningInformed(bool);
break;
case SUPER_BREAKER:
PP.setSuperBreakerInformed(bool);
break;
case GIGA_DRILL_BREAKER:
PP.setGigaDrillBreakerInformed(bool);
break;
case GREEN_TERRA:
PP.setGreenTerraInformed(bool);
break;
case SKULL_SPLIITER:
PP.setSkullSplitterInformed(bool);
break;
case TREE_FELLER:
PP.setTreeFellerInformed(bool);
break;
case SERRATED_STRIKES:
PP.setSerratedStrikesInformed(bool);
break;
}
}
public boolean getPermissions(Player player)
{
switch(this)
{
case BERSERK:
return mcPermissions.getInstance().unarmedAbility(player);
case BLAST_MINING:
return mcPermissions.getInstance().blastMining(player);
case GIGA_DRILL_BREAKER:
return mcPermissions.getInstance().excavationAbility(player);
case GREEN_TERRA:
return mcPermissions.getInstance().herbalismAbility(player);
case LEAF_BLOWER:
return mcPermissions.getInstance().woodcutting(player);
case SERRATED_STRIKES:
return mcPermissions.getInstance().swordsAbility(player);
case SKULL_SPLIITER:
return mcPermissions.getInstance().axesAbility(player);
case SUPER_BREAKER:
return mcPermissions.getInstance().miningAbility(player);
case TREE_FELLER:
return mcPermissions.getInstance().woodCuttingAbility(player);
}
return false;
}
public boolean blockCheck(Material material) {
switch (this) {
case BERSERK:
return (Excavation.canBeGigaDrillBroken(material) || material.equals(Material.SNOW));
case GIGA_DRILL_BREAKER:
return Excavation.canBeGigaDrillBroken(material);
case GREEN_TERRA:
return Herbalism.makeMossy(material);
case LEAF_BLOWER:
return material.equals(Material.LEAVES);
case SUPER_BREAKER:
return Mining.canBeSuperBroken(material);
case TREE_FELLER:
return material.equals(Material.LOG);
default:
return false;
}
}
private AbilityType(int cooldown, String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
this.cooldown = cooldown;
this.abilityOn = abilityOn;
this.abilityOff = abilityOff;
this.abilityPlayer = abilityPlayer;
this.abilityRefresh = abilityRefresh;
this.abilityPlayerOff = abilityPlayerOff;
}
public int getCooldown() {
return this.cooldown;
}
public String getAbilityOn() {
return this.abilityOn;
}
public String getAbilityOff() {
return this.abilityOff;
}
public String getAbilityPlayer(Player player) {
return mcLocale.getString(this.abilityPlayer, new Object[] {player.getName()});
}
public String getAbilityPlayerOff(Player player) {
return mcLocale.getString(this.abilityPlayerOff, new Object[] {player.getName()});
}
public String getAbilityRefresh() {
return this.abilityRefresh;
}
/**
* Get the mode of this ability.
*
* @param PP PlayerProfile of the player using the ability
* @return true if the ability is enabled, false otherwise
*/
public boolean getMode(PlayerProfile PP) {
switch (this) {
case BERSERK:
return PP.getBerserkMode();
case SUPER_BREAKER:
return PP.getSuperBreakerMode();
case GIGA_DRILL_BREAKER:
return PP.getGigaDrillBreakerMode();
case GREEN_TERRA:
return PP.getGreenTerraMode();
case SKULL_SPLIITER:
return PP.getSkullSplitterMode();
case TREE_FELLER:
return PP.getTreeFellerMode();
case SERRATED_STRIKES:
return PP.getSerratedStrikesMode();
default:
return false;
}
}
/**
* Set the mode of this ability.
*
* @param PP PlayerProfile of the player using the ability
* @param bool Mode to set the ability to
*/
public void setMode(PlayerProfile PP, boolean bool) {
switch (this) {
case BERSERK:
PP.setBerserkMode(bool);
break;
case SUPER_BREAKER:
PP.setSuperBreakerMode(bool);
break;
case GIGA_DRILL_BREAKER:
PP.setGigaDrillBreakerMode(bool);
break;
case GREEN_TERRA:
PP.setGreenTerraMode(bool);
break;
case SKULL_SPLIITER:
PP.setSkullSplitterMode(bool);
break;
case TREE_FELLER:
PP.setTreeFellerMode(bool);
break;
case SERRATED_STRIKES:
PP.setSerratedStrikesMode(bool);
break;
default:
break;
}
}
/**
* Get the informed state of this ability
*
* @param PP PlayerProfile of the player using the ability
* @return true if the ability is informed, false otherwise
*/
public boolean getInformed(PlayerProfile PP) {
switch (this) {
case BERSERK:
return PP.getBerserkInformed();
case BLAST_MINING:
return PP.getBlastMiningInformed();
case SUPER_BREAKER:
return PP.getSuperBreakerInformed();
case GIGA_DRILL_BREAKER:
return PP.getGigaDrillBreakerInformed();
case GREEN_TERRA:
return PP.getGreenTerraInformed();
case SKULL_SPLIITER:
return PP.getSkullSplitterInformed();
case TREE_FELLER:
return PP.getTreeFellerInformed();
case SERRATED_STRIKES:
return PP.getSerratedStrikesInformed();
default:
return false;
}
}
/**
* Set the informed state of this ability.
*
* @param PP PlayerProfile of the player using the ability
* @param bool Informed state to set the ability to
*/
public void setInformed(PlayerProfile PP, boolean bool) {
switch (this) {
case BERSERK:
PP.setBerserkInformed(bool);
break;
case BLAST_MINING:
PP.setBlastMiningInformed(bool);
break;
case SUPER_BREAKER:
PP.setSuperBreakerInformed(bool);
break;
case GIGA_DRILL_BREAKER:
PP.setGigaDrillBreakerInformed(bool);
break;
case GREEN_TERRA:
PP.setGreenTerraInformed(bool);
break;
case SKULL_SPLIITER:
PP.setSkullSplitterInformed(bool);
break;
case TREE_FELLER:
PP.setTreeFellerInformed(bool);
break;
case SERRATED_STRIKES:
PP.setSerratedStrikesInformed(bool);
break;
default:
break;
}
}
/**
* Get the permissions for this ability.
*
* @param player Player to check permissions for
* @return true if the player has permissions, false otherwise
*/
public boolean getPermissions(Player player) {
switch (this) {
case BERSERK:
return mcPermissions.getInstance().unarmedAbility(player);
case BLAST_MINING:
return mcPermissions.getInstance().blastMining(player);
case GIGA_DRILL_BREAKER:
return mcPermissions.getInstance().excavationAbility(player);
case GREEN_TERRA:
return mcPermissions.getInstance().herbalismAbility(player);
case LEAF_BLOWER:
return mcPermissions.getInstance().woodcutting(player);
case SERRATED_STRIKES:
return mcPermissions.getInstance().swordsAbility(player);
case SKULL_SPLIITER:
return mcPermissions.getInstance().axesAbility(player);
case SUPER_BREAKER:
return mcPermissions.getInstance().miningAbility(player);
case TREE_FELLER:
return mcPermissions.getInstance().woodCuttingAbility(player);
default:
return false;
}
}
/**
* Check if a block is affected by this ability.
*
* @param material The block type to check
* @return true if the block is affected by this ability, false otherwise
*/
public boolean blockCheck(Material material) {
switch (this) {
case BERSERK:
return (Excavation.canBeGigaDrillBroken(material) || material.equals(Material.SNOW));
case GIGA_DRILL_BREAKER:
return Excavation.canBeGigaDrillBroken(material);
case GREEN_TERRA:
return Herbalism.makeMossy(material);
case LEAF_BLOWER:
return material.equals(Material.LEAVES);
case SUPER_BREAKER:
return Mining.canBeSuperBroken(material);
case TREE_FELLER:
return material.equals(Material.LOG);
default:
return false;
}
}
}

View File

@ -1,21 +1,3 @@
/*
* Copyright (C) 2012 Matt 'The Yeti' Burnett & mcMMO Development
* Copyright (C) 2010-2011 'nossr50'
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.datatypes;
public enum DatabaseUpdate {

View File

@ -1,9 +1,8 @@
package com.gmail.nossr50.datatypes;
public enum HUDType
{
DISABLED,
STANDARD,
SMALL,
RETRO;
public enum HUDType {
DISABLED,
STANDARD,
SMALL,
RETRO;
}

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.datatypes;
public class PlayerStat
{
public String name;
public int statVal = 0;
public class PlayerStat {
public String name;
public int statVal = 0;
}