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 public enum AbilityType
{ {
BERSERK(LoadProperties.berserkCooldown, mcLocale.getString("Skills.BerserkOn"), mcLocale.getString("Skills.BerserkOff"), "Skills.BerserkPlayer", mcLocale.getString("Skills.YourBerserk"), "Skills.BerserkPlayerOff"), 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"), 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"), 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")), 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"), 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"), 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"), 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), BLAST_MINING(LoadProperties.blastMiningCooldown, null, null, "Skills.BlastMiningPlayer", mcLocale.getString("Skills.YourBlastMining"), null),
LEAF_BLOWER(0, null, null, null, null, null); LEAF_BLOWER(0, null, null, null, null, null);
private int cooldown; private int cooldown;
private String abilityOn; private String abilityOn;
private String abilityOff; private String abilityOff;
private String abilityPlayer; private String abilityPlayer;
private String abilityRefresh; private String abilityRefresh;
private String abilityPlayerOff; 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;
}
public void setMode(PlayerProfile PP, boolean bool) private AbilityType(int cooldown, String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
{ this.cooldown = cooldown;
switch(this) this.abilityOn = abilityOn;
{ this.abilityOff = abilityOff;
case BERSERK: this.abilityPlayer = abilityPlayer;
PP.setBerserkMode(bool); this.abilityRefresh = abilityRefresh;
break; this.abilityPlayerOff = abilityPlayerOff;
case SUPER_BREAKER: }
PP.setSuperBreakerMode(bool);
break; public int getCooldown() {
case GIGA_DRILL_BREAKER: return this.cooldown;
PP.setGigaDrillBreakerMode(bool); }
break;
case GREEN_TERRA: public String getAbilityOn() {
PP.setGreenTerraMode(bool); return this.abilityOn;
break; }
case SKULL_SPLIITER:
PP.setSkullSplitterMode(bool); public String getAbilityOff() {
break; return this.abilityOff;
case TREE_FELLER: }
PP.setTreeFellerMode(bool);
break; public String getAbilityPlayer(Player player) {
case SERRATED_STRIKES: return mcLocale.getString(this.abilityPlayer, new Object[] {player.getName()});
PP.setSerratedStrikesMode(bool); }
break;
} public String getAbilityPlayerOff(Player player) {
} return mcLocale.getString(this.abilityPlayerOff, new Object[] {player.getName()});
}
public boolean getInformed(PlayerProfile PP)
{ public String getAbilityRefresh() {
switch(this) return this.abilityRefresh;
{ }
case BERSERK:
return PP.getBerserkInformed(); /**
case BLAST_MINING: * Get the mode of this ability.
return PP.getBlastMiningInformed(); *
case SUPER_BREAKER: * @param PP PlayerProfile of the player using the ability
return PP.getSuperBreakerInformed(); * @return true if the ability is enabled, false otherwise
case GIGA_DRILL_BREAKER: */
return PP.getGigaDrillBreakerInformed(); public boolean getMode(PlayerProfile PP) {
case GREEN_TERRA: switch (this) {
return PP.getGreenTerraInformed(); case BERSERK:
case SKULL_SPLIITER: return PP.getBerserkMode();
return PP.getSkullSplitterInformed();
case TREE_FELLER: case SUPER_BREAKER:
return PP.getTreeFellerInformed(); return PP.getSuperBreakerMode();
case SERRATED_STRIKES:
return PP.getSerratedStrikesInformed(); case GIGA_DRILL_BREAKER:
} return PP.getGigaDrillBreakerMode();
return false;
} case GREEN_TERRA:
return PP.getGreenTerraMode();
public void setInformed(PlayerProfile PP, boolean bool)
{ case SKULL_SPLIITER:
switch(this) return PP.getSkullSplitterMode();
{
case BERSERK: case TREE_FELLER:
PP.setBerserkInformed(bool); return PP.getTreeFellerMode();
break;
case BLAST_MINING: case SERRATED_STRIKES:
PP.setBlastMiningInformed(bool); return PP.getSerratedStrikesMode();
break;
case SUPER_BREAKER: default:
PP.setSuperBreakerInformed(bool); return false;
break; }
case GIGA_DRILL_BREAKER: }
PP.setGigaDrillBreakerInformed(bool);
break; /**
case GREEN_TERRA: * Set the mode of this ability.
PP.setGreenTerraInformed(bool); *
break; * @param PP PlayerProfile of the player using the ability
case SKULL_SPLIITER: * @param bool Mode to set the ability to
PP.setSkullSplitterInformed(bool); */
break; public void setMode(PlayerProfile PP, boolean bool) {
case TREE_FELLER: switch (this) {
PP.setTreeFellerInformed(bool); case BERSERK:
break; PP.setBerserkMode(bool);
case SERRATED_STRIKES: break;
PP.setSerratedStrikesInformed(bool);
break; case SUPER_BREAKER:
} PP.setSuperBreakerMode(bool);
} break;
public boolean getPermissions(Player player) case GIGA_DRILL_BREAKER:
{ PP.setGigaDrillBreakerMode(bool);
switch(this) break;
{
case BERSERK: case GREEN_TERRA:
return mcPermissions.getInstance().unarmedAbility(player); PP.setGreenTerraMode(bool);
case BLAST_MINING: break;
return mcPermissions.getInstance().blastMining(player);
case GIGA_DRILL_BREAKER: case SKULL_SPLIITER:
return mcPermissions.getInstance().excavationAbility(player); PP.setSkullSplitterMode(bool);
case GREEN_TERRA: break;
return mcPermissions.getInstance().herbalismAbility(player);
case LEAF_BLOWER: case TREE_FELLER:
return mcPermissions.getInstance().woodcutting(player); PP.setTreeFellerMode(bool);
case SERRATED_STRIKES: break;
return mcPermissions.getInstance().swordsAbility(player);
case SKULL_SPLIITER: case SERRATED_STRIKES:
return mcPermissions.getInstance().axesAbility(player); PP.setSerratedStrikesMode(bool);
case SUPER_BREAKER: break;
return mcPermissions.getInstance().miningAbility(player);
case TREE_FELLER: default:
return mcPermissions.getInstance().woodCuttingAbility(player); break;
} }
return false; }
}
/**
public boolean blockCheck(Material material) { * Get the informed state of this ability
switch (this) { *
case BERSERK: * @param PP PlayerProfile of the player using the ability
return (Excavation.canBeGigaDrillBroken(material) || material.equals(Material.SNOW)); * @return true if the ability is informed, false otherwise
case GIGA_DRILL_BREAKER: */
return Excavation.canBeGigaDrillBroken(material); public boolean getInformed(PlayerProfile PP) {
case GREEN_TERRA: switch (this) {
return Herbalism.makeMossy(material); case BERSERK:
case LEAF_BLOWER: return PP.getBerserkInformed();
return material.equals(Material.LEAVES);
case SUPER_BREAKER: case BLAST_MINING:
return Mining.canBeSuperBroken(material); return PP.getBlastMiningInformed();
case TREE_FELLER:
return material.equals(Material.LOG); case SUPER_BREAKER:
default: return PP.getSuperBreakerInformed();
return false;
} 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; package com.gmail.nossr50.datatypes;
public enum DatabaseUpdate { public enum DatabaseUpdate {

View File

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

View File

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