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

@ -29,8 +29,7 @@ public enum AbilityType
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) private AbilityType(int cooldown, String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
{
this.cooldown = cooldown; this.cooldown = cooldown;
this.abilityOn = abilityOn; this.abilityOn = abilityOn;
this.abilityOff = abilityOff; this.abilityOff = abilityOff;
@ -39,181 +38,253 @@ public enum AbilityType
this.abilityPlayerOff = abilityPlayerOff; this.abilityPlayerOff = abilityPlayerOff;
} }
public int getCooldown() public int getCooldown() {
{
return this.cooldown; return this.cooldown;
} }
public String getAbilityOn() public String getAbilityOn() {
{
return this.abilityOn; return this.abilityOn;
} }
public String getAbilityOff() public String getAbilityOff() {
{
return this.abilityOff; return this.abilityOff;
} }
public String getAbilityPlayer(Player player) public String getAbilityPlayer(Player player) {
{
return mcLocale.getString(this.abilityPlayer, new Object[] {player.getName()}); return mcLocale.getString(this.abilityPlayer, new Object[] {player.getName()});
} }
public String getAbilityPlayerOff(Player player) public String getAbilityPlayerOff(Player player) {
{
return mcLocale.getString(this.abilityPlayerOff, new Object[] {player.getName()}); return mcLocale.getString(this.abilityPlayerOff, new Object[] {player.getName()});
} }
public String getAbilityRefresh() public String getAbilityRefresh() {
{
return this.abilityRefresh; return this.abilityRefresh;
} }
public boolean getMode(PlayerProfile PP) /**
{ * Get the mode of this ability.
switch(this) *
{ * @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: case BERSERK:
return PP.getBerserkMode(); return PP.getBerserkMode();
case SUPER_BREAKER: case SUPER_BREAKER:
return PP.getSuperBreakerMode(); return PP.getSuperBreakerMode();
case GIGA_DRILL_BREAKER: case GIGA_DRILL_BREAKER:
return PP.getGigaDrillBreakerMode(); return PP.getGigaDrillBreakerMode();
case GREEN_TERRA: case GREEN_TERRA:
return PP.getGreenTerraMode(); return PP.getGreenTerraMode();
case SKULL_SPLIITER: case SKULL_SPLIITER:
return PP.getSkullSplitterMode(); return PP.getSkullSplitterMode();
case TREE_FELLER: case TREE_FELLER:
return PP.getTreeFellerMode(); return PP.getTreeFellerMode();
case SERRATED_STRIKES: case SERRATED_STRIKES:
return PP.getSerratedStrikesMode(); return PP.getSerratedStrikesMode();
}
default:
return false; return false;
} }
}
public void setMode(PlayerProfile PP, boolean bool) /**
{ * Set the mode of this ability.
switch(this) *
{ * @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: case BERSERK:
PP.setBerserkMode(bool); PP.setBerserkMode(bool);
break; break;
case SUPER_BREAKER: case SUPER_BREAKER:
PP.setSuperBreakerMode(bool); PP.setSuperBreakerMode(bool);
break; break;
case GIGA_DRILL_BREAKER: case GIGA_DRILL_BREAKER:
PP.setGigaDrillBreakerMode(bool); PP.setGigaDrillBreakerMode(bool);
break; break;
case GREEN_TERRA: case GREEN_TERRA:
PP.setGreenTerraMode(bool); PP.setGreenTerraMode(bool);
break; break;
case SKULL_SPLIITER: case SKULL_SPLIITER:
PP.setSkullSplitterMode(bool); PP.setSkullSplitterMode(bool);
break; break;
case TREE_FELLER: case TREE_FELLER:
PP.setTreeFellerMode(bool); PP.setTreeFellerMode(bool);
break; break;
case SERRATED_STRIKES: case SERRATED_STRIKES:
PP.setSerratedStrikesMode(bool); PP.setSerratedStrikesMode(bool);
break; break;
default:
break;
} }
} }
public boolean getInformed(PlayerProfile PP) /**
{ * Get the informed state of this ability
switch(this) *
{ * @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: case BERSERK:
return PP.getBerserkInformed(); return PP.getBerserkInformed();
case BLAST_MINING: case BLAST_MINING:
return PP.getBlastMiningInformed(); return PP.getBlastMiningInformed();
case SUPER_BREAKER: case SUPER_BREAKER:
return PP.getSuperBreakerInformed(); return PP.getSuperBreakerInformed();
case GIGA_DRILL_BREAKER: case GIGA_DRILL_BREAKER:
return PP.getGigaDrillBreakerInformed(); return PP.getGigaDrillBreakerInformed();
case GREEN_TERRA: case GREEN_TERRA:
return PP.getGreenTerraInformed(); return PP.getGreenTerraInformed();
case SKULL_SPLIITER: case SKULL_SPLIITER:
return PP.getSkullSplitterInformed(); return PP.getSkullSplitterInformed();
case TREE_FELLER: case TREE_FELLER:
return PP.getTreeFellerInformed(); return PP.getTreeFellerInformed();
case SERRATED_STRIKES: case SERRATED_STRIKES:
return PP.getSerratedStrikesInformed(); return PP.getSerratedStrikesInformed();
}
default:
return false; return false;
} }
}
public void setInformed(PlayerProfile PP, boolean bool) /**
{ * Set the informed state of this ability.
switch(this) *
{ * @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: case BERSERK:
PP.setBerserkInformed(bool); PP.setBerserkInformed(bool);
break; break;
case BLAST_MINING: case BLAST_MINING:
PP.setBlastMiningInformed(bool); PP.setBlastMiningInformed(bool);
break; break;
case SUPER_BREAKER: case SUPER_BREAKER:
PP.setSuperBreakerInformed(bool); PP.setSuperBreakerInformed(bool);
break; break;
case GIGA_DRILL_BREAKER: case GIGA_DRILL_BREAKER:
PP.setGigaDrillBreakerInformed(bool); PP.setGigaDrillBreakerInformed(bool);
break; break;
case GREEN_TERRA: case GREEN_TERRA:
PP.setGreenTerraInformed(bool); PP.setGreenTerraInformed(bool);
break; break;
case SKULL_SPLIITER: case SKULL_SPLIITER:
PP.setSkullSplitterInformed(bool); PP.setSkullSplitterInformed(bool);
break; break;
case TREE_FELLER: case TREE_FELLER:
PP.setTreeFellerInformed(bool); PP.setTreeFellerInformed(bool);
break; break;
case SERRATED_STRIKES: case SERRATED_STRIKES:
PP.setSerratedStrikesInformed(bool); PP.setSerratedStrikesInformed(bool);
break; break;
default:
break;
} }
} }
public boolean getPermissions(Player player) /**
{ * Get the permissions for this ability.
switch(this) *
{ * @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: case BERSERK:
return mcPermissions.getInstance().unarmedAbility(player); return mcPermissions.getInstance().unarmedAbility(player);
case BLAST_MINING: case BLAST_MINING:
return mcPermissions.getInstance().blastMining(player); return mcPermissions.getInstance().blastMining(player);
case GIGA_DRILL_BREAKER: case GIGA_DRILL_BREAKER:
return mcPermissions.getInstance().excavationAbility(player); return mcPermissions.getInstance().excavationAbility(player);
case GREEN_TERRA: case GREEN_TERRA:
return mcPermissions.getInstance().herbalismAbility(player); return mcPermissions.getInstance().herbalismAbility(player);
case LEAF_BLOWER: case LEAF_BLOWER:
return mcPermissions.getInstance().woodcutting(player); return mcPermissions.getInstance().woodcutting(player);
case SERRATED_STRIKES: case SERRATED_STRIKES:
return mcPermissions.getInstance().swordsAbility(player); return mcPermissions.getInstance().swordsAbility(player);
case SKULL_SPLIITER: case SKULL_SPLIITER:
return mcPermissions.getInstance().axesAbility(player); return mcPermissions.getInstance().axesAbility(player);
case SUPER_BREAKER: case SUPER_BREAKER:
return mcPermissions.getInstance().miningAbility(player); return mcPermissions.getInstance().miningAbility(player);
case TREE_FELLER: case TREE_FELLER:
return mcPermissions.getInstance().woodCuttingAbility(player); return mcPermissions.getInstance().woodCuttingAbility(player);
}
default:
return false; 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) { public boolean blockCheck(Material material) {
switch (this) { switch (this) {
case BERSERK: case BERSERK:
return (Excavation.canBeGigaDrillBroken(material) || material.equals(Material.SNOW)); return (Excavation.canBeGigaDrillBroken(material) || material.equals(Material.SNOW));
case GIGA_DRILL_BREAKER: case GIGA_DRILL_BREAKER:
return Excavation.canBeGigaDrillBroken(material); return Excavation.canBeGigaDrillBroken(material);
case GREEN_TERRA: case GREEN_TERRA:
return Herbalism.makeMossy(material); return Herbalism.makeMossy(material);
case LEAF_BLOWER: case LEAF_BLOWER:
return material.equals(Material.LEAVES); return material.equals(Material.LEAVES);
case SUPER_BREAKER: case SUPER_BREAKER:
return Mining.canBeSuperBroken(material); return Mining.canBeSuperBroken(material);
case TREE_FELLER: case TREE_FELLER:
return material.equals(Material.LOG); return material.equals(Material.LOG);
default: default:
return false; 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,7 +1,6 @@
package com.gmail.nossr50.datatypes; package com.gmail.nossr50.datatypes;
public enum HUDType public enum HUDType {
{
DISABLED, DISABLED,
STANDARD, STANDARD,
SMALL, SMALL,

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;
} }