Version 1.0.02 of mcMMO

This commit is contained in:
nossr50 2011-04-29 15:50:55 -07:00
parent ecb03aebaf
commit f016ce1a9d
13 changed files with 88 additions and 43 deletions

View File

@ -1,5 +1,21 @@
Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code#
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
Version 1.0.02
Fixed bug where the Timer would start before everything else was ready
Fixed bug where mcrefresh also required mcability permission node
Fixed bug where Unarmed was not checking for disarm procs
Green Thumb now checks for herbalism permissions
Added "enableGreenThumbCobbleToMossy" to config file, this also changes Green Terra
AoE abilities now harm wolves
Version 1.0.01
Removed debug message when wolves are struck
Fixed issue with reloading mcMMO when MySQL was enabled
Fixed a NPE with MySpawn
Fixed a NPE with removing users from PlayerProfile
Unarmed no longer starts with a damage bonus
Unarmed apprentice DMG bonus changed from 3 to 2
Version 1.0
Players can now repair Stone/Wood tools
Fixed duping bug with WG/Block Protection Plugins

View File

@ -63,6 +63,11 @@ public class Combat {
Axes.axeCriticalCheck(attacker, eventb); //Axe Criticals
if(!Config.getInstance().isBleedTracked(event.getEntity())) //Swords Bleed
Swords.bleedCheck(attacker, event.getEntity());
if(event.getEntity() instanceof Player){
Player defender = (Player)event.getEntity();
Unarmed.disarmProcCheck(attacker, defender);
}
//Modify the event damage if Attacker is Berserk
if(PPa.getBerserkMode())
@ -70,9 +75,9 @@ public class Combat {
//Handle Ability Interactions
if(PPa.getSkullSplitterMode() && m.isAxes(attacker.getItemInHand()))
Axes.applyAoeDamage(attacker, eventb);
Axes.applyAoeDamage(attacker, eventb, pluginx);
if(PPa.getSerratedStrikesMode() && m.isSwords(attacker.getItemInHand()))
Swords.applySerratedStrikes(attacker, eventb);
Swords.applySerratedStrikes(attacker, eventb, pluginx);
//Experience
if(event.getEntity() instanceof Player)
@ -208,7 +213,6 @@ public class Combat {
//Thick Fur
if(PPo.getTamingInt() >= 250)
event.setDamage(event.getDamage() / 2);
master.sendMessage("mcMMO Debug: Wolf Damage Taken "+event.getDamage());
}
}
}

View File

@ -77,9 +77,12 @@ public class Users {
public static void removeUser(Player player){
PlayerProfile PP = Users.getProfile(player);
if(PP != null){
PP.save();
if(players.containsKey(player))
players.remove(player);
}
}
public static PlayerProfile getProfile(Player player){
return players.get(player);

View File

@ -3,7 +3,7 @@ package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO;
public class LoadProperties {
public static Boolean useMySQL, cocoabeans, archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
public static Boolean enableCobbleToMossy, useMySQL, cocoabeans, archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
public static String MySQLtablePrefix, MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass, mctop, addxp, mcability, mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
public static int MySQLport, xpGainMultiplier, superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
@ -39,6 +39,7 @@ public class LoadProperties {
* OTHER
*/
enableCobbleToMossy = properties.getBoolean("enableGreenThumbCobbleToMossy", true);
archeryFireRateLimit = properties.getBoolean("archeryFireRateLimit", true);
xpGainMultiplier = properties.getInteger("xpGainMultiplier", 1);
toolsLoseDurabilityFromAbilities = properties.getBoolean("toolsLoseDurabilityFromAbilities", true);

View File

@ -1655,19 +1655,31 @@ public class PlayerProfile
save();
}
public String getX(){
if(myspawn != null)
{
String[] split = myspawn.split(",");
String x = split[0];
return x;
return split[0];
}
else
return null;
}
public String getY(){
if(myspawn != null)
{
String[] split = myspawn.split(",");
String y = split[1];
return y;
return split[1];
}
else
return null;
}
public String getZ(){
if(myspawn != null)
{
String[] split = myspawn.split(",");
String z = split[2];
return z;
return split[2];
}
else
return null;
}
public void setDead(boolean x){
dead = x;
@ -1678,10 +1690,13 @@ public class PlayerProfile
}
public Location getMySpawn(Player player){
Location loc = null;
if(myspawn != null){
if(isDouble(getX()) && isDouble(getY()) && isDouble(getZ()))
loc = new Location(player.getWorld(),(Double.parseDouble(getX())), Double.parseDouble(getY()), Double.parseDouble(getZ()));
else
return null;
} else
return null;
loc.setYaw(0);
loc.setPitch(0);

View File

@ -797,10 +797,10 @@ public class m {
if(PP.getUnarmedInt() < 250){
player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 250+ SKILL (UNARMED APPRENTICE)");
} else if(PP.getUnarmedInt() >= 250 && PP.getUnarmedInt() < 500){
player.sendMessage(ChatColor.RED+"Unarmed Apprentice: "+ChatColor.YELLOW+"Damage Upgrade");
player.sendMessage(ChatColor.RED+"Unarmed Apprentice: "+ChatColor.YELLOW+"+2 DMG Upgrade");
player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 500+ SKILL (UNARMED MASTERY)");
} else {
player.sendMessage(ChatColor.RED+"Unarmed Mastery: "+ChatColor.YELLOW+"Large Damage Upgrade");
player.sendMessage(ChatColor.RED+"Unarmed Mastery: "+ChatColor.YELLOW+"+4 DMG Upgrade");
}
player.sendMessage(ChatColor.RED+"Berserk Length: "+ChatColor.YELLOW+ticks+"s");
}

View File

@ -51,12 +51,10 @@ public class mcMMO extends JavaPlugin {
public static Database database = null;
public void onEnable() {
mcMMO_Timer.schedule(new mcTimer(this), (long)0, (long)(1000));
new File(maindirectory).mkdir();
mcProperties.makeProperties(Properties, log); //Make Props file
LoadProperties.loadMain(); //Load Props file
Users.getInstance().loadUsers(); //Load Users file
for(Player player : getServer().getOnlinePlayers()){Users.addUser(player);} //In case of reload add all users back into PlayerProfile
/*
* REGISTER EVENTS
*/
@ -83,7 +81,9 @@ public class mcMMO extends JavaPlugin {
database.createStructure(); //Make Structure
if(!LoadProperties.useMySQL)
Leaderboard.makeLeaderboards(); //Make the leaderboards
for(Player player : getServer().getOnlinePlayers()){Users.addUser(player);} //In case of reload add all users back into PlayerProfile
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
mcMMO_Timer.schedule(new mcTimer(this), (long)0, (long)(1000));
}
private void mcLoadMySQL() {

View File

@ -136,9 +136,9 @@ public class mcPlayerListener extends PlayerListener {
//GREEN THUMB
if(block != null && (block.getType() == Material.COBBLESTONE || block.getType() == Material.DIRT) && player.getItemInHand().getType() == Material.SEEDS){
boolean pass = false;
if(Herbalism.hasSeeds(player)){
if(Herbalism.hasSeeds(player) && mcPermissions.getInstance().herbalism(player)){
Herbalism.removeSeeds(player);
if(block.getType() == Material.COBBLESTONE && Math.random() * 1500 <= PP.getHerbalismInt()){
if(LoadProperties.enableCobbleToMossy && block.getType() == Material.COBBLESTONE && Math.random() * 1500 <= PP.getHerbalismInt()){
player.sendMessage(ChatColor.GREEN+"**GREEN THUMB**");
block.setType(Material.MOSSY_COBBLESTONE);
pass = true;
@ -193,21 +193,17 @@ public class mcPlayerListener extends PlayerListener {
PP.toggleAbilityUse();
}
}
if(split[0].equalsIgnoreCase("/details")){
event.setCancelled(true);
player.getLocation().getWorld().spawnCreature(player.getLocation(), CreatureType.WOLF);
player.getLocation().getWorld().spawnCreature(player.getLocation(), CreatureType.WOLF);
player.sendMessage("Material : "+player.getItemInHand().getType());
player.sendMessage("Type ID : "+player.getItemInHand().getTypeId());
player.sendMessage("Byte Data : "+player.getItemInHand().getDurability());
}
/*
* FFS -> MySQL
*/
if(split[0].equalsIgnoreCase("/mmoupdate") && mcPermissions.getInstance().admin(player))
if(split[0].equalsIgnoreCase("/mmoupdate"))
{
event.setCancelled(true);
if(!mcPermissions.getInstance().admin(player)){
player.sendMessage(ChatColor.YELLOW+"[MMO]"+ChatColor.DARK_RED +" Insufficient mcPermissions.");
return;
}
player.sendMessage(ChatColor.GRAY+"Starting conversion...");
Users.clearUsers();
m.convertToMySQL(plugin);
@ -230,7 +226,7 @@ public class mcPlayerListener extends PlayerListener {
if(split.length == 1){
int p = 1;
String[] info = Leaderboard.retrieveInfo("powerlevel", p);
player.sendMessage(ChatColor.YELLOW+"--MMO"+ChatColor.BLUE+" Power Level "+ChatColor.YELLOW+"Leaderboard--");
player.sendMessage(ChatColor.YELLOW+"--mcMMO"+ChatColor.BLUE+" Power Level "+ChatColor.YELLOW+"Leaderboard--");
int n = 1 * p; //Position
for(String x : info){
if(x != null){
@ -259,7 +255,7 @@ public class mcPlayerListener extends PlayerListener {
pt = 10;
}
String[] info = Leaderboard.retrieveInfo("powerlevel", p);
player.sendMessage("--MMO Power Level Leaderboard--");
player.sendMessage("--mcMMO Power Level Leaderboard--");
int n = 1 * pt; //Position
for(String x : info){
if(x != null){
@ -295,7 +291,7 @@ public class mcPlayerListener extends PlayerListener {
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
String[] info = Leaderboard.retrieveInfo(split[1].toLowerCase(), p);
player.sendMessage(ChatColor.YELLOW+"--MMO "+ChatColor.BLUE+capitalized+ChatColor.YELLOW+" Leaderboard--");
player.sendMessage(ChatColor.YELLOW+"--mcMMO "+ChatColor.BLUE+capitalized+ChatColor.YELLOW+" Leaderboard--");
int n = 1 * pt; //Position
for(String x : info){
if(x != null){
@ -400,7 +396,7 @@ public class mcPlayerListener extends PlayerListener {
}
}
if(mcPermissions.getInstance().mcAbility(player) && split[0].equalsIgnoreCase("/"+LoadProperties.mcrefresh)){
if(split[0].equalsIgnoreCase("/"+LoadProperties.mcrefresh)){
event.setCancelled(true);
if(!mcPermissions.getInstance().mcrefresh(player)){
player.sendMessage(ChatColor.YELLOW+"[MMO]"+ChatColor.DARK_RED +" Insufficient mcPermissions.");

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
@ -48,7 +49,7 @@ public class Axes {
}
}
public static void applyAoeDamage(Player attacker, EntityDamageByEntityEvent event){
public static void applyAoeDamage(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx){
int targets = 0;
Entity x = event.getEntity();
targets = m.getTier(attacker);
@ -70,6 +71,10 @@ public class Axes {
targets--;
}
if(derp instanceof Wolf){
Wolf hurrDurr = (Wolf)derp;
if(Taming.getOwner(hurrDurr, pluginx) == attacker)
continue;
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, pluginx)))
continue;
}
if(derp instanceof Animals && targets >= 1){

View File

@ -46,7 +46,7 @@ public class Herbalism {
removeSeeds(player);
if(block.getType() == Material.DIRT)
block.setType(Material.GRASS);
if(block.getType() == Material.COBBLESTONE)
if(LoadProperties.enableCobbleToMossy && block.getType() == Material.COBBLESTONE)
block.setType(Material.MOSSY_COBBLESTONE);
}
}

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Wolf;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.Combat;
import com.gmail.nossr50.Users;
@ -45,7 +46,7 @@ public class Swords {
}
}
}
public static void applySerratedStrikes(Player attacker, EntityDamageByEntityEvent event){
public static void applySerratedStrikes(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx){
int targets = 0;
Entity x = event.getEntity();
targets = m.getTier(attacker);
@ -70,6 +71,10 @@ public class Swords {
targets--;
}
if(derp instanceof Wolf){
Wolf hurrDurr = (Wolf)derp;
if(Taming.getOwner(hurrDurr, pluginx) == attacker)
continue;
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, pluginx)))
continue;
}
if(derp instanceof Animals && targets >= 1){

View File

@ -13,11 +13,11 @@ public class Unarmed {
public static void unarmedBonus(Player attacker, EntityDamageByEntityEvent event)
{
PlayerProfile PPa = Users.getProfile(attacker);
int bonus = 2;
int bonus = 0;
if (PPa.getUnarmedInt() >= 250)
bonus++;
bonus+=2;
if (PPa.getUnarmedInt() >= 500)
bonus++;
bonus+=2;
event.setDamage(event.getDamage()+bonus);
}
public static void disarmProcCheck(Player attacker, Player defender)

View File

@ -1,3 +1,3 @@
name: mcMMO
main: com.gmail.nossr50.mcMMO
version: 1.0
version: 1.0.02