All changes up to 0.9.1

This commit is contained in:
nossr50 2011-03-17 18:21:18 -07:00
parent 8a5560b711
commit 7f3fe1888d
11 changed files with 68 additions and 11 deletions

View File

@ -1,5 +1,12 @@
Changelog: 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 0.9.1
Fixed "Unknown console command" errors with CB 556
Added /mcability command to toggle being able to trigger abilities with right click
Added some more nullchecks for people reporting NPE errors
Compatibility with NPC mods improved (Mainly for archery!)
Other plugins can now call inSameParty() from mcMMO to increase compatibility
Version 0.9 Version 0.9
--NEW CONTENT-- --NEW CONTENT--
Woodcutting now has the "Tree Feller" Ability Woodcutting now has the "Tree Feller" Ability

View File

@ -22,7 +22,7 @@ public class mcBlockListener extends BlockListener {
public void onBlockPlace(BlockPlaceEvent event) { public void onBlockPlace(BlockPlaceEvent event) {
Block block; Block block;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (event.getBlockReplacedState().getTypeId() == 78) { if (event.getBlock() != null && event.getBlockReplacedState() != null && event.getBlockReplacedState().getTypeId() == 78) {
block = event.getBlockAgainst(); block = event.getBlockAgainst();
} }
else { else {

View File

@ -287,14 +287,16 @@ public class mcCombat {
Entity x = event.getEntity(); Entity x = event.getEntity();
if(x instanceof Player){ if(x instanceof Player){
Player defender = (Player)x; Player defender = (Player)x;
if(mcUsers.getProfile(defender) == null)
mcUsers.addUser(defender);
if(mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getTypeId() == 0){ if(mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getTypeId() == 0){
if(mcUsers.getProfile(defender).getUnarmedInt() >= 1000){ if(defender != null && mcUsers.getProfile(defender).getUnarmedInt() >= 1000){
if(Math.random() * 1000 <= 500){ if(Math.random() * 1000 <= 500){
event.setCancelled(true); event.setCancelled(true);
defender.sendMessage(ChatColor.WHITE+"**ARROW DEFLECT**"); defender.sendMessage(ChatColor.WHITE+"**ARROW DEFLECT**");
return; return;
} }
} else if(Math.random() * 1000 <= (mcUsers.getProfile(defender).getUnarmedInt() / 2)){ } else if(defender != null && Math.random() * 1000 <= (mcUsers.getProfile(defender).getUnarmedInt() / 2)){
event.setCancelled(true); event.setCancelled(true);
defender.sendMessage(ChatColor.WHITE+"**ARROW DEFLECT**"); defender.sendMessage(ChatColor.WHITE+"**ARROW DEFLECT**");
return; return;

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50;
public class mcLoadProperties { public class mcLoadProperties {
public static Boolean pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages; public static Boolean pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
public static String mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn; public static String mcability, mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
public static int feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier; public static int feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
public static void loadMain(){ public static void loadMain(){
@ -57,6 +57,7 @@ public class mcLoadProperties {
/* /*
* CUSTOM COMMANDS * CUSTOM COMMANDS
*/ */
mcability = properties.getString("/mcability", "mcability");
mcrefresh = properties.getString("/mcrefresh", "mcrefresh"); mcrefresh = properties.getString("/mcrefresh", "mcrefresh");
mcitem = properties.getString("/mcitem", "mcitem"); mcitem = properties.getString("/mcitem", "mcitem");
mcmmo = properties.getString("/mcmmo", "mcmmo"); mcmmo = properties.getString("/mcmmo", "mcmmo");

View File

@ -102,6 +102,17 @@ public class mcMMO extends JavaPlugin {
return false; return false;
} }
} }
public boolean inSameParty(Player playera, Player playerb){
if(mcUsers.getProfile(playera).inParty() && mcUsers.getProfile(playerb).inParty()){
if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){
return true;
} else {
return false;
}
} else {
return false;
}
}
public boolean isAdminChatToggled(Player player){ public boolean isAdminChatToggled(Player player){
if(mcConfig.getInstance().isAdminToggled(player.getName())){ if(mcConfig.getInstance().isAdminToggled(player.getName())){
return true; return true;

View File

@ -16,6 +16,10 @@ public class mcParty {
return instance; return instance;
} }
public boolean inSameParty(Player playera, Player playerb){ public boolean inSameParty(Player playera, Player playerb){
if(mcUsers.getProfile(playera) == null || mcUsers.getProfile(playerb) == null){
mcUsers.addUser(playera);
mcUsers.addUser(playerb);
}
if(mcUsers.getProfile(playera).inParty() && mcUsers.getProfile(playerb).inParty()){ if(mcUsers.getProfile(playera).inParty() && mcUsers.getProfile(playerb).inParty()){
if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){ if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){
return true; return true;

View File

@ -114,6 +114,13 @@ public class mcPermissions {
return true; return true;
} }
} }
public boolean mcAbility(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.commands.ability");
} else {
return true;
}
}
public boolean mySpawn(Player player) { public boolean mySpawn(Player player) {
if (permissionsEnabled) { if (permissionsEnabled) {
return permission(player, "mcmmo.commands.myspawn"); return permission(player, "mcmmo.commands.myspawn");

View File

@ -92,7 +92,17 @@ public class mcPlayerListener extends PlayerListener {
String playerName = player.getName(); String playerName = player.getName();
//Check if the command is an mcMMO related help command //Check if the command is an mcMMO related help command
mcm.getInstance().mcmmoHelpCheck(split, player, event); mcm.getInstance().mcmmoHelpCheck(split, player, event);
if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mcrefresh)){ if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mcability)){
event.setCancelled(true);
if(mcUsers.getProfile(player).getAbilityUse()){
player.sendMessage("Ability use toggled off");
mcUsers.getProfile(player).toggleAbilityUse();
} else {
player.sendMessage("Ability use toggled on");
mcUsers.getProfile(player).toggleAbilityUse();
}
}
if(mcPermissions.getInstance().mcAbility(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.mcrefresh)){
event.setCancelled(true); event.setCancelled(true);
if(!mcPermissions.getInstance().mcrefresh(player)){ if(!mcPermissions.getInstance().mcrefresh(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
@ -170,6 +180,7 @@ public class mcPlayerListener extends PlayerListener {
player.sendMessage(ChatColor.DARK_AQUA+"Myspawn is now cleared."); player.sendMessage(ChatColor.DARK_AQUA+"Myspawn is now cleared.");
} }
if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mmoedit)){ if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mmoedit)){
event.setCancelled(true);
if(!mcPermissions.getInstance().mmoedit(player)){ if(!mcPermissions.getInstance().mmoedit(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return; return;
@ -302,6 +313,7 @@ public class mcPlayerListener extends PlayerListener {
* SETMYSPAWN COMMAND * SETMYSPAWN COMMAND
*/ */
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.setmyspawn)){ if(split[0].equalsIgnoreCase("/"+mcLoadProperties.setmyspawn)){
event.setCancelled(true);
if(!mcPermissions.getInstance().setMySpawn(player)){ if(!mcPermissions.getInstance().setMySpawn(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return; return;
@ -310,7 +322,6 @@ public class mcPlayerListener extends PlayerListener {
player.sendMessage("You have set "+split[1]+"'s spawn!"); player.sendMessage("You have set "+split[1]+"'s spawn!");
player = getPlayer(split[1]); player = getPlayer(split[1]);
} }
event.setCancelled(true);
double x = player.getLocation().getX(); double x = player.getLocation().getX();
double y = player.getLocation().getY(); double y = player.getLocation().getY();
double z = player.getLocation().getZ(); double z = player.getLocation().getZ();
@ -381,6 +392,7 @@ public class mcPlayerListener extends PlayerListener {
} }
//Invite Command //Invite Command
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.invite)){ if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.invite)){
event.setCancelled(true);
if(!mcUsers.getProfile(player).inParty()){ if(!mcUsers.getProfile(player).inParty()){
player.sendMessage(ChatColor.RED+"You are not in a party."); player.sendMessage(ChatColor.RED+"You are not in a party.");
return; return;
@ -399,6 +411,7 @@ public class mcPlayerListener extends PlayerListener {
} }
//Accept invite //Accept invite
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.accept)){ if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.accept)){
event.setCancelled(true);
if(mcUsers.getProfile(player).hasPartyInvite()){ if(mcUsers.getProfile(player).hasPartyInvite()){
if(mcUsers.getProfile(player).inParty()){ if(mcUsers.getProfile(player).inParty()){
mcParty.getInstance().informPartyMembersQuit(player, getPlayersOnline()); mcParty.getInstance().informPartyMembersQuit(player, getPlayersOnline());
@ -412,11 +425,11 @@ public class mcPlayerListener extends PlayerListener {
} }
//Party command //Party command
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.party)){ if(split[0].equalsIgnoreCase("/"+mcLoadProperties.party)){
event.setCancelled(true);
if(!mcPermissions.getInstance().party(player)){ if(!mcPermissions.getInstance().party(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return; return;
} }
event.setCancelled(true);
if(split.length == 1 && !mcUsers.getProfile(player).inParty()){ if(split.length == 1 && !mcUsers.getProfile(player).inParty()){
player.sendMessage("Proper usage is "+"/"+mcLoadProperties.party+" <name> or 'q' to quit"); player.sendMessage("Proper usage is "+"/"+mcLoadProperties.party+" <name> or 'q' to quit");
return; return;
@ -455,11 +468,11 @@ public class mcPlayerListener extends PlayerListener {
} }
} }
if(split[0].equalsIgnoreCase("/p")){ if(split[0].equalsIgnoreCase("/p")){
event.setCancelled(true);
if(!mcPermissions.getInstance().party(player)){ if(!mcPermissions.getInstance().party(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return; return;
} }
event.setCancelled(true);
if(mcConfig.getInstance().isAdminToggled(player.getName())) if(mcConfig.getInstance().isAdminToggled(player.getName()))
mcConfig.getInstance().toggleAdminChat(playerName); mcConfig.getInstance().toggleAdminChat(playerName);
mcConfig.getInstance().togglePartyChat(playerName); mcConfig.getInstance().togglePartyChat(playerName);
@ -488,11 +501,11 @@ public class mcPlayerListener extends PlayerListener {
* MYSPAWN * MYSPAWN
*/ */
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.myspawn)){ if(split[0].equalsIgnoreCase("/"+mcLoadProperties.myspawn)){
event.setCancelled(true);
if(!mcPermissions.getInstance().mySpawn(player)){ if(!mcPermissions.getInstance().mySpawn(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return; return;
} }
event.setCancelled(true);
if(mcUsers.getProfile(player).getMySpawn(player) != null){ if(mcUsers.getProfile(player).getMySpawn(player) != null){
if(mcLoadProperties.myspawnclearsinventory) if(mcLoadProperties.myspawnclearsinventory)
player.getInventory().clear(); player.getInventory().clear();

View File

@ -73,6 +73,8 @@ public class mcSkills {
} }
} }
public void abilityActivationCheck(Player player, Block block){ public void abilityActivationCheck(Player player, Block block){
if(!mcUsers.getProfile(player).getAbilityUse())
return;
if(mcPermissions.getInstance().miningAbility(player) && mcm.getInstance().isMiningPick(player.getItemInHand()) && !mcUsers.getProfile(player).getPickaxePreparationMode()){ if(mcPermissions.getInstance().miningAbility(player) && mcm.getInstance().isMiningPick(player.getItemInHand()) && !mcUsers.getProfile(player).getPickaxePreparationMode()){
if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() >= 1){ if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() >= 1){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."); player.sendMessage(ChatColor.RED+"You are too tired to use that ability again.");

View File

@ -156,7 +156,7 @@ class PlayerList
protected final Logger log = Logger.getLogger("Minecraft"); protected final Logger log = Logger.getLogger("Minecraft");
private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation, private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation,
archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather; archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather;
private boolean dead, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode, pickaxePreparationMode, axePreparationMode, skullSplitterMode, berserkMode; private boolean dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode, pickaxePreparationMode, axePreparationMode, skullSplitterMode, berserkMode;
private int recentlyhurt = 0, bleedticks = 0, gigaDrillBreakerCooldown = 0, gigaDrillBreakerTicks = 0, berserkTicks = 0, berserkCooldown = 0, superBreakerTicks = 0, superBreakerCooldown = 0, private int recentlyhurt = 0, bleedticks = 0, gigaDrillBreakerCooldown = 0, gigaDrillBreakerTicks = 0, berserkTicks = 0, berserkCooldown = 0, superBreakerTicks = 0, superBreakerCooldown = 0,
serratedStrikesTicks = 0, skullSplitterTicks = 0, skullSplitterCooldown = 0, serratedStrikesCooldown = 0, treeFellerTicks = 0, treeFellerCooldown = 0, serratedStrikesTicks = 0, skullSplitterTicks = 0, skullSplitterCooldown = 0, serratedStrikesCooldown = 0, treeFellerTicks = 0, treeFellerCooldown = 0,
axePreparationTicks = 0, pickaxePreparationTicks = 0, fistsPreparationTicks = 0, shovelPreparationTicks = 0, swordsPreparationTicks = 0; axePreparationTicks = 0, pickaxePreparationTicks = 0, fistsPreparationTicks = 0, shovelPreparationTicks = 0, swordsPreparationTicks = 0;
@ -419,6 +419,16 @@ class PlayerList
{ {
return player.getName().equals(playerName); return player.getName().equals(playerName);
} }
public boolean getAbilityUse(){
return abilityuse;
}
public void toggleAbilityUse(){
if(abilityuse == false){
abilityuse = true;
} else {
abilityuse = false;
}
}
public void decreaseLastHurt(){ public void decreaseLastHurt(){
if(recentlyhurt >= 1){ if(recentlyhurt >= 1){
recentlyhurt--; recentlyhurt--;

View File

@ -1,3 +1,3 @@
name: mcMMO name: mcMMO
main: com.gmail.nossr50.mcMMO main: com.gmail.nossr50.mcMMO
version: 0.9 version: 0.9.1