Its 1.0.50 baby

This commit is contained in:
nossr50 2011-08-02 18:54:14 -07:00
parent ed1f176aaf
commit b13958d435
12 changed files with 224 additions and 92 deletions

View File

@ -1,9 +1,16 @@
Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
Version 1.0.50
/mcgod and /mmoedit now require permissions to be setup in some shape or form to be used
New /xprate command for those with mcmmo.admin permissions!
mcMMO now uses Spout instead of BukkitContrib
BukkitContrib support dropped
XP Formula is now 100+(skill level value * skill modifier * global modifier) thanks to suggestion
Fixed bug where /mmoupdate used the old directory instead of the new one to find the flat file
Fixed bug where Unarmed Mastery damage bonus only did as much as Unarmed Apprentice
Fixed bug where Pumpkins did not give out XP
Coordinates removed from /whois as they didn't really fit
/mcgod and /mmoedit now require permissions to be setup in some shape or form to be used
Lapus renamed to Lapis in config
Version 1.0.49
Updated German locale

View File

@ -15,7 +15,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
public class Item {
public static void itemhecks(Player player, Plugin plugin)
public static void itemchecks(Player player, Plugin plugin)
{
ItemStack inhand = player.getItemInHand();
if(LoadProperties.chimaeraWingEnable && inhand.getTypeId() == LoadProperties.chimaeraId)

View File

@ -7,7 +7,7 @@ public class LoadProperties
{
public static Boolean spoutEnabled, donateMessage, chimaeraWingEnable, xpGainsMobSpawners, myspawnEnable, mccEnable, mcmmoEnable, partyEnable, inviteEnable, acceptEnable, whoisEnable, statsEnable, addxpEnable, ptpEnable, mmoeditEnable, clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable, mcrefreshEnable, enableMotd, enableMySpawn, enableRegen, enableCobbleToMossy, useMySQL, cocoabeans, archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, eggs, apples, 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, mcgod, stats, mmoedit, ptp, party, myspawn, whois, invite, accept, clearmyspawn, nWood, nStone, nIron, nGold, nDiamond, locale;
public static int archeryLimit, chimaeraId, msandstone, mcocoa, water_thunder, cure_self, cure_other, mbones, msulphur, mslowsand, mmushroom2, mglowstone2, mmusic, mdiamond2, mbase, mapple, meggs, mcake, mpine, mbirch, mspruce, mcactus, mmushroom, mflower, msugar, mpumpkin, mwheat, mgold, mdiamond, miron, mredstone, mlapus, mobsidian, mnetherrack, mglowstone, mcoal, mstone, MySQLport, xpGainMultiplier, superBreakerCooldown = 240, greenTerraCooldown = 240, gigaDrillBreakerCooldown = 240, treeFellerCooldown = 240, berserkCooldown = 240, serratedStrikeCooldown = 240, skullSplitterCooldown = 240, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, sorceryxpmodifier = 2, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier, rWood, rStone, rIron, rGold, rDiamond;
public static int archeryLimit, chimaeraId, msandstone, mcocoa, water_thunder, cure_self, cure_other, mbones, msulphur, mslowsand, mmushroom2, mglowstone2, mmusic, mdiamond2, mbase, mapple, meggs, mcake, mpine, mbirch, mspruce, mcactus, mmushroom, mflower, msugar, mpumpkin, mwheat, mgold, mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack, mglowstone, mcoal, mstone, MySQLport, xpGainMultiplier, superBreakerCooldown = 240, greenTerraCooldown = 240, gigaDrillBreakerCooldown = 240, treeFellerCooldown = 240, berserkCooldown = 240, serratedStrikeCooldown = 240, skullSplitterCooldown = 240, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, sorceryxpmodifier = 2, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier, rWood, rStone, rIron, rGold, rDiamond;
public String directory = "plugins/mcMMO/";
File file = new File(directory + File.separator + "config.yml");
Configuration config = null;
@ -116,7 +116,7 @@ public class LoadProperties
write("XP.Mining.Diamond", 75);
write("XP.Mining.Iron", 25);
write("XP.Mining.Redstone", 15);
write("XP.Mining.Lapus", 40);
write("XP.Mining.lapis", 40);
write("XP.Mining.Obsidian", 15);
write("XP.Mining.Netherrack", 3);
write("XP.Mining.Glowstone", 3);
@ -265,7 +265,7 @@ public class LoadProperties
mdiamond = readInteger("XP.Mining.Diamond", 75);
miron = readInteger("XP.Mining.Iron", 25);
mredstone = readInteger("XP.Mining.Redstone", 15);
mlapus = readInteger("XP.Mining.Lapus", 40);
mlapis = readInteger("XP.Mining.lapis", 40);
mobsidian = readInteger("XP.Mining.Obsidian", 15);
mnetherrack = readInteger("XP.Mining.Netherrack", 3);
mglowstone = readInteger("XP.Mining.Glowstone", 3);

View File

@ -938,29 +938,29 @@ public class PlayerProfile
switch(skillType)
{
case SORCERY:
return ((skills.get(skillType) + 50) * LoadProperties.sorceryxpmodifier * LoadProperties.globalxpmodifier);
return 100+(skills.get(skillType) * LoadProperties.sorceryxpmodifier * LoadProperties.globalxpmodifier);
case TAMING:
return ((skills.get(skillType) + 50) * LoadProperties.tamingxpmodifier * LoadProperties.globalxpmodifier);
return 100+(skills.get(skillType) * LoadProperties.tamingxpmodifier * LoadProperties.globalxpmodifier);
case MINING:
return ((skills.get(skillType) + 50) * LoadProperties.miningxpmodifier * LoadProperties.globalxpmodifier);
return 100+(skills.get(skillType) * LoadProperties.miningxpmodifier * LoadProperties.globalxpmodifier);
case WOODCUTTING:
return ((skills.get(skillType) + 50) * LoadProperties.woodcuttingxpmodifier * LoadProperties.globalxpmodifier);
return 100+(skills.get(skillType) * LoadProperties.woodcuttingxpmodifier * LoadProperties.globalxpmodifier);
case REPAIR:
return ((skills.get(skillType) + 50) * LoadProperties.repairxpmodifier * LoadProperties.globalxpmodifier);
return 100+(skills.get(skillType) * LoadProperties.repairxpmodifier * LoadProperties.globalxpmodifier);
case HERBALISM:
return ((skills.get(skillType) + 50) * LoadProperties.herbalismxpmodifier * LoadProperties.globalxpmodifier);
return 100+(skills.get(skillType) * LoadProperties.herbalismxpmodifier * LoadProperties.globalxpmodifier);
case ACROBATICS:
return ((skills.get(skillType) + 50) * LoadProperties.acrobaticsxpmodifier * LoadProperties.globalxpmodifier);
return 100+(skills.get(skillType) * LoadProperties.acrobaticsxpmodifier * LoadProperties.globalxpmodifier);
case SWORDS:
return ((skills.get(skillType) + 50) * LoadProperties.swordsxpmodifier * LoadProperties.globalxpmodifier);
return 100+(skills.get(skillType) * LoadProperties.swordsxpmodifier * LoadProperties.globalxpmodifier);
case ARCHERY:
return ((skills.get(skillType) + 50) * LoadProperties.archeryxpmodifier * LoadProperties.globalxpmodifier);
return 100+(skills.get(skillType) * LoadProperties.archeryxpmodifier * LoadProperties.globalxpmodifier);
case UNARMED:
return ((skills.get(skillType) + 50) * LoadProperties.unarmedxpmodifier * LoadProperties.globalxpmodifier);
return 100+(skills.get(skillType) * LoadProperties.unarmedxpmodifier * LoadProperties.globalxpmodifier);
case EXCAVATION:
return ((skills.get(skillType) + 50) * LoadProperties.excavationxpmodifier * LoadProperties.globalxpmodifier);
return 100+(skills.get(skillType) * LoadProperties.excavationxpmodifier * LoadProperties.globalxpmodifier);
case AXES:
return ((skills.get(skillType) + 50) * LoadProperties.axesxpmodifier * LoadProperties.globalxpmodifier);
return 100+(skills.get(skillType) * LoadProperties.axesxpmodifier * LoadProperties.globalxpmodifier);
default:
return null;
}

View File

@ -50,7 +50,7 @@ public class mcBlockListener extends BlockListener {
{
if(block.getTypeId() != 17 && block.getTypeId() != 39 && block.getTypeId() != 40 && block.getTypeId() != 91 && block.getTypeId() != 86)
block.setData((byte) 5); //Change the byte
if(block.getTypeId() == 17 || block.getTypeId() == 39 || block.getTypeId() == 40 || block.getTypeId() == 91 || block.getTypeId() == 86)
else if(block.getTypeId() == 17 || block.getTypeId() == 39 || block.getTypeId() == 40 || block.getTypeId() == 91 || block.getTypeId() == 86)
plugin.misc.blockWatchList.add(block);
}
if(block.getTypeId() == 42 && LoadProperties.anvilmessages)

View File

@ -103,6 +103,8 @@ public class mcPlayerListener extends PlayerListener
//player.sendMessage(ChatColor.GREEN+"http://mcmmo.wikia.com"+ChatColor.BLUE+" - mcMMO Wiki");
player.sendMessage(mcLocale.getString("mcPlayerListener.WIKI"));
}
if(plugin.xpevent)
player.sendMessage(ChatColor.GOLD+"mcMMO is currently in an XP rate event! XP rate is "+LoadProperties.xpGainMultiplier+"x!");
}
@SuppressWarnings("deprecation")
@ -203,11 +205,11 @@ public class mcPlayerListener extends PlayerListener
* ITEM CHECKS
*/
if(action == Action.RIGHT_CLICK_AIR)
Item.itemhecks(player, plugin);
Item.itemchecks(player, plugin);
if(action == Action.RIGHT_CLICK_BLOCK)
{
if(m.abilityBlockCheck(event.getClickedBlock()))
Item.itemhecks(player, plugin);
Item.itemchecks(player, plugin);
}
}

View File

@ -230,7 +230,8 @@ public class m
return health-newvalue;
}
}
public static boolean isInt(String string){
public static boolean isInt(String string)
{
try
{
Integer.parseInt(string);
@ -301,7 +302,7 @@ public class m
{
if(!LoadProperties.useMySQL)
return;
String location = "plugins/mcMMO/mcmmo.users";
String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
try {
//Open the user file
FileReader file = new FileReader(location);

View File

@ -12,6 +12,7 @@ import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.skills.*;
import com.nijikokun.bukkit.Permissions.Permissions;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
@ -68,6 +69,8 @@ public class mcMMO extends JavaPlugin
private final mcPlayerListener playerListener = new mcPlayerListener(this);
private final mcBlockListener blockListener = new mcBlockListener(this);
private final mcEntityListener entityListener = new mcEntityListener(this);
public boolean xpevent = false;
int oldrate = 1;
public static mcPermissions permissionHandler = new mcPermissions();
private Permissions permissions;
@ -715,7 +718,105 @@ public class mcMMO extends JavaPlugin
PP.toggleAbilityUse();
}
}
else if (label.equalsIgnoreCase("xprate"))
{
//TODO: Localization.. I know me so lazy today, I'll do it tomorrow
if(sender instanceof Player)
{
if(!mcPermissions.getInstance().admin(player))
{
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if(split.length <= 1)
{
player.sendMessage(ChatColor.DARK_AQUA+"Proper usage is /xprate [integer] [true:false]");
player.sendMessage(ChatColor.DARK_AQUA+"Also you can type /xprate reset to turn everything back to normal");
}
if(split.length == 2 && split[1].equalsIgnoreCase("reset"))
{
if(xpevent)
{
for(Player x : Bukkit.getServer().getOnlinePlayers())
x.sendMessage(ChatColor.RED+"mcMMO XP Event is OVER!!");
xpevent = !xpevent;
LoadProperties.xpGainMultiplier = oldrate;
} else
{
LoadProperties.xpGainMultiplier = oldrate;
}
}
if(split.length >= 2 && m.isInt(split[1]))
{
oldrate = LoadProperties.xpGainMultiplier;
if(split.length >= 3 && (split[2].equalsIgnoreCase("true") || split[2].equalsIgnoreCase("false")))
{
if(split[2].equalsIgnoreCase("true"))
xpevent = true;
else
xpevent = false;
} else
{
player.sendMessage("Enter true or false for the second value");
return true;
}
LoadProperties.xpGainMultiplier = m.getInt(split[1]);
if(xpevent = true)
for(Player x : Bukkit.getServer().getOnlinePlayers())
{
x.sendMessage(ChatColor.GOLD+"XP EVENT FOR mcMMO HAS STARTED!");
x.sendMessage(ChatColor.GOLD+"mcMMO XP RATE IS NOW "+LoadProperties.xpGainMultiplier+"x!!");
}
}
} else
{
if(split.length <= 1)
{
System.out.println(ChatColor.DARK_AQUA+"Proper usage is /xprate [integer] [true:false]");
System.out.println(ChatColor.DARK_AQUA+"Also you can type /xprate reset to turn everything back to normal");
}
if(split.length == 2 && split[1].equalsIgnoreCase("reset"))
{
if(xpevent)
{
for(Player x : Bukkit.getServer().getOnlinePlayers())
x.sendMessage(ChatColor.RED+"mcMMO XP Event is OVER!!");
xpevent = !xpevent;
LoadProperties.xpGainMultiplier = oldrate;
} else
{
LoadProperties.xpGainMultiplier = oldrate;
}
}
if(split.length >= 2 && m.isInt(split[1]))
{
oldrate = LoadProperties.xpGainMultiplier;
if(split.length >= 3 && (split[2].equalsIgnoreCase("true") || split[2].equalsIgnoreCase("false")))
{
if(split[2].equalsIgnoreCase("true"))
xpevent = true;
else
xpevent = false;
} else
{
System.out.println("Enter true or false for the second value");
return true;
}
LoadProperties.xpGainMultiplier = m.getInt(split[1]);
if(xpevent = true)
for(Player x : Bukkit.getServer().getOnlinePlayers())
{
x.sendMessage(ChatColor.GOLD+"XP EVENT FOR mcMMO HAS STARTED!");
x.sendMessage(ChatColor.GOLD+"mcMMO XP RATE IS NOW "+LoadProperties.xpGainMultiplier+"x!!");
}
}
}
}
/*
* FFS -> MySQL
*/
@ -1101,10 +1202,7 @@ public class mcMMO extends JavaPlugin
{
Player target = getPlayer(split[1]);
PlayerProfile PPt = Users.getProfile(target);
double x,y,z;
x = target.getLocation().getX();
y = target.getLocation().getY();
z = target.getLocation().getZ();
player.sendMessage(ChatColor.GREEN + "~~WHOIS RESULTS~~");
player.sendMessage(target.getName());
if(PPt.inParty())
@ -1144,11 +1242,6 @@ public class mcMMO extends JavaPlugin
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillLevel(SkillType.REPAIR), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getXpToLevel(SkillType.REPAIR)));
player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") +ChatColor.GREEN+(m.getPowerLevel(target)));
player.sendMessage(ChatColor.GREEN+"~~COORDINATES~~");
player.sendMessage("X: "+x);
player.sendMessage("Y: "+y);
player.sendMessage("Z: "+z);
}
}
/*

View File

@ -131,17 +131,21 @@ public class Herbalism {
{
return;
}
if(type == 59 && block.getData() == (byte) 0x7){
if(type == 59 && block.getData() == (byte) 0x7)
{
mat = Material.getMaterial(296);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat * LoadProperties.xpGainMultiplier);
if(player != null){
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)){
if(player != null)
{
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM))
{
loc.getWorld().dropItemNaturally(loc, is);
}
}
//GREEN THUMB
if(Math.random() * 1500 <= PP.getSkillLevel(SkillType.HERBALISM)){
if(Math.random() * 1500 <= PP.getSkillLevel(SkillType.HERBALISM))
{
event.setCancelled(true);
loc.getWorld().dropItemNaturally(loc, is);
//DROP SOME SEEDS
@ -172,7 +176,8 @@ public class Herbalism {
/*
* We need to check not-wheat stuff for if it was placed by the player or not
*/
if(block.getData() != (byte) 5){
if(block.getData() != (byte) 5)
{
//Cactus
if(type == 81){
//Setup the loop
@ -211,7 +216,8 @@ public class Herbalism {
}
}
//Sugar Canes
if(type == 83){
if(type == 83)
{
//Setup the loop
World world = block.getWorld();
Block[] blockArray = new Block[3];
@ -250,23 +256,28 @@ public class Herbalism {
}
//Pumpkins
if((type == 91 || type == 86) && plugin.misc.blockWatchList.contains(block))
if((type == 91 || type == 86))
{
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)){
if(player != null)
{
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM))
{
loc.getWorld().dropItemNaturally(loc, is);
}
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mpumpkin * LoadProperties.xpGainMultiplier);
}
//Mushroom
if(type == 39 || type == 40){
if(type == 39 || type == 40)
{
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)){
if(player != null)
{
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM))
{
loc.getWorld().dropItemNaturally(loc, is);
}
}
@ -286,52 +297,68 @@ public class Herbalism {
}
Skills.XpCheckSkill(SkillType.HERBALISM, player);
}
public static void breadCheck(Player player, ItemStack is){
public static void breadCheck(Player player, ItemStack is)
{
PlayerProfile PP = Users.getProfile(player);
int herbalism = PP.getSkillLevel(SkillType.HERBALISM);
if(is != null && PP != null)
{
if(is.getTypeId() == 297)
{
if(herbalism >= 50 && herbalism < 150){
if(herbalism >= 50 && herbalism < 150)
{
player.setHealth(player.getHealth() + 1);
} else if (herbalism >= 150 && herbalism < 250){
} else if (herbalism >= 150 && herbalism < 250)
{
player.setHealth(player.getHealth() + 2);
} else if (herbalism >= 250 && herbalism < 350){
} else if (herbalism >= 250 && herbalism < 350)
{
player.setHealth(player.getHealth() + 3);
} else if (herbalism >= 350 && herbalism < 450){
} else if (herbalism >= 350 && herbalism < 450)
{
player.setHealth(player.getHealth() + 4);
} else if (herbalism >= 450 && herbalism < 550){
} else if (herbalism >= 450 && herbalism < 550)
{
player.setHealth(player.getHealth() + 5);
} else if (herbalism >= 550 && herbalism < 650){
} else if (herbalism >= 550 && herbalism < 650)
{
player.setHealth(player.getHealth() + 6);
} else if (herbalism >= 650 && herbalism < 750){
} else if (herbalism >= 650 && herbalism < 750)
{
player.setHealth(player.getHealth() + 7);
} else if (herbalism >= 750){
} else if (herbalism >= 750)
{
player.setHealth(player.getHealth() + 8);
}
}
}
}
public static void stewCheck(Player player, ItemStack is){
public static void stewCheck(Player player, ItemStack is)
{
PlayerProfile PP = Users.getProfile(player);
int herbalism = PP.getSkillLevel(SkillType.HERBALISM);
if(is.getTypeId() == 282){
if(herbalism >= 50 && herbalism < 150){
if(is.getTypeId() == 282)
{
if(herbalism >= 50 && herbalism < 150)
{
player.setHealth(player.getHealth() + 1);
} else if (herbalism >= 150 && herbalism < 250){
} else if (herbalism >= 150 && herbalism < 250)
{
player.setHealth(player.getHealth() + 2);
} else if (herbalism >= 250 && herbalism < 350){
} else if (herbalism >= 250 && herbalism < 350)
{
player.setHealth(player.getHealth() + 3);
} else if (herbalism >= 350 && herbalism < 450){
} else if (herbalism >= 350 && herbalism < 450)
{
player.setHealth(player.getHealth() + 4);
} else if (herbalism >= 450 && herbalism < 550){
} else if (herbalism >= 450 && herbalism < 550)
{
player.setHealth(player.getHealth() + 5);
} else if (herbalism >= 550 && herbalism < 650){
} else if (herbalism >= 550 && herbalism < 650)
{
player.setHealth(player.getHealth() + 6);
} else if (herbalism >= 650 && herbalism < 750){
} else if (herbalism >= 650 && herbalism < 750)
{
player.setHealth(player.getHealth() + 7);
} else if (herbalism >= 750){
} else if (herbalism >= 750)
{
player.setHealth(player.getHealth() + 8);
}
}

View File

@ -283,7 +283,7 @@ public class Mining
//LAPUS
if(block.getTypeId() == 21)
{
xp += LoadProperties.mlapus;
xp += LoadProperties.mlapis;
if(smelt = false)
blockProcCheck(block, player);
else
@ -461,7 +461,7 @@ public class Mining
//LAPUS
if(block.getTypeId() == 21 && m.getTier(player) >= 3){
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
xp += LoadProperties.mlapus;
xp += LoadProperties.mlapis;
blockProcCheck(block, player);
blockProcCheck(block, player);
}

View File

@ -46,7 +46,7 @@ public class Unarmed {
if (PPa.getSkillLevel(SkillType.UNARMED) >= 250)
bonus+=2;
if (PPa.getSkillLevel(SkillType.UNARMED) >= 500)
bonus+=2;
bonus+=4;
event.setDamage(event.getDamage()+bonus);
}
public static void disarmProcCheck(Player attacker, Player defender)

View File

@ -1,7 +1,9 @@
name: mcMMO
main: com.gmail.nossr50.mcMMO
version: 1.0.50 WIP
version: 1.0.50
commands:
xprate:
description: Modify the xp rate or start an event
mcc:
description: Lists mcMMO commands
mcmmo: