Merge git://github.com/nossr50/mcMMO

This commit is contained in:
mcmmoPolish 2011-08-03 12:14:44 +02:00
commit faef5738e7
14 changed files with 294 additions and 158 deletions

View File

@ -1,5 +1,17 @@
Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
Version 1.0.50
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
Fixed bug where using the party system on a MySQL setup caused errors when writing to non-existent files

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

@ -5,9 +5,9 @@ import org.bukkit.util.config.Configuration;
public class LoadProperties
{
public static Boolean contribEnabled, 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 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

@ -4,29 +4,28 @@ import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkitcontrib.BukkitContrib;
import org.bukkitcontrib.player.ContribCraftPlayer;
import org.bukkitcontrib.player.ContribPlayer;
import org.bukkitcontrib.sound.SoundEffect;
import org.bukkitcontrib.sound.SoundManager;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.player.SpoutPlayer;
import org.getspout.spoutapi.sound.SoundEffect;
import org.getspout.spoutapi.sound.SoundManager;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
public class contribStuff
public class SpoutStuff
{
public static void playSoundForPlayer(SoundEffect effect, Player player, Location location)
{
//Contrib stuff
ContribPlayer cPlayer = ContribCraftPlayer.getContribPlayer(player);
SoundManager SM = BukkitContrib.getSoundManager();
SM.playSoundEffect(cPlayer, effect, location);
SoundManager SM = SpoutManager.getSoundManager();
SpoutPlayer sPlayer = (SpoutPlayer)player;
SM.playSoundEffect(sPlayer, effect, location);
}
public static void levelUpNotification(SkillType skillType, ContribPlayer cPlayer)
public static void levelUpNotification(SkillType skillType, SpoutPlayer sPlayer)
{
PlayerProfile PP = Users.getProfile(cPlayer);
PlayerProfile PP = Users.getProfile(sPlayer);
Material mat = null;
switch(skillType)
@ -241,7 +240,7 @@ public class contribStuff
mat = Material.WATCH;
break;
}
cPlayer.sendNotification(ChatColor.GREEN+"Level Up!", ChatColor.YELLOW+m.getCapitalized(skillType.toString())+ChatColor.DARK_AQUA+" ("+ChatColor.GREEN+PP.getSkillLevel(skillType)+ChatColor.DARK_AQUA+")", mat);
sPlayer.sendNotification(ChatColor.GREEN+"Level Up!", ChatColor.YELLOW+m.getCapitalized(skillType.toString())+ChatColor.DARK_AQUA+" ("+ChatColor.GREEN+PP.getSkillLevel(skillType)+ChatColor.DARK_AQUA+")", mat);
}
public static Integer getNotificationTier(Integer level)

View File

@ -289,7 +289,8 @@ public class PlayerProfile
{
Long timestamp = System.currentTimeMillis()/1000; //Convert to seconds
// if we are using mysql save to database
if (LoadProperties.useMySQL) {
if (LoadProperties.useMySQL)
{
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET lastlogin = " + timestamp.intValue() + " WHERE id = " + this.userid);
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET party = '"+this.party+"' WHERE id = " +this.userid);
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"spawn SET world = '" + this.myspawnworld + "', x = " +getX()+", y = "+getY()+", z = "+getZ()+" WHERE user_id = "+this.userid);
@ -329,7 +330,8 @@ public class PlayerProfile
+", acrobatics = "+skillsXp.get(SkillType.ACROBATICS)
+" WHERE user_id = "+this.userid);
} else {
} else
{
// otherwise save to flatfile
try {
//Open the file
@ -936,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

@ -5,10 +5,9 @@ import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.contrib.contribStuff;
import com.gmail.nossr50.contrib.SpoutStuff;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import org.bukkit.Material;
import org.bukkit.Statistic;
import org.bukkit.block.Block;
@ -19,9 +18,8 @@ import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkitcontrib.player.ContribCraftPlayer;
import org.bukkitcontrib.player.ContribPlayer;
import org.bukkitcontrib.sound.SoundEffect;
import org.getspout.spoutapi.player.SpoutPlayer;
import org.getspout.spoutapi.sound.SoundEffect;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.*;
@ -52,31 +50,31 @@ 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)
{
PlayerProfile PP = Users.getProfile(player);
if(LoadProperties.contribEnabled)
if(LoadProperties.spoutEnabled)
{
ContribPlayer cPlayer = ContribCraftPlayer.getContribPlayer(player);
if(cPlayer.isBukkitContribEnabled())
SpoutPlayer sPlayer = (SpoutPlayer)player;
if(sPlayer.isSpoutCraftEnabled())
{
if(!PP.getPlacedAnvil())
{
cPlayer.sendNotification("[mcMMO] Anvil Placed", "Right click to repair!", Material.IRON_BLOCK);
sPlayer.sendNotification("[mcMMO] Anvil Placed", "Right click to repair!", Material.IRON_BLOCK);
PP.togglePlacedAnvil();
}
}
else
{
if(!PP.getPlacedAnvil())
{
event.getPlayer().sendMessage(mcLocale.getString("mcBlockListener.PlacedAnvil")); //$NON-NLS-1$
PP.togglePlacedAnvil();
}
}
else
{
if(!PP.getPlacedAnvil())
{
event.getPlayer().sendMessage(mcLocale.getString("mcBlockListener.PlacedAnvil")); //$NON-NLS-1$
PP.togglePlacedAnvil();
}
}
}
else
{
@ -189,19 +187,21 @@ public class mcBlockListener extends BlockListener {
&& block.getTypeId() == 17
&& m.blockBreakSimulate(block, player, plugin))
{
if(LoadProperties.contribEnabled)
contribStuff.playSoundForPlayer(SoundEffect.EXPLODE, player, block.getLocation());
if(LoadProperties.spoutEnabled)
SpoutStuff.playSoundForPlayer(SoundEffect.EXPLODE, player, block.getLocation());
WoodCutting.treeFeller(block, player, plugin);
for(Block blockx : plugin.misc.treeFeller)
{
if(blockx != null){
if(blockx != null)
{
Material mat = Material.getMaterial(block.getTypeId());
byte type = 0;
if(block.getTypeId() == 17)
type = block.getData();
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
if(blockx.getTypeId() == 17){
if(blockx.getTypeId() == 17)
{
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
//XP WOODCUTTING
if(!plugin.misc.blockWatchList.contains(block))
@ -316,8 +316,8 @@ public class mcBlockListener extends BlockListener {
/*
* TREE FELLAN STUFF
*/
if(LoadProperties.contribEnabled && block.getTypeId() == 17 && Users.getProfile(player).getTreeFellerMode())
contribStuff.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
if(LoadProperties.spoutEnabled && block.getTypeId() == 17 && Users.getProfile(player).getTreeFellerMode())
SpoutStuff.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
/*
* GREEN TERRA STUFF
@ -353,8 +353,8 @@ public class mcBlockListener extends BlockListener {
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
//Contrib stuff
if(LoadProperties.contribEnabled)
contribStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
if(LoadProperties.spoutEnabled)
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
/*
* BERSERK MODE CHECKS
@ -375,8 +375,8 @@ public class mcBlockListener extends BlockListener {
block.setType(Material.AIR);
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
if(LoadProperties.contribEnabled)
contribStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
if(LoadProperties.spoutEnabled)
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
/*
@ -409,8 +409,8 @@ public class mcBlockListener extends BlockListener {
}
block.setType(Material.AIR);
player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType());
if(LoadProperties.contribEnabled)
contribStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
if(LoadProperties.spoutEnabled)
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
}
if(block.getType() == Material.AIR && plugin.misc.blockWatchList.contains(block))
{

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;
@ -44,8 +45,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.entity.Player;
import org.bukkitcontrib.player.ContribCraftPlayer;
import org.bukkitcontrib.player.ContribPlayer;
import org.getspout.spoutapi.player.SpoutPlayer;
public class mcMMO extends JavaPlugin
@ -69,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;
@ -118,10 +120,10 @@ public class mcMMO extends JavaPlugin
PluginManager pm = getServer().getPluginManager();
if(pm.getPlugin("BukkitContrib") != null)
LoadProperties.contribEnabled = true;
if(pm.getPlugin("Spout") != null)
LoadProperties.spoutEnabled = true;
else
LoadProperties.contribEnabled = false;
LoadProperties.spoutEnabled = false;
//Player Stuff
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
@ -658,11 +660,11 @@ public class mcMMO extends JavaPlugin
{
player.sendMessage(x);
}
if(LoadProperties.contribEnabled)
if(LoadProperties.spoutEnabled && player instanceof SpoutPlayer)
{
ContribPlayer cPlayer = ContribCraftPlayer.getContribPlayer(player);
SpoutPlayer sPlayer = (SpoutPlayer)player;
if(LoadProperties.donateMessage)
cPlayer.sendNotification("[mcMMO] Donate!", "Paypal nossr50@gmail.com", Material.CAKE);
sPlayer.sendNotification("[mcMMO] Donate!", "Paypal nossr50@gmail.com", Material.CAKE);
}
else
{
@ -716,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
*/
@ -724,7 +824,7 @@ public class mcMMO extends JavaPlugin
{
if(!mcPermissions.getInstance().admin(player))
{
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
player.sendMessage(ChatColor.GRAY+"Starting conversion...");
@ -916,7 +1016,7 @@ public class mcMMO extends JavaPlugin
else if(LoadProperties.mcrefreshEnable && label.equalsIgnoreCase(LoadProperties.mcrefresh)){
if(!mcPermissions.getInstance().mcrefresh(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if(split.length >= 2 && isPlayer(split[1])){
@ -976,7 +1076,7 @@ public class mcMMO extends JavaPlugin
{
if(!mcPermissions.getInstance().mcgod(player))
{
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if(PP.getGodMode())
@ -1004,7 +1104,7 @@ public class mcMMO extends JavaPlugin
if(!mcPermissions.getInstance().mmoedit(player))
{
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if(split.length < 3)
@ -1040,7 +1140,7 @@ public class mcMMO extends JavaPlugin
else if(LoadProperties.addxpEnable && mcPermissions.permissionsEnabled && label.equalsIgnoreCase(LoadProperties.addxp)){
if(!mcPermissions.getInstance().mmoedit(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if(split.length < 3){
@ -1069,7 +1169,7 @@ public class mcMMO extends JavaPlugin
else if(LoadProperties.ptpEnable && label.equalsIgnoreCase(LoadProperties.ptp) && PP != null && PP.inParty()){
if(!mcPermissions.getInstance().partyTeleport(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if(split.length < 2){
@ -1102,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())
@ -1145,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);
}
}
/*
@ -1257,7 +1349,7 @@ public class mcMMO extends JavaPlugin
{
if(!mcPermissions.getInstance().party(player))
{
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
@ -1484,7 +1576,7 @@ public class mcMMO extends JavaPlugin
}
if(!mcPermissions.getInstance().party(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
@ -1550,7 +1642,7 @@ public class mcMMO extends JavaPlugin
}
if(!mcPermissions.getInstance().adminChat(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
@ -1593,7 +1685,7 @@ public class mcMMO extends JavaPlugin
*/
else if(LoadProperties.myspawnEnable && LoadProperties.enableMySpawn && label.equalsIgnoreCase(LoadProperties.myspawn)){
if(!mcPermissions.getInstance().mySpawn(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if(System.currentTimeMillis() < PP.getMySpawnATS() + 3600000){

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){
player.setHealth(player.getHealth() + 1);
} else if (herbalism >= 150 && herbalism < 250){
player.setHealth(player.getHealth() + 2);
} else if (herbalism >= 250 && herbalism < 350){
player.setHealth(player.getHealth() + 3);
} else if (herbalism >= 350 && herbalism < 450){
player.setHealth(player.getHealth() + 4);
} else if (herbalism >= 450 && herbalism < 550){
player.setHealth(player.getHealth() + 5);
} else if (herbalism >= 550 && herbalism < 650){
player.setHealth(player.getHealth() + 6);
} else if (herbalism >= 650 && herbalism < 750){
player.setHealth(player.getHealth() + 7);
} else if (herbalism >= 750){
player.setHealth(player.getHealth() + 8);
}
}
}
if(is.getTypeId() == 297)
{
if(herbalism >= 50 && herbalism < 150)
{
player.setHealth(player.getHealth() + 1);
} else if (herbalism >= 150 && herbalism < 250)
{
player.setHealth(player.getHealth() + 2);
} else if (herbalism >= 250 && herbalism < 350)
{
player.setHealth(player.getHealth() + 3);
} else if (herbalism >= 350 && herbalism < 450)
{
player.setHealth(player.getHealth() + 4);
} else if (herbalism >= 450 && herbalism < 550)
{
player.setHealth(player.getHealth() + 5);
} else if (herbalism >= 550 && herbalism < 650)
{
player.setHealth(player.getHealth() + 6);
} else if (herbalism >= 650 && herbalism < 750)
{
player.setHealth(player.getHealth() + 7);
} 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

@ -7,13 +7,13 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.bukkitcontrib.sound.SoundEffect;
import org.getspout.spoutapi.sound.SoundEffect;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.contrib.contribStuff;
import com.gmail.nossr50.contrib.SpoutStuff;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
@ -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);
}
@ -476,8 +476,8 @@ public class Mining
}
if(block.getData() != (byte) 5)
PP.addXP(SkillType.MINING, xp * LoadProperties.xpGainMultiplier);
if(LoadProperties.contribEnabled)
contribStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
if(LoadProperties.spoutEnabled)
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
Skills.XpCheckSkill(SkillType.MINING, player);
}

View File

@ -6,8 +6,8 @@ import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkitcontrib.player.ContribCraftPlayer;
import org.bukkitcontrib.player.ContribPlayer;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.Leaderboard;
import com.gmail.nossr50.Users;
@ -15,7 +15,7 @@ import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.contrib.contribStuff;
import com.gmail.nossr50.contrib.SpoutStuff;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.PlayerStat;
import com.gmail.nossr50.datatypes.SkillType;
@ -309,12 +309,12 @@ public class Skills {
//Contrib stuff
if(LoadProperties.contribEnabled)
if(LoadProperties.spoutEnabled && player instanceof SpoutPlayer)
{
ContribPlayer cPlayer = ContribCraftPlayer.getContribPlayer(player);
if(cPlayer.isBukkitContribEnabled())
SpoutPlayer sPlayer = SpoutManager.getPlayerFromId(player.getEntityId());
if(sPlayer.isSpoutCraftEnabled())
{
contribStuff.levelUpNotification(skillType, cPlayer);
SpoutStuff.levelUpNotification(skillType, sPlayer);
} else
{
player.sendMessage(mcLocale.getString("Skills."+capitalized+"Up", new Object[] {String.valueOf(skillups), PP.getSkillLevel(skillType)}));

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.49
version: 1.0.50
commands:
xprate:
description: Modify the xp rate or start an event
mcc:
description: Lists mcMMO commands
mcmmo:
@ -76,8 +78,6 @@ commands:
a:
description: Toggle Admin chat or send admin chat messages
permission: mcmmo.chat.adminchat
sorcery:
description: Detailed skill info
permissions:
mcmmo.*:
description: Implies all mcmmo permissions.
@ -90,7 +90,7 @@ permissions:
mcmmo.defaults:
default: true
description: mcmmo permisionss that default to true
description: mcmmo permisions that default to true
children:
mcmmo.ability.*: true
mcmmo.item.*: true
@ -100,13 +100,14 @@ permissions:
mcmmo.commands.*: true
mcmmo.chat.partychat: true
mcmmo.skills.*: true
mcmmo.tools.*: false
mcmmo.defaultsop:
default: op
description: mcmmo permissions that default to op
children:
mcmmo.admin: false
mcmmo.tools.*: true
mcmmo.tools.*: false
mcmmo.chat.adminchat: true
mcmmo.admin: