All changes up to 0.8.16

This commit is contained in:
nossr50 2011-03-09 16:08:58 -08:00
parent f3aedac1f2
commit 2f6dbfccfc
9 changed files with 114 additions and 10 deletions

View File

@ -1,5 +1,10 @@
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.8.16
Moved configuration file to /plugins/mcMMO
Arrows now have a chance to Ignite enemiesw
Fixed arrows not being retrievable from corpses
Added info about ignition to /archery
Version 0.8.14 Version 0.8.14
Mining, Woodcutting, Herbalism, and Acrobatics proc rates now are based on your skill level directly rather than tiers you unlock via skill levels Mining, Woodcutting, Herbalism, and Acrobatics proc rates now are based on your skill level directly rather than tiers you unlock via skill levels
Archery's ability to retrieve arrows from corpses now is based on your skill level directly rather than tiers you unlock via skill levels Archery's ability to retrieve arrows from corpses now is based on your skill level directly rather than tiers you unlock via skill levels

View File

@ -2,6 +2,7 @@ package com.gmail.nossr50;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -9,6 +10,7 @@ import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockListener; import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
public class mcBlockListener extends BlockListener { public class mcBlockListener extends BlockListener {
private final mcMMO plugin; private final mcMMO plugin;
@ -64,9 +66,33 @@ public class mcBlockListener extends BlockListener {
if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){ if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){
mcWoodCutting.getInstance().woodCuttingProcCheck(player, block, loc); mcWoodCutting.getInstance().woodCuttingProcCheck(player, block, loc);
mcUsers.getProfile(player).addWoodcuttingGather(7); mcUsers.getProfile(player).addWoodcuttingGather(7);
/*
* IF PLAYER IS USING TREEFELLER
*/
/*
if(mcPermissions.getInstance().woodcuttingability(player)){ if(mcPermissions.getInstance().woodcuttingability(player)){
player.sendMessage(ChatColor.RED+"TIIIIIIIIIIIMBER");
mcWoodCutting.getInstance().treeFeller(block);
for(Block blockx : mcConfig.getInstance().getTreeFeller()){
if(blockx != null){
Material mat = Material.getMaterial(blockx.getTypeId());
byte damage = 0;
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
blockx.setTypeId(0);
if(item.getTypeId() == 17)
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
if(item.getTypeId() == 18){
mat = Material.getMaterial(6);
item = new ItemStack(mat, 1, (byte)0, damage);
if(Math.random() * 10 > 6)
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
} }
} }
//mcConfig.getInstance().removeTreeFeller(blockx);
}
}
*/
}
/* /*
* EXCAVATION * EXCAVATION
*/ */

View File

@ -332,6 +332,19 @@ public class mcCombat {
*/ */
if(y instanceof Player){ if(y instanceof Player){
Player attacker = (Player)y; Player attacker = (Player)y;
if(Math.random() * 1500 <= mcUsers.getProfile(attacker).getArcheryInt()){
if(x instanceof Player){
Player Defender = (Player)x;
if(!mcParty.getInstance().inSameParty(attacker, Defender)){
event.getEntity().setFireTicks(120);
attacker.sendMessage(ChatColor.RED+"**IGNITION**");
Defender.sendMessage(ChatColor.DARK_RED+"You were struck by a burning arrow!");
}
} else {
event.getEntity().setFireTicks(160);
attacker.sendMessage(ChatColor.RED+"**IGNITION**");
}
}
if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){ if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){
if(!mcConfig.getInstance().isTracked(x) && event.getDamage() > 0){ if(!mcConfig.getInstance().isTracked(x) && event.getDamage() > 0){
mcConfig.getInstance().addArrowTrack(x, 0); mcConfig.getInstance().addArrowTrack(x, 0);
@ -357,7 +370,6 @@ public class mcCombat {
/* /*
* TRACK ARROWS USED AGAINST THE ENTITY * TRACK ARROWS USED AGAINST THE ENTITY
*/ */
int healthbefore = defender.getHealth();
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
event.setDamage(calculateDamage(event, 1)); event.setDamage(calculateDamage(event, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
@ -466,7 +478,6 @@ public class mcCombat {
attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed"); attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed");
} }
} }
int healthbefore = defender.getHealth();
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
event.setDamage(calculateDamage(event, 1)); event.setDamage(calculateDamage(event, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)

View File

@ -18,6 +18,7 @@ public class mcConfig {
static ArrayList<Entity> bleedTracker = new ArrayList<Entity>(); static ArrayList<Entity> bleedTracker = new ArrayList<Entity>();
static ArrayList<Entity> mobSpawnTracker = new ArrayList<Entity>(); static ArrayList<Entity> mobSpawnTracker = new ArrayList<Entity>();
public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);} public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);}
public boolean isTreeFellerWatched(Block block) {return treeFeller.contains(block);}
public ArrayList<Block> getTreeFeller() {return treeFeller;} public ArrayList<Block> getTreeFeller() {return treeFeller;}
public void removeBlockWatch(Block block) {blockWatchList.remove(blockWatchList.indexOf(block));} public void removeBlockWatch(Block block) {blockWatchList.remove(blockWatchList.indexOf(block));}
public void addBlockWatch(Block block) {blockWatchList.add(block);} public void addBlockWatch(Block block) {blockWatchList.add(block);}

View File

@ -124,6 +124,7 @@ public class mcEntityListener extends EntityListener {
} }
public void onEntityDeath(EntityDeathEvent event) { public void onEntityDeath(EntityDeathEvent event) {
Entity x = event.getEntity(); Entity x = event.getEntity();
mcSkills.getInstance().arrowRetrievalCheck(x);
if(x instanceof Player){ if(x instanceof Player){
Player player = (Player)x; Player player = (Player)x;
if(mcUsers.getProfile(player).isDead()){ if(mcUsers.getProfile(player).isDead()){

View File

@ -18,7 +18,7 @@ import org.bukkit.entity.Player;
public class mcMMO extends JavaPlugin { public class mcMMO extends JavaPlugin {
static String maindirectory = "mcMMO/"; static String maindirectory = "plugins/mcMMO/";
static File Properties = new File(maindirectory + "mcmmo.properties"); static File Properties = new File(maindirectory + "mcmmo.properties");
public static final Logger log = Logger.getLogger("Minecraft"); public static final Logger log = Logger.getLogger("Minecraft");
private final mcPlayerListener playerListener = new mcPlayerListener(this); private final mcPlayerListener playerListener = new mcPlayerListener(this);
@ -32,7 +32,7 @@ public class mcMMO extends JavaPlugin {
//herp //herp
public void onEnable() { public void onEnable() {
//mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(2000)); mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(2000));
//Make the directory if it does not exist //Make the directory if it does not exist
new File(maindirectory).mkdir(); new File(maindirectory).mkdir();
//Make the file if it does not exist //Make the file if it does not exist
@ -61,6 +61,9 @@ public class mcMMO extends JavaPlugin {
//Load the file //Load the file
mcLoadProperties.loadMain(); mcLoadProperties.loadMain();
mcUsers.getInstance().loadUsers(); mcUsers.getInstance().loadUsers();
for(Player player : getServer().getOnlinePlayers()){
mcUsers.addUser(player);
}
PluginManager pm = getServer().getPluginManager(); PluginManager pm = getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this);

View File

@ -1,5 +1,7 @@
package com.gmail.nossr50; package com.gmail.nossr50;
import java.util.ArrayList;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -7,6 +9,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class mcWoodCutting { public class mcWoodCutting {
int w = 0;
private boolean isdone = false;
private static mcMMO plugin; private static mcMMO plugin;
public mcWoodCutting(mcMMO instance) { public mcWoodCutting(mcMMO instance) {
plugin = instance; plugin = instance;
@ -31,11 +35,62 @@ public class mcWoodCutting {
} }
} }
public void treeFeller(Block block){ public void treeFeller(Block block){
Location loc = block.getLocation();
int radius = 1; int radius = 1;
int typeid = 17; ArrayList<Block> blocklist = new ArrayList<Block>();
if(mcm.getInstance().isBlockAround(loc, radius, typeid)){ ArrayList<Block> toAdd = new ArrayList<Block>();
if(block != null)
blocklist.add(block);
while(isdone == false){
addBlocksToTreeFelling(blocklist, toAdd, radius);
}
//This needs to be a hashmap too!
isdone = false;
/*
* Add blocks from the temporary 'toAdd' array list into the 'treeFeller' array list
* We use this temporary list to prevent concurrent modification exceptions
*/
for(Block x : toAdd){
if(!mcConfig.getInstance().isTreeFellerWatched(x))
mcConfig.getInstance().addTreeFeller(x);
}
}
public void addBlocksToTreeFelling(ArrayList<Block> blocklist, ArrayList<Block> toAdd, Integer radius){
int u = 0;
for (Block x : blocklist){
u++;
if(toAdd.contains(x))
continue;
w = 0;
Location loc = x.getLocation();
int vx = x.getX();
int vy = x.getY();
int vz = x.getZ();
/*
* Run through the blocks around the broken block to see if they qualify to be 'felled'
*/
for (int cx = -radius; cx <= radius; cx++) {
for (int cy = -radius; cy <= radius; cy++) {
for (int cz = -radius; cz <= radius; cz++) {
Block blocktarget = loc.getWorld().getBlockAt(vx + cx, vy + cy, vz + cz);
if (!blocklist.contains(blocktarget) && !toAdd.contains(blocktarget) && (blocktarget.getTypeId() == 17 || blocktarget.getTypeId() == 18)) {
toAdd.add(blocktarget);
w++;
}
}
}
}
}
/*
* Add more blocks to blocklist so they can be 'felled'
*/
for(Block xx : toAdd){
if(!blocklist.contains(xx))
blocklist.add(xx);
}
if(u >= blocklist.size()){
isdone = true;
} else {
isdone = false;
} }
} }
} }

View File

@ -233,15 +233,17 @@ public class mcm {
event.setCancelled(true); event.setCancelled(true);
float skillvalue = (float)mcUsers.getProfile(player).getArcheryInt(); float skillvalue = (float)mcUsers.getProfile(player).getArcheryInt();
String percentage = String.valueOf((skillvalue / 1000) * 100); String percentage = String.valueOf((skillvalue / 1000) * 100);
String percentagefire = String.valueOf((skillvalue / 1500) * 100);
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"ARCHERY"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"ARCHERY"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
//player.sendMessage(ChatColor.DARK_AQUA+"Daze (Monsters): "+ChatColor.GREEN+"Enemies lose interest for 1 second"); player.sendMessage(ChatColor.DARK_AQUA+"Ignition: "+ChatColor.GREEN+"Enemies will catch on fire");
player.sendMessage(ChatColor.DARK_AQUA+"Daze (Players): "+ChatColor.GREEN+"Disorients foes"); player.sendMessage(ChatColor.DARK_AQUA+"Daze (Players): "+ChatColor.GREEN+"Disorients foes");
player.sendMessage(ChatColor.DARK_AQUA+"Damage+: "+ChatColor.GREEN+"Modifies Damage"); player.sendMessage(ChatColor.DARK_AQUA+"Damage+: "+ChatColor.GREEN+"Modifies Damage");
player.sendMessage(ChatColor.DARK_AQUA+"Arrow Retrieval: "+ChatColor.GREEN+"Chance to retrieve arrows from corpses"); player.sendMessage(ChatColor.DARK_AQUA+"Arrow Retrieval: "+ChatColor.GREEN+"Chance to retrieve arrows from corpses");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Chance to Retrieve Arrows: "+ChatColor.YELLOW+percentage+"%"); player.sendMessage(ChatColor.RED+"Chance to Retrieve Arrows: "+ChatColor.YELLOW+percentage+"%");
player.sendMessage(ChatColor.RED+"Chance for Ignition: "+ChatColor.YELLOW+percentagefire+"%");
} }
if(split[0].equalsIgnoreCase("/axes")){ if(split[0].equalsIgnoreCase("/axes")){
event.setCancelled(true); event.setCancelled(true);

View File

@ -1,3 +1,3 @@
name: mcMMO name: mcMMO
main: com.gmail.nossr50.mcMMO main: com.gmail.nossr50.mcMMO
version: 0.8.15 version: 0.8.16