Beginning work on cooldowns for BlastMining (DO NOT USE THIS BUILD)

This commit is contained in:
nossr50 2012-03-01 12:20:35 -08:00
parent a80507078d
commit fadbaf429d
10 changed files with 69 additions and 34 deletions

View File

@ -25,6 +25,7 @@ Version 1.3.00-dev
+ Added 'mcmmo.commands.inspect' permission node for the new /inspect command
+ Added Impact & Greater Impact subskills to Axes
+ Re-added mcMMO reporting damage events
= Fixed bug with updating MySQL tables to include fishing on servers using custom table prefixes
= Fixed bug where Disarm didn't work at all ever
= Fixed bug where Swords command showed Bleed Length twice instead of Bleed Chance
= Fixed bug where Tree Feller wasn't checking for Tree Feller permission

View File

@ -133,7 +133,7 @@ public class Database {
public void checkDatabaseStructure()
{
String sql = "SELECT * FROM `mcmmo_experience` ORDER BY `"+LoadProperties.MySQLtablePrefix+"experience`.`fishing` ASC LIMIT 0 , 30";
String sql = "SELECT * FROM `"+LoadProperties.MySQLtablePrefix+"experience` ORDER BY `"+LoadProperties.MySQLtablePrefix+"experience`.`fishing` ASC LIMIT 0 , 30";
ResultSet rs = null;
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
@ -157,6 +157,31 @@ public class Database {
}
}
public void checkDatabaseStructureForBlastMining()
{
String sql = "SELECT * FROM `"+LoadProperties.MySQLtablePrefix+"cooldowns` ORDER BY `"+LoadProperties.MySQLtablePrefix+"cooldowns`.`blast_mining` ASC LIMIT 0 , 30";
ResultSet rs = null;
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
try {
PreparedStatement stmt = conn.prepareStatement(sql);
if (stmt.executeQuery() != null) {
stmt.executeQuery();
rs = stmt.getResultSet();
while (rs.next()) {
ArrayList<String> Col = new ArrayList<String>();
for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
Col.add(rs.getString(i));
}
Rows.put(rs.getRow(), Col);
}
}
} catch (SQLException ex) {
System.out.println("Updating mcMMO MySQL tables...");
Write("ALTER TABLE `"+LoadProperties.MySQLtablePrefix + "cooldowns` ADD `blast_mining` int(10) NOT NULL DEFAULT '0' ;");
}
}
// write query
public boolean Write(String sql) {
if(conn != null)

View File

@ -47,7 +47,7 @@ public class LoadProperties {
mcactus, mmushroom, mflower, msugar, mpumpkin, mwheat, mgold,
mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack,
mglowstone, mcoal, mstone, MySQLport, xpGainMultiplier,
superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown,
superBreakerCooldown, blastMiningCooldown, greenTerraCooldown, gigaDrillBreakerCooldown,
treeFellerCooldown, berserkCooldown, serratedStrikeCooldown,
skullSplitterCooldown, abilityDurabilityLoss,
feathersConsumedByChimaeraWing, bonesConsumedByCOTW,
@ -254,6 +254,7 @@ public class LoadProperties {
berserkCooldown = readInteger("Abilities.Cooldowns.Berserk", 240);
serratedStrikeCooldown = readInteger("Abilities.Cooldowns.Serrated_Strikes", 240);
skullSplitterCooldown = readInteger("Abilities.Cooldowns.Skull_Splitter", 240);
blastMiningCooldown = readInteger("Abilities.Cooldowns.Blast_Mining", 60);
MySQLserverName = readString("MySQL.Server.Address", "localhost");
if (readString("MySQL.Database.User.Password", null) != null)

View File

@ -14,7 +14,8 @@ public enum AbilityType
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");
SERRATED_STRIKES(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SerratedStrikesOn"), mcLocale.getString("Skills.SerratedStrikesOff"), "Skills.SerratedStrikesPlayer", mcLocale.getString("Skills.YourSerratedStrikes"), "Skills.SerratedStrikesPlayerOff"),
BLAST_MINING(LoadProperties.blastMiningCooldown, mcLocale.getString("Skills.BlastMiningOn"), mcLocale.getString("Skills.BlastMiningOff"), "Skills.BlastMiningPlayer", mcLocale.getString("Skills.YourBlastMining"), "Skills.BlastMiningPlayerOff");
private int cooldown;
private String abilityOn;
@ -181,6 +182,8 @@ public enum AbilityType
return mcPermissions.getInstance().miningAbility(player);
case TREE_FELLER:
return mcPermissions.getInstance().woodCuttingAbility(player);
case BLAST_MINING:
return mcPermissions.getInstance().blastMining(player);
}
return false;
}

View File

@ -47,7 +47,7 @@ public class PlayerProfile
//TOGGLES
private boolean loaded = false, partyhud = true, spoutcraft = false, filling = false, xpbarlocked = false, placedAnvil = false, partyChatMode = false, adminChatMode = false, godMode = false, greenTerraMode, partyChatOnly = false, greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true,
superBreakerInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode,
superBreakerInformed = true, blastMiningInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode,
serratedStrikesMode, hoePreparationMode = false, shovelPreparationMode = false, swordsPreparationMode = false, fistsPreparationMode = false, pickaxePreparationMode = false, axePreparationMode = false, skullSplitterMode, berserkMode;
//TIMESTAMPS
@ -189,6 +189,7 @@ public class PlayerProfile
skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(cooldowns.get(1).get(4)));
skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(cooldowns.get(1).get(5)));
skillsDATS.put(AbilityType.SKULL_SPLIITER, Integer.valueOf(cooldowns.get(1).get(6)));
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(cooldowns.get(1).get(7)));
}
HashMap<Integer, ArrayList<String>> stats = mcMMO.database.Read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM "+LoadProperties.MySQLtablePrefix+"skills WHERE user_id = " + id);
skills.put(SkillType.TAMING, Integer.valueOf(stats.get(1).get(0)));
@ -324,6 +325,8 @@ public class PlayerProfile
skills.put(SkillType.FISHING, Integer.valueOf(character[34]));
if(character.length > 35)
skillsXp.put(SkillType.FISHING, Integer.valueOf(character[35]));
if(character.length > 36)
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(character[36]));
in.close();
loaded = true;
return true;
@ -354,6 +357,7 @@ public class PlayerProfile
+", excavation = " + skillsDATS.get(AbilityType.GIGA_DRILL_BREAKER)
+", swords = " + skillsDATS.get(AbilityType.SERRATED_STRIKES)
+", axes = " + skillsDATS.get(AbilityType.SKULL_SPLIITER)
+", blast_mining = " + skillsDATS.get(AbilityType.BLAST_MINING)
+" WHERE user_id = "+this.userid);
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"skills SET "
+" taming = "+skills.get(SkillType.TAMING)
@ -442,6 +446,7 @@ public class PlayerProfile
writer.append(hud.toString()+":");
writer.append(skills.get(SkillType.FISHING) + ":");
writer.append(skillsXp.get(SkillType.FISHING) + ":");
writer.append(String.valueOf(skillsDATS.get(AbilityType.BLAST_MINING)) + ":");
writer.append("\r\n");
}
}
@ -522,6 +527,7 @@ public class PlayerProfile
out.append(LoadProperties.defaulthud.toString()+":");//HUD
out.append(0+":"); //Fishing
out.append(0+":"); //FishingXP
out.append(0+":"); //Blast Mining
//Add more in the same format as the line above
@ -672,7 +678,7 @@ public class PlayerProfile
public boolean getHoePreparationMode(){
return hoePreparationMode;
}
public void setHoePreparationMode(Boolean bool){
public void setHoePreparationMode(boolean bool){
hoePreparationMode = bool;
}
public long getHoePreparationATS(){
@ -688,7 +694,7 @@ public class PlayerProfile
public boolean getSwordsPreparationMode(){
return swordsPreparationMode;
}
public void setSwordsPreparationMode(Boolean bool){
public void setSwordsPreparationMode(boolean bool){
swordsPreparationMode = bool;
}
public long getSwordsPreparationATS(){
@ -703,7 +709,7 @@ public class PlayerProfile
public boolean getShovelPreparationMode(){
return shovelPreparationMode;
}
public void setShovelPreparationMode(Boolean bool){
public void setShovelPreparationMode(boolean bool){
shovelPreparationMode = bool;
}
public long getShovelPreparationATS(){
@ -718,7 +724,7 @@ public class PlayerProfile
public boolean getFistsPreparationMode(){
return fistsPreparationMode;
}
public void setFistsPreparationMode(Boolean bool){
public void setFistsPreparationMode(boolean bool){
fistsPreparationMode = bool;
}
public long getFistsPreparationATS(){
@ -733,7 +739,7 @@ public class PlayerProfile
public boolean getAxePreparationMode(){
return axePreparationMode;
}
public void setAxePreparationMode(Boolean bool){
public void setAxePreparationMode(boolean bool){
axePreparationMode = bool;
}
public long getAxePreparationATS(){
@ -748,7 +754,7 @@ public class PlayerProfile
public boolean getPickaxePreparationMode(){
return pickaxePreparationMode;
}
public void setPickaxePreparationMode(Boolean bool){
public void setPickaxePreparationMode(boolean bool){
pickaxePreparationMode = bool;
}
public long getPickaxePreparationATS(){
@ -761,13 +767,13 @@ public class PlayerProfile
* GREEN TERRA MODE
*/
public boolean getGreenTerraInformed() {return greenTerraInformed;}
public void setGreenTerraInformed(Boolean bool){
public void setGreenTerraInformed(boolean bool){
greenTerraInformed = bool;
}
public boolean getGreenTerraMode(){
return greenTerraMode;
}
public void setGreenTerraMode(Boolean bool){
public void setGreenTerraMode(boolean bool){
greenTerraMode = bool;
}
@ -775,78 +781,82 @@ public class PlayerProfile
* BERSERK MODE
*/
public boolean getBerserkInformed() {return berserkInformed;}
public void setBerserkInformed(Boolean bool){
public void setBerserkInformed(boolean bool){
berserkInformed = bool;
}
public boolean getBerserkMode(){
return berserkMode;
}
public void setBerserkMode(Boolean bool){
public void setBerserkMode(boolean bool){
berserkMode = bool;
}
/*
* SKULL SPLITTER
*/
public boolean getSkullSplitterInformed() {return skullSplitterInformed;}
public void setSkullSplitterInformed(Boolean bool){
public void setSkullSplitterInformed(boolean bool){
skullSplitterInformed = bool;
}
public boolean getSkullSplitterMode(){
return skullSplitterMode;
}
public void setSkullSplitterMode(Boolean bool){
public void setSkullSplitterMode(boolean bool){
skullSplitterMode = bool;
}
/*
* SERRATED STRIKES
*/
public boolean getSerratedStrikesInformed() {return serratedStrikesInformed;}
public void setSerratedStrikesInformed(Boolean bool){
public void setSerratedStrikesInformed(boolean bool){
serratedStrikesInformed = bool;
}
public boolean getSerratedStrikesMode(){
return serratedStrikesMode;
}
public void setSerratedStrikesMode(Boolean bool){
public void setSerratedStrikesMode(boolean bool){
serratedStrikesMode = bool;
}
/*
* GIGA DRILL BREAKER
*/
public boolean getGigaDrillBreakerInformed() {return gigaDrillBreakerInformed;}
public void setGigaDrillBreakerInformed(Boolean bool){
public void setGigaDrillBreakerInformed(boolean bool){
gigaDrillBreakerInformed = bool;
}
public boolean getGigaDrillBreakerMode(){
return gigaDrillBreakerMode;
}
public void setGigaDrillBreakerMode(Boolean bool){
public void setGigaDrillBreakerMode(boolean bool){
gigaDrillBreakerMode = bool;
}
/*
* TREE FELLER STUFF
*/
public boolean getTreeFellerInformed() {return treeFellerInformed;}
public void setTreeFellerInformed(Boolean bool){
public void setTreeFellerInformed(boolean bool){
treeFellerInformed = bool;
}
public boolean getTreeFellerMode(){
return treeFellerMode;
}
public void setTreeFellerMode(Boolean bool){
public void setTreeFellerMode(boolean bool){
treeFellerMode = bool;
}
/*
* MINING
*/
public boolean getSuperBreakerInformed() {return superBreakerInformed;}
public void setSuperBreakerInformed(Boolean bool){
public void setSuperBreakerInformed(boolean bool){
superBreakerInformed = bool;
}
public boolean getBlastMiningInformed() {return blastMiningInformed;}
public void setBlastMiningInformed(boolean bool){
blastMiningInformed = bool;
}
public boolean getSuperBreakerMode(){
return superBreakerMode;
}
public void setSuperBreakerMode(Boolean bool){
public void setSuperBreakerMode(boolean bool){
superBreakerMode = bool;
}
public long getRecentlyHurt(){

View File

@ -72,7 +72,7 @@ public class mcBlockListener implements Listener
Material mat = block.getType();
//TNT placement checks - needed for Blast Mining
if(id == 46 && mcPermissions.getInstance().blastmining(player))
if(id == 46 && mcPermissions.getInstance().blastMining(player))
{
int skill = Users.getProfile(player).getSkillLevel(SkillType.MINING);
plugin.misc.tntTracker.put(block.getLocation(), player);
@ -160,10 +160,6 @@ public class mcBlockListener implements Listener
* MINING
*/
//TNT removal checks - needed for Blast Mining
if(id == 46 && inhand.getTypeId() != 259 && mcPermissions.getInstance().blastmining(player))
plugin.misc.tntTracker.remove(block);
if(mcPermissions.getInstance().mining(player))
{
if(LoadProperties.miningrequirespickaxe && m.isMiningPick(inhand))

View File

@ -17,7 +17,6 @@
package com.gmail.nossr50.listeners;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -106,7 +105,7 @@ public class mcEntityListener implements Listener
/*
* Demolitions Expert
*/
if(cause == DamageCause.BLOCK_EXPLOSION && mcPermissions.getInstance().blastmining(player))
if(cause == DamageCause.BLOCK_EXPLOSION && mcPermissions.getInstance().blastMining(player))
BlastMining.demolitionsExpertise(Users.getProfile(player).getSkillLevel(SkillType.MINING), event);
}

View File

@ -292,7 +292,6 @@ public class mcPlayerListener implements Listener
tnt.setFuseTicks(0);
if(plugin.misc.tntTracker.get(tnt.getLocation()) != null)
System.out.println(tnt.getLocation().toString());
// plugin.misc.tntTracker.remove(block);
}
}
}

View File

@ -100,7 +100,7 @@ public class mcPermissions
public boolean mining(Player player) {
return player.hasPermission("mcmmo.skills.mining");
}
public boolean blastmining(Player player) {
public boolean blastMining(Player player) {
return player.hasPermission("mcmmo.skills.blastmining");
}
public boolean fishing(Player player) {

View File

@ -87,6 +87,7 @@ Abilities:
Activation:
Only_Activate_When_Sneaking: false
Cooldowns:
Blast_Mining: 60
Giga_Drill_Breaker: 240
Berserk: 240
Green_Terra: 240