mcMMO -> All changes up to 0.6.2

vStopFire -> All changes up to 1.1
WoolPlus -> All changes up to 1.2
vPlayersOnline -> All changes up to 1.5
This commit is contained in:
nossr50 2011-02-21 22:47:44 -08:00
parent 09ca2b3b0d
commit 38f24bee62
22 changed files with 4331 additions and 3819 deletions

View File

@ -1,5 +1,14 @@
Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code#
Version 0.6.2
Axes now do critical strikes against farm animals
Removed the "Stupidly Long Constructor"
Now compatible with the latest CB builds
Version 0.6.1
Customizable command names
Axes can now be modified with /mmoedit
Party members are now correctly informed when you leave the party
Fixed incorrect commands in /mcc
Version 0.5.17
Changed namespaces to fit bukkits new standard

View File

@ -29,22 +29,56 @@ public class mcEntityListener extends EntityListener {
public mcEntityListener(final mcMMO plugin) {
this.plugin = plugin;
}
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
Entity x = event.getEntity(); //Defender
Entity y = event.getDamager(); //Attacker
public boolean isBow(ItemStack is){
if (is.getTypeId() == 261){
return true;
} else {
return false;
}
}
public void onEntityDamage(EntityDamageEvent event) {
Entity x = event.getEntity();
DamageCause type = event.getCause();
/*
* ACROBATICS
*/
if(x instanceof Player){
Player player = (Player)x;
Location loc = player.getLocation();
int xx = loc.getBlockX();
int y = loc.getBlockY();
int z = loc.getBlockZ();
if(type == DamageCause.FALL){
mcm.getInstance().acrobaticsCheck(player, event, loc, xx, y, z);
}
}
/*
* ARCHERY CHECKS
*/
if(event instanceof EntityDamageByProjectileEvent){
EntityDamageByProjectileEvent c = (EntityDamageByProjectileEvent)event;
mcm.getInstance().archeryCheck(c);
}
/*
* Entity Damage by Entity checks
*/
if(event instanceof EntityDamageByEntityEvent){
EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent)event;
Entity e = eventb.getEntity(); //Defender
Entity f = eventb.getDamager(); //Attacker
/*
* IF DEFENDER IS PLAYER
*/
if(x instanceof Player){
Player defender = (Player)x;
if(e instanceof Player){
Player defender = (Player)e;
/*
* PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT
*/
mcm.getInstance().parryCheck(defender, event, y);
mcm.getInstance().parryCheck(defender, eventb, f);
/*
* PLAYER DEATH BY MONSTER MESSAGE CHECK, CHECKS TO SEE IF TO REPORT THE DEATH OR NOT
*/
mcm.getInstance().playerDeathByMonsterMessageCheck(y, defender, plugin);
//mcm.getInstance().playerDeathByMonsterMessageCheck(y, defender, plugin);
/*
* CHECKS IF THE PLAYER DIES, IF SO DROP HIS SHIT BECAUSE OF THE DAMAGE MODIFIERS
* MIGHT BE A BIT BUGGY, IT SEEMS TO WORK RIGHT NOW AT LEAST...
@ -54,291 +88,26 @@ public class mcEntityListener extends EntityListener {
/*
* IF ATTACKER IS PLAYER
*/
if(y instanceof Player){
int type = ((Player) y).getItemInHand().getTypeId();
Player attacker = (Player)y;
if(f instanceof Player){
//((Player) f).sendMessage("DEBUG: EntityDamageByEntity cast correctly!");
int typeid = ((Player) f).getItemInHand().getTypeId();
Player attacker = (Player)f;
/*
* Player versus Monster checks, this handles all skill damage modifiers and any procs.
*/
mcm.getInstance().playerVersusMonsterChecks(event, attacker, x, type);
mcm.getInstance().playerVersusMonsterChecks(eventb, attacker, e, typeid);
/*
* Player versus Squid checks, this handles all skill damage modifiers and any procs.
*/
mcm.getInstance().playerVersusSquidChecks(event, attacker, x, type);
mcm.getInstance().playerVersusSquidChecks(eventb, attacker, e, typeid);
/*
* Player versus Player checks, these checks make sure players are not in the same party, etc. They also check for any procs from skills and handle damage modifiers.
*/
mcm.getInstance().playerVersusPlayerChecks(x, attacker, event, plugin);
mcm.getInstance().playerVersusPlayerChecks(e, attacker, eventb, plugin);
/*
* Player versus Animals checks, these checks handle any skill modifiers or procs
*/
mcm.getInstance().playerVersusAnimalsChecks(x, attacker, event, type);
}
}
public boolean isBow(ItemStack is){
if (is.getTypeId() == 261){
return true;
} else {
return false;
}
}
public void onEntityDamageByProjectile(EntityDamageByProjectileEvent event) {
Entity y = event.getDamager();
Entity x = event.getEntity();
/*
* Defender is player
*/
if(y instanceof Player){
Player attacker = (Player)y;
/*
* DEBUG MESSAGE
*/
//attacker.sendMessage(event.getProjectile().toString());
if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){
/*
* Defender is Monster
*/
if(x instanceof Monster){
Monster defender = (Monster)x;
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
if(defender.getHealth() <= 0)
mcm.getInstance().simulateNaturalDrops(defender);
//XP
if(Math.random() * 10 > 7){
mcUsers.getProfile(attacker).skillUpArchery(1);
attacker.sendMessage(ChatColor.YELLOW+"Archery skill increased by 1. Total ("+mcUsers.getProfile(attacker).getArchery()+")");
}
}
/*
* Defender is Animals
*/
if(x instanceof Animals){
Animals defender = (Animals)x;
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
if(defender.getHealth() <= 0)
mcm.getInstance().simulateNaturalDrops(defender);
}
/*
* Defender is Squid
*/
if(x instanceof Squid){
Squid defender = (Squid)x;
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
if(defender.getHealth() <= 0)
mcm.getInstance().simulateNaturalDrops(defender);
}
/*
* Attacker is Player
*/
if(x instanceof Player){
if(mcLoadProperties.pvp == false){
event.setCancelled(true);
return;
}
Player defender = (Player)x;
/*
* Stuff for the daze proc
*/
if(mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){
if(mcm.getInstance().inSameParty(defender, attacker)){
event.setCancelled(true);
return;
}
}
Location loc = defender.getLocation();
if(Math.random() * 10 > 5){
loc.setPitch(90);
} else {
loc.setPitch(-90);
}
/*
* Check the proc
*/
if(mcUsers.getProfile(attacker).getArcheryInt() >= 300 && mcUsers.getProfile(attacker).getArcheryInt() < 400){
if(Math.random() * 10 > 7){
defender.teleportTo(loc);
defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy.");
attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed");
}
}
if(mcUsers.getProfile(attacker).getArcheryInt() >= 600){
if(Math.random() * 10 > 4){
defender.teleportTo(loc);
defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy.");
attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed");
}
}
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
if(defender.getHealth() >= 0){
if(mcUsers.getProfile(defender).isDead())
return;
if(defender.getHealth() <= 0){
mcUsers.getProfile(defender).setDead(true);
for(Player derp : plugin.getServer().getOnlinePlayers()){
derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName() + " with an arrow.");
}
}
}
if(mcUsers.getProfile(defender).isDead())
return;
if(defender.getHealth() - event.getDamage() <= 0){
for(Player derp : plugin.getServer().getOnlinePlayers()){
derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName() + " with the bow and arrow.");
mcUsers.getProfile(defender).setDead(true);
}
}
}
}
}
}
public void onEntityDamage(EntityDamageEvent event) {
Entity x = event.getEntity();
if(x instanceof Player){
Player player = (Player)x;
DamageCause type = event.getCause();
Location loc = player.getLocation();
int xx = loc.getBlockX();
int y = loc.getBlockY();
int z = loc.getBlockZ();
if(type == DamageCause.FALL){
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 50
&& mcUsers.getProfile(player).getAcrobaticsInt() < 250
&& mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 8){
event.setCancelled(true);
player.sendMessage("**ROLLED**");
return;
}
}
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 250
&& mcUsers.getProfile(player).getAcrobaticsInt() < 450
&& mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 6){
event.setCancelled(true);
player.sendMessage("**ROLLED**");
return;
}
}
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 450
&& mcUsers.getProfile(player).getAcrobaticsInt() < 750
&& mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 4){
event.setCancelled(true);
player.sendMessage("**ROLLED**");
return;
}
}
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 750
&& mcUsers.getProfile(player).getAcrobaticsInt() < 950
&& mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 2){
event.setCancelled(true);
player.sendMessage("**BARREL ROLLED**");
return;
}
}
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 950
&& mcPermissions.getInstance().acrobatics(player)){
event.setCancelled(true);
player.sendMessage("**ROLLED... LIKE A BOSS**");
return;
}
if(player.getHealth() - event.getDamage() <= 0)
return;
if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z))
&& mcPermissions.getInstance().acrobatics(player)){
if(event.getDamage() >= 2 && event.getDamage() < 6){
mcUsers.getProfile(player).skillUpAcrobatics(1);
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 1. Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
}
if(event.getDamage() >= 6 && event.getDamage() < 19){
mcUsers.getProfile(player).skillUpAcrobatics(2);
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 2. Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
}
if(event.getDamage() >= 19){
mcUsers.getProfile(player).skillUpAcrobatics(3);
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 3. Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
}
}
mcConfig.getInstance().addBlockWatch(loc.getWorld().getBlockAt(xx, y, z));
if(player.getHealth() - event.getDamage() <= 0){
if(mcUsers.getProfile(player).isDead())
return;
mcUsers.getProfile(player).setDead(true);
for(Player bidoof : plugin.getServer().getOnlinePlayers()){
bidoof.sendMessage(ChatColor.GRAY+player.getName()+" has "+ChatColor.DARK_RED+"fallen "+ChatColor.GRAY+"to death.");
}
}
}
if(type == DamageCause.DROWNING){
if(mcUsers.getProfile(player).isDead())
return;
if(player.getHealth() - event.getDamage() <= 0){
mcUsers.getProfile(player).setDead(true);
for(Player slipslap : plugin.getServer().getOnlinePlayers()){
slipslap.sendMessage(ChatColor.GRAY+player.getName()+" has "+ChatColor.AQUA+"drowned.");
}
}
}
/*
if(type == DamageCause.FIRE || type == DamageCause.FIRE_TICK){
if(mcUsers.getProfile(player).isDead())
return;
if(player.getHealth() - event.getDamage() <= 0){
mcUsers.getProfile(player).setDead(true);
for(Player slipslap : plugin.getServer().getOnlinePlayers()){
slipslap.sendMessage(ChatColor.GRAY+player.getName()+" has "+ChatColor.RED+"burned "+ChatColor.GRAY+"to death.");
}
}
}
*/
if(type == DamageCause.LAVA){
if(mcUsers.getProfile(player).isDead())
return;
if(player.getHealth() - event.getDamage() <= 0){
mcUsers.getProfile(player).setDead(true);
for(Player slipslap : plugin.getServer().getOnlinePlayers()){
slipslap.sendMessage(ChatColor.GRAY+player.getName()+" has "+ChatColor.RED+"melted "+ChatColor.GRAY+".");
}
}
mcm.getInstance().playerVersusAnimalsChecks(e, attacker, eventb, typeid);
}
}
}
@ -350,9 +119,6 @@ public class mcEntityListener extends EntityListener {
mcUsers.getProfile(player).setDead(false);
return;
}
for(Player derp : plugin.getServer().getOnlinePlayers()){
derp.sendMessage(ChatColor.GRAY+player.getName()+" has died.");
}
}
}
public boolean isPlayer(Entity entity){

View File

@ -2,13 +2,17 @@ package com.gmail.nossr50;
public class mcLoadProperties {
public static Boolean pvp, eggs, apples, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal;
public static String mcmmo, mcc, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept;
public static void loadMain(){
String propertiesFile = mcMMO.maindirectory + "mcmmo.properties";
mcProperties properties = new mcProperties(propertiesFile);
properties.load();
//Grab properties stuff here
/*
* EXCAVATION LOOT TOGGLES
*/
glowstone = properties.getBoolean("glowstone", true);
pvp = properties.getBoolean("pvp", true);
eggs = properties.getBoolean("eggs", true);
@ -20,7 +24,21 @@ public class mcLoadProperties {
sulphur = properties.getBoolean("sulphur", true);
netherrack = properties.getBoolean("netherrack", true);
bones = properties.getBoolean("bones", true);
properties.save("==McMMO Configuration==");
/*
* CUSTOM COMMANDS
*/
mcmmo = properties.getString("mcmmo", "mcmmo");
mcc = properties.getString("mcc", "mcc");
stats = properties.getString("stats", "stats");
mmoedit = properties.getString("mmoedit", "mmoedit");
ptp = properties.getString("ptp", "ptp");
party = properties.getString("party", "party");
myspawn = properties.getString("myspawn", "myspawn");
setmyspawn = properties.getString("setmyspawn", "setmyspawn");
whois = properties.getString("whois", "whois");
invite = properties.getString("invite", "invite");
accept = properties.getString("accept", "accept");
properties.save("==McMMO Configuration==\r\nYou can turn off excavation loot tables by turning the option to false\r\nYou can customize mcMMOs command names by modifying them here as well\r\nThis is an early version of the configuration file, eventually you'll be able to customize messages from mcMMO and XP gains");
//herp derp
}
}

View File

@ -34,10 +34,12 @@ public class mcMMO extends JavaPlugin {
public static PermissionHandler PermissionsHandler = null;
private Permissions permissions;
/*
public mcMMO(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
super(pluginLoader, instance, desc, folder, plugin, cLoader);
}
*/
//herp
public void onEnable() {
//Make the directory if it does not exist
new File(maindirectory).mkdir();
@ -62,6 +64,9 @@ public class mcMMO extends JavaPlugin {
writer.append("bones=true");
writer.append("sulphur=true");
writer.append("coal=true");
writer.append("mcmmo=mcmmo");
writer.append("mcc=mcc");
writer.append("stats=stats");
writer.append("#Appreciate the plugin? Send me a donation via paypal nossr50@gmail.com\r\n");
} catch (Exception e) {
log.log(Level.SEVERE, "Exception while creating " + Properties, e);
@ -89,15 +94,12 @@ public class mcMMO extends JavaPlugin {
pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Monitor, this);
pm.registerEvent(Event.Type.ENTITY_DAMAGEDBY_ENTITY, entityListener, Priority.Normal, this);
pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_FLOW, blockListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_RESPAWN, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_ITEM_HELD, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.ENTITY_DAMAGEDBY_PROJECTILE, entityListener, Priority.Normal, this);
pm.registerEvent(Event.Type.ENTITY_DAMAGEDBY_BLOCK, entityListener, Priority.Normal, this);
pm.registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.Normal, this);
//Displays a message when plugin is loaded
PluginDescriptionFile pdfFile = this.getDescription();

View File

@ -82,7 +82,7 @@ public class mcPlayerListener extends PlayerListener {
Player player = event.getPlayer();
mcUsers.addUser(player);
if(mcPermissions.getInstance().motd(player)){
player.sendMessage(ChatColor.BLUE + "This server is running mcMMO "+plugin.getDescription().getVersion()+" type "+ChatColor.YELLOW+"/mcmmo "+ChatColor.BLUE+ "for help.");
player.sendMessage(ChatColor.BLUE + "This server is running mcMMO "+plugin.getDescription().getVersion()+" type /"+ChatColor.YELLOW+mcLoadProperties.mcmmo+ChatColor.BLUE+ " for help.");
}
}
//Check if string is a player
@ -109,9 +109,9 @@ public class mcPlayerListener extends PlayerListener {
String playerName = player.getName();
//Check if the command is an mcMMO related help command
mcm.getInstance().mcmmoHelpCheck(split, player, event);
if(mcPermissions.getInstance().mmoedit(player) && split[0].equalsIgnoreCase("/mmoedit")){
if(mcPermissions.getInstance().mmoedit(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.mmoedit)){
if(split.length < 3){
player.sendMessage(ChatColor.RED+"Usage is /mmoedit playername skillname newvalue");
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.mmoedit+" playername skillname newvalue");
return;
}
if(split.length == 4){
@ -131,14 +131,14 @@ public class mcPlayerListener extends PlayerListener {
player.sendMessage(ChatColor.RED+"Usage is /mmoedit playername skillname newvalue");
}
}
if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/ptp")){
if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/"+mcLoadProperties.ptp)){
event.setCancelled(true);
if(!mcPermissions.getInstance().partyTeleport(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return;
}
if(split.length < 2){
player.sendMessage(ChatColor.RED+"Usage is /ptp <playername>");
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.ptp+" <playername>");
return;
}
if(isPlayer(split[1])){
@ -150,10 +150,10 @@ public class mcPlayerListener extends PlayerListener {
}
}
}
if((player.isOp() || mcPermissions.getInstance().whois(player)) && split[0].equalsIgnoreCase("/whois")){
if((player.isOp() || mcPermissions.getInstance().whois(player)) && split[0].equalsIgnoreCase("/"+mcLoadProperties.whois)){
event.setCancelled(true);
if(split.length < 2){
player.sendMessage(ChatColor.RED + "Proper usage is /whois <playername>");
player.sendMessage(ChatColor.RED + "Proper usage is /"+mcLoadProperties.whois+" <playername>");
return;
}
//if split[1] is a player
@ -186,7 +186,7 @@ public class mcPlayerListener extends PlayerListener {
player.sendMessage("Z: "+z);
}
}
if(split[0].equalsIgnoreCase("/setmyspawn")){
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.setmyspawn)){
if(!mcPermissions.getInstance().setMySpawn(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return;
@ -198,7 +198,7 @@ public class mcPlayerListener extends PlayerListener {
mcUsers.getProfile(player).setMySpawn(x, y, z);
player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set to your current location.");
}
if(split[0].equalsIgnoreCase("/stats")){
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.stats)){
event.setCancelled(true);
player.sendMessage(ChatColor.DARK_RED + "mcMMO stats");
player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining());
@ -225,13 +225,13 @@ public class mcPlayerListener extends PlayerListener {
);
}
//Invite Command
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/invite")){
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.invite)){
if(!mcUsers.getProfile(player).inParty()){
player.sendMessage(ChatColor.RED+"You are not in a party.");
return;
}
if(split.length < 2){
player.sendMessage(ChatColor.RED+"Usage is /invite <playername");
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.invite+" <playername>");
return;
}
if(mcUsers.getProfile(player).inParty() && split.length >= 2 && isPlayer(split[1])){
@ -239,11 +239,11 @@ public class mcPlayerListener extends PlayerListener {
mcUsers.getProfile(target).modifyInvite(mcUsers.getProfile(player).getParty());
player.sendMessage(ChatColor.GREEN+"Invite sent successfully");
target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+mcUsers.getProfile(target).getInvite());
target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+"/accept"+ChatColor.YELLOW+" to accept the invite");
target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+"/"+mcLoadProperties.accept+ChatColor.YELLOW+" to accept the invite");
}
}
//Accept invite
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/accept")){
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.accept)){
if(mcUsers.getProfile(player).hasPartyInvite()){
if(mcUsers.getProfile(player).inParty()){
informPartyMembersQuit(player);
@ -256,14 +256,14 @@ public class mcPlayerListener extends PlayerListener {
}
}
//Party command
if(split[0].equalsIgnoreCase("/party")){
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.party)){
if(!mcPermissions.getInstance().party(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return;
}
event.setCancelled(true);
if(split.length == 1 && !mcUsers.getProfile(player).inParty()){
player.sendMessage("Proper usage is /party <name> or 'q' to quit");
player.sendMessage("Proper usage is "+"/"+mcLoadProperties.party+" <name> or 'q' to quit");
return;
}
if(split.length == 1 && mcUsers.getProfile(player).inParty()){
@ -292,6 +292,8 @@ public class mcPlayerListener extends PlayerListener {
return;
}
if(split.length >= 2){
if(mcUsers.getProfile(player).inParty())
informPartyMembersQuit(player);
mcUsers.getProfile(player).setParty(split[1]);
player.sendMessage("Joined Party: " + split[1]);
informPartyMembers(player);
@ -327,7 +329,7 @@ public class mcPlayerListener extends PlayerListener {
player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.RED + "Off");
}
}
if(split[0].equalsIgnoreCase("/myspawn")){
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.myspawn)){
if(!mcPermissions.getInstance().mySpawn(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return;

View File

@ -154,7 +154,7 @@ class PlayerList
{
protected final Logger log = Logger.getLogger("Minecraft");
private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, unarmed, herbalism, excavation,
archery, swords, axes, invite, acrobatics;
archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather;
private boolean dead;
char defaultColor;
@ -176,13 +176,21 @@ class PlayerList
myspawn = new String();
mining = new String();
repair = new String();
repairgather = new String();
unarmed = new String();
unarmedgather = new String();
herbalism = new String();
herbalismgather = new String();
excavation = new String();
excavationgather = new String();
archery = new String();
archerygather = new String();
swords = new String();
swordsgather = new String();
axes = new String();
axesgather = new String();
acrobatics = new String();
acrobaticsgather = new String();
invite = new String();
//mining = "0";
wgather = new String();
@ -751,6 +759,9 @@ class PlayerList
if(skillname.equals("excavation")){
excavation = String.valueOf(newvalue);
}
if(skillname.equals("axes")){
axes = String.valueOf(newvalue);
}
save();
}
public int getgatheramt() {

View File

@ -5,6 +5,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Item;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Entity;
@ -16,6 +17,8 @@ import org.bukkit.entity.Spider;
import org.bukkit.entity.Squid;
import org.bukkit.entity.Zombie;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
@ -98,73 +101,289 @@ public class mcm {
}
return true;
}
public void archeryCheck(EntityDamageByProjectileEvent event){
Entity y = event.getDamager();
Entity x = event.getEntity();
/*
* Defender is player
*/
if(y instanceof Player){
Player attacker = (Player)y;
/*
* DEBUG MESSAGE
*/
//attacker.sendMessage(event.getProjectile().toString());
if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){
/*
* Defender is Monster
*/
if(x instanceof Monster){
Monster defender = (Monster)x;
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
if(defender.getHealth() <= 0)
mcm.getInstance().simulateNaturalDrops(defender);
//XP
if(Math.random() * 10 > 7){
mcUsers.getProfile(attacker).skillUpArchery(1);
attacker.sendMessage(ChatColor.YELLOW+"Archery skill increased by 1. Total ("+mcUsers.getProfile(attacker).getArchery()+")");
}
}
/*
* Defender is Animals
*/
if(x instanceof Animals){
Animals defender = (Animals)x;
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
if(defender.getHealth() <= 0)
mcm.getInstance().simulateNaturalDrops(defender);
}
/*
* Defender is Squid
*/
if(x instanceof Squid){
Squid defender = (Squid)x;
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
if(defender.getHealth() <= 0)
mcm.getInstance().simulateNaturalDrops(defender);
}
/*
* Attacker is Player
*/
if(x instanceof Player){
if(mcLoadProperties.pvp == false){
event.setCancelled(true);
return;
}
Player defender = (Player)x;
/*
* Stuff for the daze proc
*/
if(mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){
if(mcm.getInstance().inSameParty(defender, attacker)){
event.setCancelled(true);
return;
}
}
Location loc = defender.getLocation();
if(Math.random() * 10 > 5){
loc.setPitch(90);
} else {
loc.setPitch(-90);
}
/*
* Check the proc
*/
if(mcUsers.getProfile(attacker).getArcheryInt() >= 300 && mcUsers.getProfile(attacker).getArcheryInt() < 400){
if(Math.random() * 10 > 7){
defender.teleportTo(loc);
defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy.");
attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed");
}
}
if(mcUsers.getProfile(attacker).getArcheryInt() >= 600){
if(Math.random() * 10 > 4){
defender.teleportTo(loc);
defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy.");
attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed");
}
}
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(mcm.getInstance().calculateDamage(defender, 5));
if(defender.getHealth() >= 0){
if(mcUsers.getProfile(defender).isDead())
return;
/*
if(defender.getHealth() <= 0){
mcUsers.getProfile(defender).setDead(true);
for(Player derp : plugin.getServer().getOnlinePlayers()){
derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName() + " with an arrow.");
}
}
*/
}
if(mcUsers.getProfile(defender).isDead())
return;
/*
if(defender.getHealth() - event.getDamage() <= 0){
for(Player derp : plugin.getServer().getOnlinePlayers()){
derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName() + " with the bow and arrow.");
mcUsers.getProfile(defender).setDead(true);
}
}
*/
}
}
}
}
public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 50
&& mcUsers.getProfile(player).getAcrobaticsInt() < 250
&& mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 8){
event.setCancelled(true);
player.sendMessage("**ROLLED**");
return;
}
}
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 250
&& mcUsers.getProfile(player).getAcrobaticsInt() < 450
&& mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 6){
event.setCancelled(true);
player.sendMessage("**ROLLED**");
return;
}
}
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 450
&& mcUsers.getProfile(player).getAcrobaticsInt() < 750
&& mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 4){
event.setCancelled(true);
player.sendMessage("**ROLLED**");
return;
}
}
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 750
&& mcUsers.getProfile(player).getAcrobaticsInt() < 950
&& mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 10 > 2){
event.setCancelled(true);
player.sendMessage("**BARREL ROLLED**");
return;
}
}
if(mcUsers.getProfile(player).getAcrobaticsInt() >= 950
&& mcPermissions.getInstance().acrobatics(player)){
event.setCancelled(true);
player.sendMessage("**ROLLED... LIKE A BOSS**");
return;
}
if(player.getHealth() - event.getDamage() <= 0)
return;
if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z))
&& mcPermissions.getInstance().acrobatics(player)){
if(event.getDamage() >= 2 && event.getDamage() < 6){
mcUsers.getProfile(player).skillUpAcrobatics(1);
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 1. Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
}
if(event.getDamage() >= 6 && event.getDamage() < 19){
mcUsers.getProfile(player).skillUpAcrobatics(2);
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 2. Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
}
if(event.getDamage() >= 19){
mcUsers.getProfile(player).skillUpAcrobatics(3);
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 3. Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
}
}
mcConfig.getInstance().addBlockWatch(loc.getWorld().getBlockAt(xx, y, z));
if(player.getHealth() - event.getDamage() <= 0){
if(mcUsers.getProfile(player).isDead())
return;
mcUsers.getProfile(player).setDead(true);
}
}
public void simulateNaturalDrops(Entity entity){
Location loc = entity.getLocation();
if(entity instanceof Pig){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
dropItem(loc, 319); //BACON
mcDropItem(loc, 319); //BACON
}
dropItem(loc, 319);
mcDropItem(loc, 319);
}
}
if(entity instanceof Spider){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
dropItem(loc, 287); //SILK
mcDropItem(loc, 287); //SILK
}
dropItem(loc, 287);
mcDropItem(loc, 287);
}
}
if(entity instanceof Skeleton){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
dropItem(loc, 262); //ARROWS
mcDropItem(loc, 262); //ARROWS
}
dropItem(loc, 262);
mcDropItem(loc, 262);
}
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
dropItem(loc, 352); //BONES
mcDropItem(loc, 352); //BONES
}
dropItem(loc, 352);
mcDropItem(loc, 352);
}
}
if(entity instanceof Zombie){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
dropItem(loc, 288); //FEATHERS
mcDropItem(loc, 288); //FEATHERS
}
dropItem(loc, 288);
mcDropItem(loc, 288);
}
}
if(entity instanceof Cow){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
dropItem(loc, 334); //LEATHER
mcDropItem(loc, 334); //LEATHER
}
if(Math.random() * 2 > 1){
dropItem(loc, 334);
mcDropItem(loc, 334);
}
dropItem(loc, 334);
mcDropItem(loc, 334);
}
}
if(entity instanceof Squid){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
dropItem(loc, 351); //INK SACS
mcDropItem(loc, 351); //INK SACS
}
if(Math.random() * 2 > 1){
dropItem(loc, 351);
mcDropItem(loc, 351);
}
dropItem(loc, 351);
mcDropItem(loc, 351);
}
}
}
public void dropItem(Location loc, int id){
public void mcDropItem(Location loc, int id){
if(loc != null){
Material mat = Material.getMaterial(id);
byte damage = 0;
@ -270,40 +489,40 @@ public class mcm {
byte damage = 0;
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
if(block.getTypeId() != 73 && block.getTypeId() != 74 && block.getTypeId() != 56 && block.getTypeId() != 21 && block.getTypeId() != 1 && block.getTypeId() != 16)
block.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
//hurrdurr
if(block.getTypeId() == 73 || block.getTypeId() == 74){
mat = Material.getMaterial(331);
item = new ItemStack(mat, 1, (byte)0, damage);
block.getWorld().dropItemNaturally(loc, item);
block.getWorld().dropItemNaturally(loc, item);
block.getWorld().dropItemNaturally(loc, item);
block.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
if(Math.random() * 10 > 5){
block.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
}
}
if(block.getTypeId() == 21){
mat = Material.getMaterial(351);
item = new ItemStack(mat, 1, (byte)0,(byte)0x4);
block.getWorld().dropItemNaturally(loc, item);
block.getWorld().dropItemNaturally(loc, item);
block.getWorld().dropItemNaturally(loc, item);
block.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
}
if(block.getTypeId() == 56){
mat = Material.getMaterial(264);
item = new ItemStack(mat, 1, (byte)0, damage);
block.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
}
if(block.getTypeId() == 1){
mat = Material.getMaterial(4);
item = new ItemStack(mat, 1, (byte)0, damage);
block.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
}
if(block.getTypeId() == 16){
mat = Material.getMaterial(263);
item = new ItemStack(mat, 1, (byte)0, damage);
block.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
}
}
public void blockProcCheck(Block block, Player player){
@ -525,21 +744,25 @@ public class mcm {
if(herp != null && herp.getTypeId() != 0)
defender.getLocation().getWorld().dropItemNaturally(defender.getLocation(), herp);
}
/*
for(Player derp : plugin.getServer().getOnlinePlayers()){
derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName());
mcUsers.getProfile(defender).setDead(true);
}
*/
}
return;
}
if(mcUsers.getProfile(defender).isDead())
return;
/*
if((defender.getHealth() - event.getDamage()) <= 0 && defender.getHealth() != 0){
for(Player derp : plugin.getServer().getOnlinePlayers()){
derp.sendMessage(ChatColor.GRAY+attacker.getName() + " has " +ChatColor.DARK_RED+"slain "+ChatColor.GRAY+defender.getName());
mcUsers.getProfile(defender).setDead(true);
}
}
*/
//Moving this below the death message for now, seems to have issues when the defender is not in a party
if((mcUsers.getProfile(defender).inParty() && mcUsers.getProfile(attacker).inParty())&& mcUsers.getProfile(defender).getParty().equals(mcUsers.getProfile(attacker).getParty()))
event.setCancelled(true);
@ -810,6 +1033,60 @@ public class mcm {
return health;
}
}
public void axeCriticalCheckAnimals(Player attacker, EntityDamageByEntityEvent event, Entity x){
if(isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
if(mcUsers.getProfile(attacker).getAxesInt() >= 50 && mcUsers.getProfile(attacker).getAxesInt() < 250){
if(Math.random() * 100 > 95){
if(x instanceof Animals){
Animals animal = (Animals)x;
animal.setHealth(0);
simulateNaturalDrops(x);
attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!");
}
}
}
if(mcUsers.getProfile(attacker).getAxesInt() >= 250 && mcUsers.getProfile(attacker).getAxesInt() < 500){
if(Math.random() * 10 > 9){
if(x instanceof Animals){
Animals animal = (Animals)x;
animal.setHealth(0);
simulateNaturalDrops(x);
attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!");
}
}
}
if(mcUsers.getProfile(attacker).getAxesInt() >= 500 && mcUsers.getProfile(attacker).getAxesInt() < 750){
if(Math.random() * 10 > 8){
if(x instanceof Animals){
Animals animal = (Animals)x;
animal.setHealth(0);
simulateNaturalDrops(x);
attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!");
}
}
}
if(mcUsers.getProfile(attacker).getAxesInt() >= 750 && mcUsers.getProfile(attacker).getAxesInt() < 1000){
if(Math.random() * 10 > 7){
if(x instanceof Animals){
Animals animal = (Animals)x;
animal.setHealth(0);
simulateNaturalDrops(x);
attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!");
}
}
}
if(mcUsers.getProfile(attacker).getAxesInt() >= 1000){
if(Math.random() * 10 > 6){
if(x instanceof Animals){
Animals animal = (Animals)x;
animal.setHealth(0);
simulateNaturalDrops(x);
attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!");
}
}
}
}
}
public void axeCriticalCheckMonster(Player attacker, EntityDamageByEntityEvent event, Entity x){
if(isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
if(mcUsers.getProfile(attacker).getAxesInt() >= 50 && mcUsers.getProfile(attacker).getAxesInt() < 250){
@ -818,7 +1095,7 @@ public class mcm {
Monster monster = (Monster)x;
monster.setHealth(0);
simulateNaturalDrops(x);
attacker.sendMessage("CRITICAL HIT!");
attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!");
}
}
}
@ -828,7 +1105,7 @@ public class mcm {
Monster monster = (Monster)x;
monster.setHealth(0);
simulateNaturalDrops(x);
attacker.sendMessage("CRITICAL HIT!");
attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!");
}
}
}
@ -838,7 +1115,7 @@ public class mcm {
Monster monster = (Monster)x;
monster.setHealth(0);
simulateNaturalDrops(x);
attacker.sendMessage("CRITICAL HIT!");
attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!");
}
}
}
@ -848,7 +1125,7 @@ public class mcm {
Monster monster = (Monster)x;
monster.setHealth(0);
simulateNaturalDrops(x);
attacker.sendMessage("CRITICAL HIT!");
attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!");
}
}
}
@ -858,7 +1135,7 @@ public class mcm {
Monster monster = (Monster)x;
monster.setHealth(0);
simulateNaturalDrops(x);
attacker.sendMessage("CRITICAL HIT!");
attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!");
}
}
}
@ -871,7 +1148,7 @@ public class mcm {
if(x instanceof Player){
Player player = (Player)x;
player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage())));
attacker.sendMessage("CRITICAL HIT!");
attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!");
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
}
}
@ -881,7 +1158,7 @@ public class mcm {
if(x instanceof Player){
Player player = (Player)x;
player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage())));
attacker.sendMessage("CRITICAL HIT!");
attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!");
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
}
}
@ -891,7 +1168,7 @@ public class mcm {
if(x instanceof Player){
Player player = (Player)x;
player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage())));
attacker.sendMessage("CRITICAL HIT!");
attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!");
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
}
}
@ -901,7 +1178,7 @@ public class mcm {
if(x instanceof Player){
Player player = (Player)x;
player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage())));
attacker.sendMessage("CRITICAL HIT!");
attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!");
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
}
}
@ -911,7 +1188,7 @@ public class mcm {
if(x instanceof Player){
Player player = (Player)x;
player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage())));
attacker.sendMessage("CRITICAL HIT!");
attacker.sendMessage(ChatColor.RED+"CRTICIAL HIT!");
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
}
}
@ -1075,7 +1352,7 @@ public class mcm {
player.sendMessage(ChatColor.GRAY+"depend on the block you're digging.");
player.sendMessage(ChatColor.GRAY+"Different blocks give diffrent stuff.");
}
if(split[0].equalsIgnoreCase("/mcmmo")){
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.mcmmo)){
event.setCancelled(true);
player.sendMessage(ChatColor.GRAY+"mcMMO is an RPG inspired plugin");
player.sendMessage(ChatColor.GRAY+"You can gain skills in several professions by");
@ -1096,25 +1373,25 @@ public class mcm {
player.sendMessage(ChatColor.GREEN+"Appreciate the mod? ");
player.sendMessage(ChatColor.GREEN+"You can donate via paypal to"+ChatColor.DARK_RED+" nossr50@gmail.com");
}
if(split[0].equalsIgnoreCase("/mcc")){
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.mcc)){
event.setCancelled(true);
player.sendMessage(ChatColor.GRAY+"mcMMO has a party system included");
player.sendMessage(ChatColor.GREEN+"~~Commands~~");
if(mcPermissions.getInstance().party(player)){
player.sendMessage(ChatColor.GRAY+"/party <name> - to join a party");
player.sendMessage(ChatColor.GRAY+"/party q - to quit a party");
player.sendMessage(ChatColor.GRAY+"/"+mcLoadProperties.party+" <name> - to join a party");
player.sendMessage(ChatColor.GRAY+"/"+mcLoadProperties.party+" q - to quit a party");
}
if(mcPermissions.getInstance().partyTeleport(player))
player.sendMessage(ChatColor.GRAY+"/ptp <name> - party teleport");
player.sendMessage(ChatColor.GRAY+"/"+mcLoadProperties.ptp+" <name> - party teleport");
if(mcPermissions.getInstance().partyChat(player))
player.sendMessage(ChatColor.GRAY+"/p - toggles party chat");
player.sendMessage(ChatColor.GREEN+"/stats"+ChatColor.GRAY+" - Check current skill levels");
player.sendMessage(ChatColor.GREEN+"/"+mcLoadProperties.stats+ChatColor.GRAY+" - Check current skill levels");
if(mcPermissions.getInstance().setMySpawn(player))
player.sendMessage(ChatColor.GRAY+"/setmyspawn - Skill info");
player.sendMessage(ChatColor.GRAY+"/"+mcLoadProperties.setmyspawn+" - Sets your spawn");
if(mcPermissions.getInstance().mySpawn(player))
player.sendMessage(ChatColor.GRAY+"/myspawn - travel to myspawn, clears inventory");
player.sendMessage(ChatColor.GRAY+"/"+mcLoadProperties.myspawn+" - travel to myspawn, clears inventory");
if(mcPermissions.getInstance().whois(player) || player.isOp())
player.sendMessage(ChatColor.GRAY+"/whois - view detailed info about a player (req op)");
player.sendMessage(ChatColor.GRAY+"/"+mcLoadProperties.whois+" - view detailed info about a player (req op)");
player.sendMessage(ChatColor.GRAY+"/woodcutting - Skill info");
player.sendMessage(ChatColor.GRAY+"/mining - Skill info");
player.sendMessage(ChatColor.GRAY+"/repair - Skill info");
@ -1128,7 +1405,7 @@ public class mcm {
player.sendMessage(ChatColor.GRAY+"/invite - Invite players to your party");
player.sendMessage(ChatColor.GRAY+"/accept - Accept an invite");
if(mcPermissions.getInstance().mmoedit(player))
player.sendMessage(ChatColor.GRAY+"/mmoedit - Modify mcMMO skills of players/yourself");
player.sendMessage(ChatColor.GRAY+"/"+mcLoadProperties.mmoedit+" - Modify mcMMO skills of players/yourself");
}
}
public void repairCheck(Player player, ItemStack is, Block block){
@ -1354,34 +1631,34 @@ public class mcm {
byte damage = 0;
if(mcUsers.getProfile(player).getWoodCuttingint() > 1000){
ItemStack item = new ItemStack(mat, 1, type, damage);
block.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
return;
}
if(mcUsers.getProfile(player).getWoodCuttingint() > 750){
if((Math.random() * 10) > 2){
ItemStack item = new ItemStack(mat, 1, type, damage);
block.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
return;
}
}
if(mcUsers.getProfile(player).getWoodCuttingint() > 300){
if((Math.random() * 10) > 4){
ItemStack item = new ItemStack(mat, 1, type, damage);
block.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
return;
}
}
if(mcUsers.getProfile(player).getWoodCuttingint() > 100){
if((Math.random() * 10) > 6){
ItemStack item = new ItemStack(mat, 1, type, damage);
block.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
return;
}
}
if(mcUsers.getProfile(player).getWoodCuttingint() > 10){
if((Math.random() * 10) > 8){
ItemStack item = new ItemStack(mat, 1, type, damage);
block.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
return;
}
}

View File

@ -1,3 +1,3 @@
name: mcMMO
main: com.gmail.nossr50.mcMMO
version: 0.6
version: 0.6.2

View File

@ -0,0 +1,63 @@
package com.gmail.nossr50.vPlayersOnline;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.ChatColor;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Handle events for all Player related events
* @author nossr50
*/
public class vPlayerListener extends PlayerListener {
private final vPlayersOnline plugin;
protected static final Logger log = Logger.getLogger("Minecraft");
public vPlayerListener(vPlayersOnline instance) {
plugin = instance;
}
//Function to count the players
public int playerCount(){
Player players[] = plugin.getServer().getOnlinePlayers();
int x = 0;
for(Player hurrdurr: players){
x++;
}
return x;
}
//Message to be sent when a player joins
public void onPlayerJoin(PlayerEvent event) {
Player player = event.getPlayer();
//English Version
player.sendMessage(ChatColor.GREEN + "There are " + playerCount() + " players online.");
}
//Message to be sent when a player uses /list
public void onPlayerCommand(PlayerChatEvent event) {
String[] split = event.getMessage().split(" ");
Player player = event.getPlayer();
if(split[0].equalsIgnoreCase("/list") || split[0].equalsIgnoreCase("/who")){
event.setCancelled(true);
String tempList = "";
int x = 0;
for(Player p : plugin.getServer().getOnlinePlayers())
{
if(p != null && x+1 >= playerCount()){
tempList+= p.getName();
x++;
}
if(p != null && x < playerCount()){
tempList+= p.getName() +", ";
x++;
}
}
//Output the player list
player.sendMessage(ChatColor.RED + "Player List"+ChatColor.WHITE+" ("+ChatColor.WHITE + tempList+")");
player.sendMessage(ChatColor.RED + "Total Players: " + ChatColor.GREEN + playerCount());
}
}
}

View File

@ -0,0 +1,37 @@
package com.gmail.nossr50.vPlayersOnline;
import java.io.File;
import java.util.HashMap;
import org.bukkit.event.player.*;
import org.bukkit.Server;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginLoader;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.entity.Player;
/**
* vPlayersOnline for Bukkit
*
* @author nossr50
*/
public class vPlayersOnline extends JavaPlugin {
private final vPlayerListener playerListener = new vPlayerListener(this);
private final String name = "vPlayersOnline";
public void onEnable() {
PluginManager pm = getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_DROP_ITEM, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this);
//Displays a message when plugin is loaded
PluginDescriptionFile pdfFile = this.getDescription();
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
}
public void onDisable() {
System.out.println("vPlayersOnline disabled.");
}
}

View File

@ -1,3 +1,3 @@
name: vPlayersOnline
main: com.bukkit.nossr50.vPlayersOnline.vPlayersOnline
version: 1.3
main: com.gmail.nossr50.vPlayersOnline.vPlayersOnline
version: 1.5

View File

@ -1,12 +1,11 @@
package com.bukkit.nossr50.vStopFire;
import org.bukkit.Block;
import org.bukkit.BlockFace;
import org.bukkit.Material;
import org.bukkit.event.block.BlockCanBuildEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.block.Block;
/**
* vStopFire block listener

View File

@ -1,7 +1,7 @@
package com.bukkit.nossr50.vStopFire;
import org.bukkit.Location;
import org.bukkit.Player;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerListener;

View File

@ -1,15 +1,12 @@
package com.bukkit.nossr50.vStopFire;
import java.io.File;
import java.util.HashMap;
import org.bukkit.Player;
import org.bukkit.Server;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginLoader;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.PluginManager;
/**
* vStopFire for Bukkit
@ -19,15 +16,8 @@ import org.bukkit.plugin.PluginManager;
public class vStopFire extends JavaPlugin {
private final vPlayerListener playerListener = new vPlayerListener(this);
private final vBlockListener blockListener = new vBlockListener(this);
private final HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>();
private final String name = "vStopFire";
public vStopFire(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
super(pluginLoader, instance, desc, folder, plugin, cLoader);
}
public void onEnable() {
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Priority.Normal, this);
PluginDescriptionFile pdfFile = this.getDescription();
@ -36,15 +26,4 @@ public class vStopFire extends JavaPlugin {
public void onDisable() {
System.out.println("vStopFire disabled!");
}
public boolean isDebugging(final Player player) {
if (debugees.containsKey(player)) {
return debugees.get(player);
} else {
return false;
}
}
public void setDebugging(final Player player, final boolean value) {
debugees.put(player, value);
}
}

View File

@ -1,3 +1,3 @@
name: vStopFire
main: com.bukkit.nossr50.vStopFire.vStopFire
version: 1.0
version: 1.1

View File

@ -0,0 +1,11 @@
package com.gmail.nossr50.woolplus;
import org.bukkit.Material;
import org.bukkit.event.block.BlockListener;
public class wBlockListener extends BlockListener {
private final woolplus plugin;
public wBlockListener(final woolplus plugin) {
this.plugin = plugin;
}
}

View File

@ -0,0 +1,306 @@
package com.gmail.nossr50.woolplus;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerItemEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
public class wPlayerListener extends PlayerListener {
private final woolplus plugin;
public wPlayerListener(woolplus instance) {
plugin = instance;
}
public void onPlayerItem(PlayerItemEvent event) {
Player player = event.getPlayer();
ItemStack item = event.getPlayer().getItemInHand();
Block block = event.getBlockClicked();
if(block != null && item != null && isDye(item) && isWool(block)){
dyeWool(block, item, player);
}
}
public boolean isDye(ItemStack item){
int type = item.getTypeId();
if(type == 351 || type == 352){
return true;
} else {
return false;
}
}
public boolean isWool(Block block){
int type = block.getTypeId();
if(type == 35){
return true;
} else {
return false;
}
}
public boolean isBoneMeal(ItemStack item){
int type = item.getTypeId();
short durability = item.getDurability();
if(type == 351 && durability == 15){
return true;
} else {
return false;
}
}
public void consumeDye(short type, Player player){
ItemStack[] inventory = player.getInventory().getContents();
for (ItemStack x : inventory){
if(x.getTypeId() == 351 && x.getDurability() == type){
if(x.getAmount() == 1){
x.setAmount(0);
x.setTypeId(0);
}
if(x.getAmount() > 1)
x.setAmount(x.getAmount() - 1);
player.getInventory().setContents(inventory);
}
}
player.updateInventory();
}
public boolean isLightColoredWool(byte wool){
if(wool == 4 || wool == 5 || wool == 6 || wool == 9 || wool == 2 || wool == 3){
return true;
} else {
return false;
}
}
public void dyeWool(Block block, ItemStack item, Player player){
MaterialData mdye = item.getData();
byte dye = mdye.getData();
byte wool = block.getData();
short durability = item.getDurability();
/*
* WOOL LIGHTENING
*/
//Black dyes everything you know!
if(durability == 0 && wool != 15){
block.setData((byte) 15);
consumeDye(item.getDurability(), player);
return;
}
//BLACK -> GRAY
if(wool == 15 && isBoneMeal(item)){
block.setData((byte) 7);
consumeDye(item.getDurability(), player);
return;
}
//GRAY -> LGRAY
if(wool == 7 && isBoneMeal(item)){
block.setData((byte) 8);
consumeDye(item.getDurability(), player);
return;
}
//BROWN -> GRAY
if(wool == 12 && isBoneMeal(item)){
block.setData((byte) 7);
consumeDye(item.getDurability(), player);
return;
}
//LGRAY -> WHITE
if(wool == 8 && isBoneMeal(item)){
block.setData((byte) 0);
consumeDye(item.getDurability(), player);
return;
}
//RED (14) -> PINK (6)
if(wool == 14 && isBoneMeal(item)){
block.setData((byte) 6);
consumeDye(item.getDurability(), player);
return;
}
//GREEN13 -> LIME5
if(wool == 13 && isBoneMeal(item)){
block.setData((byte) 5);
consumeDye(item.getDurability(), player);
return;
}
//BLUE11 -> CYAN9
if(wool == 11 && isBoneMeal(item)){
block.setData((byte) 9);
consumeDye(item.getDurability(), player);
return;
}
//CYAN9 -> LIGHT BLUE3
if(wool == 9 && isBoneMeal(item)){
block.setData((byte) 3);
consumeDye(item.getDurability(), player);
return;
}
//PURPLE10 -> MAGENTA2
if(wool == 10 && isBoneMeal(item)){
block.setData((byte) 2);
consumeDye(item.getDurability(), player);
return;
}
/*
* WOOL COMBINATIONS
*/
//Red + Yellow = Orange
//If wool is red, dye is yellow
if(wool == 14 && durability == 11){
block.setData((byte) 1);
consumeDye(item.getDurability(), player);
return;
}
//If wool is yellow, dye is red
if(wool == 4 && durability == 1){
block.setData((byte) 1);
consumeDye(item.getDurability(), player);
return;
}
//Lapis + Green = Cyan
//if wool is Lapis/Blue, dye is green
if(wool == 11 && durability == 2){
block.setData((byte) 9);
consumeDye(item.getDurability(), player);
return;
}
//if wool is Green, dye is lapis
if(wool == 13 && durability == 4){
block.setData((byte) 9);
consumeDye(item.getDurability(), player);
return;
}
//Red + Lapis = Purple
//if wool is Red, dye is Lapis
if(wool == 14 && durability == 4){
block.setData((byte) 10);
consumeDye(item.getDurability(), player);
return;
}
//if wool is Lapis/Blue, dye is red
if(wool == 11 && durability == 1){
block.setData((byte) 10);
consumeDye(item.getDurability(), player);
return;
}
//Purple + Pink = Magenta
//if wool is Purple, dye is pink
if(wool == 10 && durability == 9){
block.setData((byte) 2);
consumeDye(item.getDurability(), player);
return;
}
//if wool is pink, dye is purple
if(wool == 6 && durability == 5){
block.setData((byte) 2);
consumeDye(item.getDurability(), player);
return;
}
/*
* REGULAR DYE SECTION
*/
if(wool == 0){
//orange
if(durability == 14){
block.setData((byte) 1);
consumeDye(item.getDurability(), player);
return;
}
//magenta
if (durability == 13){
block.setData((byte) 2);
consumeDye(item.getDurability(), player);
return;
}
//light blue
if(durability == 12){
block.setData((byte) 3);
consumeDye(item.getDurability(), player);
return;
}
//yellow
if(durability == 11){
block.setData((byte) 4);
consumeDye(item.getDurability(), player);
return;
}
//lime
if(durability == 10){
block.setData((byte) 5);
consumeDye(item.getDurability(), player);
return;
}
//pink
if(durability == 9){
block.setData((byte) 6);
consumeDye(item.getDurability(), player);
return;
}
//gray
if(durability == 8){
block.setData((byte) 7);
consumeDye(item.getDurability(), player);
return;
}
//light gray
if(durability == 7){
block.setData((byte) 8);
consumeDye(item.getDurability(), player);
return;
}
//cyan
if(durability == 6){
block.setData((byte) 9);
consumeDye(item.getDurability(), player);
return;
}
//purple
if(durability == 5){
block.setData((byte) 10);
consumeDye(item.getDurability(), player);
return;
}
//lapis or blue
if(durability == 4){
block.setData((byte) 11);
consumeDye(item.getDurability(), player);
return;
}
//coco or brown
if(durability == 3){
block.setData((byte) 12);
consumeDye(item.getDurability(), player);
return;
}
//green
if(durability == 2){
block.setData((byte) 13);
consumeDye(item.getDurability(), player);
return;
}
//red
if(durability == 1){
block.setData((byte) 14);
consumeDye(item.getDurability(), player);
return;
}
}
/*
* BROWN CONVERSION
*/
if(!isBoneMeal(item) && durability != 0 && wool != 12){
block.setData((byte) 12);
consumeDye(item.getDurability(), player);
return;
}
if(isBoneMeal(item) && wool != 0 && !isLightColoredWool(wool)){
block.setData((byte) 7);
consumeDye(item.getDurability(), player);
return;
}
if(isBoneMeal(item) && wool != 0 && isLightColoredWool(wool)){
block.setData((byte) 0);
consumeDye(item.getDurability(), player);
return;
}
}
}

View File

@ -0,0 +1,29 @@
package com.gmail.nossr50.woolplus;
import java.io.File;
import org.bukkit.Server;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginLoader;
import org.bukkit.plugin.java.JavaPlugin;
/**
* Wool Plus for Bukkit
*
* @author nossr50
*/
public class woolplus extends JavaPlugin {
private final wPlayerListener playerListener = new wPlayerListener(this);
private final wBlockListener blockListener = new wBlockListener(this);
private final String name = "Wool Plus";
public void onEnable() {
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.Normal, this);
PluginDescriptionFile pdfFile = this.getDescription();
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
}
public void onDisable() {
System.out.println("Wool Plus disabled!");
}
}

3
woolplus/plugin.yml Normal file
View File

@ -0,0 +1,3 @@
name: woolplus
main: com.gmail.nossr50.woolplus.woolplus
version: 1.2