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 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.abilityOn = abilityOn;
this.abilityOff = abilityOff;
@ -39,181 +38,253 @@ public enum AbilityType
this.abilityPlayerOff = abilityPlayerOff;
}
public int getCooldown()
{
public int getCooldown() {
return this.cooldown;
}
public String getAbilityOn()
{
public String getAbilityOn() {
return this.abilityOn;
}
public String getAbilityOff()
{
public String getAbilityOff() {
return this.abilityOff;
}
public String getAbilityPlayer(Player player)
{
public String getAbilityPlayer(Player player) {
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()});
}
public String getAbilityRefresh()
{
public String getAbilityRefresh() {
return this.abilityRefresh;
}
public boolean getMode(PlayerProfile PP)
{
switch(this)
{
/**
* 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;
}
}
public void setMode(PlayerProfile PP, boolean bool)
{
switch(this)
{
/**
* 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;
}
}
public boolean getInformed(PlayerProfile PP)
{
switch(this)
{
/**
* 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;
}
}
public void setInformed(PlayerProfile PP, boolean bool)
{
switch(this)
{
/**
* 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;
}
}
public boolean getPermissions(Player player)
{
switch(this)
{
/**
* 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,7 +1,6 @@
package com.gmail.nossr50.datatypes;
public enum HUDType
{
public enum HUDType {
DISABLED,
STANDARD,
SMALL,

View File

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