diff --git a/BackOff/.classpath b/BackOff/.classpath
deleted file mode 100644
index c7455396a..000000000
--- a/BackOff/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/BackOff/.project b/BackOff/.project
deleted file mode 100644
index 9a37bd8d7..000000000
--- a/BackOff/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- BackOff
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
diff --git a/BackOff/.settings/org.eclipse.jdt.core.prefs b/BackOff/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index ee0c391d9..000000000
--- a/BackOff/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,12 +0,0 @@
-#Sat Feb 05 17:28:29 PST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/BackOff/bin/com/bukkit/nossr50/BackOff/BackOff.class b/BackOff/bin/com/bukkit/nossr50/BackOff/BackOff.class
deleted file mode 100644
index 901ba79dc..000000000
Binary files a/BackOff/bin/com/bukkit/nossr50/BackOff/BackOff.class and /dev/null differ
diff --git a/BackOff/bin/com/bukkit/nossr50/BackOff/bPlayerListener.class b/BackOff/bin/com/bukkit/nossr50/BackOff/bPlayerListener.class
deleted file mode 100644
index 3e37b6e31..000000000
Binary files a/BackOff/bin/com/bukkit/nossr50/BackOff/bPlayerListener.class and /dev/null differ
diff --git a/BackOff/bin/plugin.yml b/BackOff/bin/plugin.yml
deleted file mode 100644
index f471fca9f..000000000
--- a/BackOff/bin/plugin.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-name: BackOff
-main: com.bukkit.nossr50.BackOff.BackOff
-version: 1.0
\ No newline at end of file
diff --git a/BackOff/src/com/bukkit/nossr50/BackOff/BackOff.java b/BackOff/src/com/bukkit/nossr50/BackOff/BackOff.java
deleted file mode 100644
index 7093b7dda..000000000
--- a/BackOff/src/com/bukkit/nossr50/BackOff/BackOff.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.bukkit.nossr50.BackOff;
-
-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;
-
-/**
- * BackOff for Bukkit
- *
- * @author nossr50
- */
-public class BackOff extends JavaPlugin {
- private final bPlayerListener playerListener = new bPlayerListener(this);
- private final HashMap debugees = new HashMap();
- private final String name = "BackOff";
-
- public BackOff(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
- super(pluginLoader, instance, desc, folder, plugin, cLoader);
- }
-
- public void onEnable() {
- PluginManager pm = getServer().getPluginManager();
- pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Priority.Normal, this);
- pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this);
- pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Normal, this);
- PluginDescriptionFile pdfFile = this.getDescription();
- System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
- }
- public void onDisable() {
- System.out.println("BackOff disabled.");
- }
-}
-
diff --git a/BackOff/src/com/bukkit/nossr50/BackOff/bPlayerListener.java b/BackOff/src/com/bukkit/nossr50/BackOff/bPlayerListener.java
deleted file mode 100644
index 986d0e9d5..000000000
--- a/BackOff/src/com/bukkit/nossr50/BackOff/bPlayerListener.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package com.bukkit.nossr50.BackOff;
-
-import java.util.ArrayList;
-
-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.PlayerListener;
-import org.bukkit.event.player.PlayerMoveEvent;
-
-/**
- * Handle events for all Player related events
- * @author nossr50
- */
-
-
-public class bPlayerListener extends PlayerListener {
- private final BackOff plugin;
-
- static ArrayList backOffList = new ArrayList();
- public boolean isBackOff(String playerName) {return backOffList.contains(playerName);}
- public void removeBackOff(String playerName) {backOffList.remove(backOffList.indexOf(playerName));}
- public void addBackOff(String playerName) {backOffList.add(playerName);}
- static ArrayList ibackOffList = new ArrayList();
- public boolean isBackOffi(String playerName) {return ibackOffList.contains(playerName);}
- public void removeBackOffi(String playerName) {ibackOffList.remove(backOffList.indexOf(playerName));}
- public void addBackOffi(String playerName) {ibackOffList.add(playerName);}
-
- public static double getDistance(Player player1, Player player2)
- {
- return Math.sqrt(Math.pow(player1.getLocation().getX() - player2.getLocation().getX(), 2) + Math.pow(player1.getLocation().getY() - player2.getLocation().getY(), 2)
- + Math.pow(player1.getLocation().getZ() - player2.getLocation().getZ(), 2));
- }
- public static double getDistance(Location loc, Player player2)
- {
- return Math.sqrt(Math.pow(loc.getX() - player2.getLocation().getX(), 2) + Math.pow(loc.getY() - player2.getLocation().getY(), 2)
- + Math.pow(loc.getZ() - player2.getLocation().getZ(), 2));
- }
-
- public bPlayerListener(BackOff instance) {
- plugin = instance;
- }
- public boolean isPlayer(String playerName){
- for(Player herp : plugin.getServer().getOnlinePlayers()){
- if(herp.getName().toLowerCase().equals(playerName.toLowerCase())){
- return true;
- }
- }
- return false;
- }
- public Player getPlayer(String playerName){
- for(Player herp : plugin.getServer().getOnlinePlayers()){
- if(herp.getName().toLowerCase().equals(playerName.toLowerCase())){
- return herp;
- }
- }
- return null;
- }
- public void onPlayerMove(PlayerMoveEvent event) {
- Player player = event.getPlayer();
- Location to = event.getTo();
- Location from = event.getFrom();
- for (Player derp : plugin.getServer().getOnlinePlayers()){
- if(isBackOff(derp.getName()) && !isBackOffi(player.getName())){
- if(player != derp && (getDistance(player, derp) < 7)){
- if(getDistance(to, derp) > getDistance(from, derp)){
- player.teleportTo(event.getFrom());
- }
- }
- }
- }
- }
- public void onPlayerCommand(PlayerChatEvent event){
- String[] split = event.getMessage().split(" ");
- Player player = event.getPlayer();
- if(player.isOp() && split[0].equalsIgnoreCase("/backoff")){
- if(split.length == 1){
- if(isBackOff(player.getName())){
- removeBackOff(player.getName());
- player.sendMessage("Back off mode disabled");
- return;
- } else{
- addBackOff(player.getName());
- player.sendMessage("Back off mode enabled");
- return;
- }
- }
- if(isPlayer(split[1])){
- Player target = getPlayer(split[1]);
- if(isBackOffi(target.getName())){
- removeBackOffi(target.getName());
- target.sendMessage("Removed from back off mode immunity");
- if(!target.getName().equals(player.getName()))
- player.sendMessage("Removed " + target.getName() + " from back off mode");
- } else {
- addBackOffi(target.getName());
- target.sendMessage("Added to back off mode immunity");
- if(!target.getName().equals(player.getName()))
- player.sendMessage("Added " + target.getName() + " from back off mode");
- }
- }
- }
- }
-}
-
diff --git a/BackOff/src/plugin.yml b/BackOff/src/plugin.yml
deleted file mode 100644
index f471fca9f..000000000
--- a/BackOff/src/plugin.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-name: BackOff
-main: com.bukkit.nossr50.BackOff.BackOff
-version: 1.0
\ No newline at end of file
diff --git a/mcMMO/com/gmail/nossr50/mcBlockListener.java b/mcMMO/com/gmail/nossr50/mcBlockListener.java
index 687b36441..1f7df0f91 100644
--- a/mcMMO/com/gmail/nossr50/mcBlockListener.java
+++ b/mcMMO/com/gmail/nossr50/mcBlockListener.java
@@ -58,14 +58,14 @@ public class mcBlockListener extends BlockListener {
*/
if(block.getTypeId() == 17
&& mcPermissions.getInstance().woodcutting(player)){
- mcUsers.getProfile(player).addwgather(1);
- mcm.getInstance().woodCuttingProcCheck(player, block, loc);
+ mcUsers.getProfile(player).addwgather(1);
+ mcm.getInstance().woodCuttingProcCheck(player, block, loc);
}
mcm.getInstance().simulateSkillUp(player);
/*
* EXCAVATION
*/
- if(mcPermissions.getInstance().excavation(player))
+ if(mcPermissions.getInstance().excavation(player) && block != null && player != null)
mcm.getInstance().excavationProcCheck(block, player);
/*
* HERBALISM
diff --git a/mcMMO/com/gmail/nossr50/mcConfig.java b/mcMMO/com/gmail/nossr50/mcConfig.java
index 7e54955f3..377e48c5f 100644
--- a/mcMMO/com/gmail/nossr50/mcConfig.java
+++ b/mcMMO/com/gmail/nossr50/mcConfig.java
@@ -1,12 +1,15 @@
package com.gmail.nossr50;
-import java.util.ArrayList;
+import java.io.*;
+import java.util.*;
+import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
+import java.util.Map.Entry;
public class mcConfig {
private static volatile mcConfig instance;
@@ -28,6 +31,7 @@ public class mcConfig {
public void removeAdminToggled(String playerName) {adminChatList.remove(adminChatList.indexOf(playerName));}
public void addPartyToggled(String playerName) {partyChatList.add(playerName);}
public void addAdminToggled(String playerName) {adminChatList.add(playerName);}
+
public static mcConfig getInstance() {
if (instance == null) {
instance = new mcConfig();
@@ -48,49 +52,5 @@ public class mcConfig {
addPartyToggled(playerName);
}
}
- public void woodProcChecks(Player player, Block block, Location loc){
- if(mcUsers.getProfile(player).getWoodCuttingint() > 1000){
- Material mat = Material.getMaterial(block.getTypeId());
- byte damage = 0;
- ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
- block.getWorld().dropItemNaturally(loc, item);
- return;
- }
- if(mcUsers.getProfile(player).getWoodCuttingint() > 750){
- if((Math.random() * 10) > 2){
- Material mat = Material.getMaterial(block.getTypeId());
- byte damage = 0;
- ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
- block.getWorld().dropItemNaturally(loc, item);
- return;
- }
- }
- if(mcUsers.getProfile(player).getWoodCuttingint() > 300){
- if((Math.random() * 10) > 4){
- Material mat = Material.getMaterial(block.getTypeId());
- byte damage = 0;
- ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
- block.getWorld().dropItemNaturally(loc, item);
- return;
- }
- }
- if(mcUsers.getProfile(player).getWoodCuttingint() > 100){
- if((Math.random() * 10) > 6){
- Material mat = Material.getMaterial(block.getTypeId());
- byte damage = 0;
- ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
- block.getWorld().dropItemNaturally(loc, item);
- return;
- }
- }
- if(mcUsers.getProfile(player).getWoodCuttingint() > 10){
- if((Math.random() * 10) > 8){
- Material mat = Material.getMaterial(block.getTypeId());
- byte damage = 0;
- ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
- block.getWorld().dropItemNaturally(loc, item);
- return;
- }
- }
- }
+
}
\ No newline at end of file
diff --git a/mcMMO/com/gmail/nossr50/mcEntityListener.java b/mcMMO/com/gmail/nossr50/mcEntityListener.java
index fd62c1a57..b0afb8523 100644
--- a/mcMMO/com/gmail/nossr50/mcEntityListener.java
+++ b/mcMMO/com/gmail/nossr50/mcEntityListener.java
@@ -29,25 +29,6 @@ public class mcEntityListener extends EntityListener {
public mcEntityListener(final mcMMO plugin) {
this.plugin = plugin;
}
- public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
- Block block = event.getDamager();
- Entity x = event.getEntity();
- if(x instanceof Player){
- Player player = (Player)x;
- if(block != null && block.getTypeId() == 81){
- if(mcUsers.getProfile(player).isDead())
- return;
- /*
- if(player.getHealth() - event.getDamage() <= 0){
- mcUsers.getProfile(player).setDead(true);
- for(Player bidoof : plugin.getServer().getOnlinePlayers()){
- bidoof.sendMessage(ChatColor.GRAY+player.getName()+" has been"+ChatColor.DARK_GREEN+" cactus tickled "+ChatColor.GRAY+"to death.");
- }
- }
- */
- }
- }
- }
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
Entity x = event.getEntity(); //Defender
Entity y = event.getDamager(); //Attacker
@@ -110,7 +91,11 @@ public class mcEntityListener extends EntityListener {
*/
if(y instanceof Player){
Player attacker = (Player)y;
- if(mcPermissions.getInstance().archery(attacker)){
+ /*
+ * DEBUG MESSAGE
+ */
+ //attacker.sendMessage(event.getProjectile().toString());
+ if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){
/*
* Defender is Monster
*/
@@ -174,6 +159,10 @@ public class mcEntityListener extends EntityListener {
* Attacker is Player
*/
if(x instanceof Player){
+ if(mcLoadProperties.pvp == false){
+ event.setCancelled(true);
+ return;
+ }
Player defender = (Player)x;
/*
* Stuff for the daze proc
diff --git a/mcMMO/com/gmail/nossr50/mcLoadProperties.java b/mcMMO/com/gmail/nossr50/mcLoadProperties.java
new file mode 100644
index 000000000..27a009ac8
--- /dev/null
+++ b/mcMMO/com/gmail/nossr50/mcLoadProperties.java
@@ -0,0 +1,26 @@
+package com.gmail.nossr50;
+
+public class mcLoadProperties {
+ public static Boolean pvp, eggs, apples, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal;
+
+ public static void loadMain(){
+ String propertiesFile = mcMMO.maindirectory + "mcmmo.properties";
+ mcProperties properties = new mcProperties(propertiesFile);
+ properties.load();
+
+ //Grab properties stuff here
+ glowstone = properties.getBoolean("glowstone", true);
+ pvp = properties.getBoolean("pvp", true);
+ eggs = properties.getBoolean("eggs", true);
+ apples = properties.getBoolean("apples", true);
+ cake = properties.getBoolean("cake", true);
+ music = properties.getBoolean("music", true);
+ diamond = properties.getBoolean("diamond", true);
+ slowsand = properties.getBoolean("slowsand", true);
+ sulphur = properties.getBoolean("sulphur", true);
+ netherrack = properties.getBoolean("netherrack", true);
+ bones = properties.getBoolean("bones", true);
+ properties.save("==McMMO Configuration==");
+ //herp derp
+ }
+}
\ No newline at end of file
diff --git a/mcMMO/com/gmail/nossr50/mcMMO.java b/mcMMO/com/gmail/nossr50/mcMMO.java
index 1d6a0751c..18950b69f 100644
--- a/mcMMO/com/gmail/nossr50/mcMMO.java
+++ b/mcMMO/com/gmail/nossr50/mcMMO.java
@@ -6,6 +6,7 @@ import com.nijiko.permissions.Control;
import com.nijikokun.bukkit.Permissions.Permissions;
import org.bukkit.plugin.Plugin;
import java.io.File;
+import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.logging.Level;
@@ -22,6 +23,8 @@ import org.bukkit.entity.Player;
public class mcMMO extends JavaPlugin {
+ static String maindirectory = "mcMMO/";
+ static File Properties = new File(maindirectory + "mcmmo.properties");
public static final Logger log = Logger.getLogger("Minecraft");
private final mcPlayerListener playerListener = new mcPlayerListener(this);
private final mcBlockListener blockListener = new mcBlockListener(this);
@@ -36,6 +39,48 @@ public class mcMMO extends JavaPlugin {
}
public void onEnable() {
+ //Make the directory if it does not exist
+ new File(maindirectory).mkdir();
+ //Make the file if it does not exist
+ if(!Properties.exists()){
+ try {
+ Properties.createNewFile();
+ FileWriter writer = null;
+ try {
+ writer = new FileWriter(Properties);
+ writer.append("#Turn this setting to false to disable pvp interactions completely");
+ writer.append("pvp=true");
+ writer.append("#Excavation Loot Toggles");
+ writer.append("eggs=true");
+ writer.append("apples=true");
+ writer.append("cake=true");
+ writer.append("music=true");
+ writer.append("diamond=true");
+ writer.append("glowstone=true");
+ writer.append("slowsand=true");
+ writer.append("netherrack=true");
+ writer.append("bones=true");
+ writer.append("sulphur=true");
+ writer.append("coal=true");
+ 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);
+ } finally {
+ try {
+ if (writer != null) {
+ writer.close();
+ }
+ } catch (IOException e) {
+ log.log(Level.SEVERE, "Exception while closing writer for " + Properties, e);
+ }
+ }
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ //Load the file
+ mcLoadProperties.loadMain();
mcUsers.getInstance().loadUsers();
PluginManager pm = getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
@@ -70,10 +115,11 @@ public class mcMMO extends JavaPlugin {
}
}
}
+
public Permissions getPermissions() {
return permissions;
}
public void onDisable() {
- System.out.println("mcMMO disabled.");
+ System.out.println("mcMMO was disabled.");
}
}
diff --git a/mcMMO/com/gmail/nossr50/mcPermissions.java b/mcMMO/com/gmail/nossr50/mcPermissions.java
index bc90368cc..303ab40a3 100644
--- a/mcMMO/com/gmail/nossr50/mcPermissions.java
+++ b/mcMMO/com/gmail/nossr50/mcPermissions.java
@@ -154,6 +154,13 @@ public class mcPermissions {
return true;
}
}
+ public boolean axes(Player player) {
+ if (permissionsEnabled) {
+ return permission(player, "mcmmo.skills.axes");
+ } else {
+ return true;
+ }
+ }
public boolean acrobatics(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.skills.acrobatics");
diff --git a/mcMMO/com/gmail/nossr50/mcPlayerListener.java b/mcMMO/com/gmail/nossr50/mcPlayerListener.java
index c554db9f9..d4d4a6982 100644
--- a/mcMMO/com/gmail/nossr50/mcPlayerListener.java
+++ b/mcMMO/com/gmail/nossr50/mcPlayerListener.java
@@ -31,6 +31,7 @@ public class mcPlayerListener extends PlayerListener {
if(mcUsers.getProfile(player).getMySpawn(player) != null)
event.setRespawnLocation(mcUsers.getProfile(player).getMySpawn(player));
}
+ //HELLO CODE PEAKERS!
}
public Player[] getPlayersOnline() {
return plugin.getServer().getOnlinePlayers();
@@ -177,7 +178,7 @@ public class mcPlayerListener extends PlayerListener {
player.sendMessage("Excavation Skill: "+mcUsers.getProfile(target).getExcavation());
player.sendMessage("Archery Skill: "+mcUsers.getProfile(target).getArchery());
player.sendMessage("Swords Skill: "+mcUsers.getProfile(target).getSwords());
- //player.sendMessage("Axes Skill: "+mcUsers.getProfile(target).getAxes());
+ player.sendMessage("Axes Skill: "+mcUsers.getProfile(target).getAxes());
player.sendMessage("Acrobatics Skill: "+mcUsers.getProfile(target).getAcrobatics());
player.sendMessage(ChatColor.GREEN+"~~COORDINATES~~");
player.sendMessage("X: "+x);
@@ -208,7 +209,7 @@ public class mcPlayerListener extends PlayerListener {
player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getExcavation());
player.sendMessage(ChatColor.YELLOW + "Archery Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getArchery());
player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getSwords());
- //player.sendMessage(ChatColor.YELLOW+ "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAxes());
+ player.sendMessage(ChatColor.YELLOW+ "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAxes());
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAcrobatics());
player.sendMessage(ChatColor.DARK_RED+"TOTAL SKILL: "+ChatColor.GREEN+
(mcUsers.getProfile(player).getAcrobaticsInt()+
@@ -341,9 +342,6 @@ public class mcPlayerListener extends PlayerListener {
player.sendMessage(ChatColor.RED+"Configure your myspawn first with /setmyspawn");
}
}
- }
- public void onItemHeldChange(PlayerItemHeldEvent event) {
- Player player = event.getPlayer();
}
public void onPlayerChat(PlayerChatEvent event) {
Player player = event.getPlayer();
diff --git a/mcMMO/com/gmail/nossr50/mcProperties.java b/mcMMO/com/gmail/nossr50/mcProperties.java
new file mode 100644
index 000000000..9d1135b23
--- /dev/null
+++ b/mcMMO/com/gmail/nossr50/mcProperties.java
@@ -0,0 +1,64 @@
+package com.gmail.nossr50;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+public class mcProperties extends Properties{
+//private static volatile mcProperties instance;
+private String fileName;
+public mcProperties(String file) {
+ this.fileName = file;
+}
+public void load() {
+ File file = new File(this.fileName);
+ if(file.exists()) {
+ try {
+ load(new FileInputStream(this.fileName));
+ } catch (IOException ex) {
+
+ }
+ }
+}
+public void save(String start){
+ try{
+ store(new FileOutputStream(this.fileName), start);
+ } catch (IOException ex) {
+
+ }
+}
+public int getInteger(String key, int value){
+ if(containsKey(key)){
+ return Integer.parseInt(getProperty(key));
+ }
+ put(key, String.valueOf(value));
+ return value;
+}
+public String getString(String key, String value){
+ if(containsKey(key)){
+ return getProperty(key);
+ }
+ put(key, value);
+ return value;
+}
+public Boolean getBoolean(String key, boolean value) {
+ if (containsKey(key)) {
+ String boolString = getProperty(key);
+ return (boolString.length() > 0)
+ && (boolString.toLowerCase().charAt(0) == 't');
+ }
+ put(key, value ? "true" : "false");
+ return value;
+}
+public double getDouble(String key, double value) {
+ if (containsKey(key)) {
+ return Double.parseDouble(getProperty(key));
+ }
+
+ put(key, String.valueOf(value));
+ return value;
+}
+
+}
diff --git a/mcMMO/com/gmail/nossr50/mcm.java b/mcMMO/com/gmail/nossr50/mcm.java
index 4fa3d7e55..dd8e0289c 100644
--- a/mcMMO/com/gmail/nossr50/mcm.java
+++ b/mcMMO/com/gmail/nossr50/mcm.java
@@ -61,6 +61,9 @@ public class mcm {
else if(skillname.equals("woodcutting")){
return true;
}
+ else if(skillname.equals("excavation")){
+ return true;
+ }
else if(skillname.equals("repair")){
return true;
}
@@ -78,7 +81,11 @@ public class mcm {
}
else if(skillname.equals("unarmed")){
return true;
- } else {
+ }
+ else if(skillname.equals("axes")){
+ return true;
+ }
+ else {
return false;
}
}
@@ -91,6 +98,7 @@ public class mcm {
}
return true;
}
+
public void simulateNaturalDrops(Entity entity){
Location loc = entity.getLocation();
if(entity instanceof Pig){
@@ -427,6 +435,13 @@ public class mcm {
return false;
}
}
+ public boolean isAxes(ItemStack is){
+ if(is.getTypeId() == 271 || is.getTypeId() == 258 || is.getTypeId() == 286 || is.getTypeId() == 279 || is.getTypeId() == 275){
+ return true;
+ } else {
+ return false;
+ }
+ }
public boolean simulateUnarmedProc(Player player){
if(mcUsers.getProfile(player).getUnarmedInt() >= 750){
if(Math.random() * 10 > 4){
@@ -441,6 +456,10 @@ public class mcm {
}
public void playerVersusPlayerChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, Plugin plugin){
if(x instanceof Player){
+ if(mcLoadProperties.pvp == false){
+ event.setCancelled(true);
+ return;
+ }
Player defender = (Player)x;
if(mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){
if(inSameParty(defender, attacker)){
@@ -448,6 +467,10 @@ public class mcm {
return;
}
}
+ /*
+ * AXE CRITICAL CHECK
+ */
+ axeCriticalCheckPlayer(attacker, event, x, plugin);
if(mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0){
//DMG MODIFIER
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
@@ -531,6 +554,23 @@ public class mcm {
attacker.sendMessage(ChatColor.YELLOW+"Swords skill increased by 1. Total ("+mcUsers.getProfile(attacker).getSwords()+")");
}
}
+ if(isAxes(attacker.getItemInHand())
+ && defender.getHealth() > 0
+ && mcPermissions.getInstance().axes(attacker)){
+ if(Math.random() * 10 > 9){
+ mcUsers.getProfile(attacker).skillUpAxes(1);
+ attacker.sendMessage(ChatColor.YELLOW+"Axes skill increased by 1. Total ("+mcUsers.getProfile(attacker).getAxes()+")");
+ }
+ }
+ if(isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
+ if(defender.getHealth() <= 0)
+ return;
+ if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
+ defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId()))));
+ }
+ if(defender.getHealth() <= 0)
+ mcm.getInstance().simulateNaturalDrops(defender);
+ }
/*
* UNARMED VS SQUID
*/
@@ -568,8 +608,17 @@ public class mcm {
}
public void playerVersusAnimalsChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, int type){
if(x instanceof Animals){
- if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
Animals defender = (Animals)event.getEntity();
+ if(isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
+ if(defender.getHealth() <= 0)
+ return;
+ if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
+ defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId()))));
+ }
+ if(defender.getHealth() <= 0)
+ mcm.getInstance().simulateNaturalDrops(defender);
+ }
+ if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
if(defender.getHealth() <= 0)
return;
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
@@ -630,6 +679,10 @@ public class mcm {
}
public void playerVersusMonsterChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
if(x instanceof Monster){
+ /*
+ * AXE PROC CHECKS
+ */
+ axeCriticalCheckMonster(attacker, event, x);
Monster defender = (Monster)event.getEntity();
if(isSwords(attacker.getItemInHand())
&& defender.getHealth() > 0
@@ -639,6 +692,26 @@ public class mcm {
attacker.sendMessage(ChatColor.YELLOW+"Swords skill increased by 1. Total ("+mcUsers.getProfile(attacker).getSwords()+")");
}
}
+ if(isAxes(attacker.getItemInHand())
+ && defender.getHealth() > 0
+ && mcPermissions.getInstance().axes(attacker)){
+ if(Math.random() * 10 > 9){
+ mcUsers.getProfile(attacker).skillUpAxes(1);
+ attacker.sendMessage(ChatColor.YELLOW+"Axes skill increased by 1. Total ("+mcUsers.getProfile(attacker).getAxes()+")");
+ }
+ }
+ /*
+ * AXE DAMAGE SCALING && LOOT CHECKS
+ */
+ if(isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
+ if(defender.getHealth() <= 0)
+ return;
+ if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
+ defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId()))));
+ }
+ if(defender.getHealth() <= 0)
+ mcm.getInstance().simulateNaturalDrops(defender);
+ }
if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
if(defender.getHealth() <= 0)
return;
@@ -689,6 +762,18 @@ public class mcm {
}
}
}
+ public int axeNerf(int type){
+ //GOLD OR WOOD
+ if(type == 271 || type == 286){
+ return 3;
+ } else if (type == 258){
+ return 1;
+ } else if (type == 275){
+ return 1;
+ } else {
+ return 0;
+ }
+ }
public int calculateDamage(Player player, int dmg){
int health = player.getHealth();
if(health - dmg <0){
@@ -725,6 +810,129 @@ public class mcm {
return health;
}
}
+ 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){
+ if(Math.random() * 100 > 95){
+ if(x instanceof Monster){
+ Monster monster = (Monster)x;
+ monster.setHealth(0);
+ simulateNaturalDrops(x);
+ attacker.sendMessage("CRITICAL HIT!");
+ }
+ }
+ }
+ if(mcUsers.getProfile(attacker).getAxesInt() >= 250 && mcUsers.getProfile(attacker).getAxesInt() < 500){
+ if(Math.random() * 10 > 9){
+ if(x instanceof Monster){
+ Monster monster = (Monster)x;
+ monster.setHealth(0);
+ simulateNaturalDrops(x);
+ attacker.sendMessage("CRITICAL HIT!");
+ }
+ }
+ }
+ if(mcUsers.getProfile(attacker).getAxesInt() >= 500 && mcUsers.getProfile(attacker).getAxesInt() < 750){
+ if(Math.random() * 10 > 8){
+ if(x instanceof Monster){
+ Monster monster = (Monster)x;
+ monster.setHealth(0);
+ simulateNaturalDrops(x);
+ attacker.sendMessage("CRITICAL HIT!");
+ }
+ }
+ }
+ if(mcUsers.getProfile(attacker).getAxesInt() >= 750 && mcUsers.getProfile(attacker).getAxesInt() < 1000){
+ if(Math.random() * 10 > 7){
+ if(x instanceof Monster){
+ Monster monster = (Monster)x;
+ monster.setHealth(0);
+ simulateNaturalDrops(x);
+ attacker.sendMessage("CRITICAL HIT!");
+ }
+ }
+ }
+ if(mcUsers.getProfile(attacker).getAxesInt() >= 1000){
+ if(Math.random() * 10 > 6){
+ if(x instanceof Monster){
+ Monster monster = (Monster)x;
+ monster.setHealth(0);
+ simulateNaturalDrops(x);
+ attacker.sendMessage("CRITICAL HIT!");
+ }
+ }
+ }
+ }
+ }
+ public void axeCriticalCheckPlayer(Player attacker, EntityDamageByEntityEvent event, Entity x, Plugin plugin){
+ 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 Player){
+ Player player = (Player)x;
+ player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage())));
+ attacker.sendMessage("CRITICAL HIT!");
+ player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
+ }
+ }
+ }
+ if(mcUsers.getProfile(attacker).getAxesInt() >= 250 && mcUsers.getProfile(attacker).getAxesInt() < 500){
+ if(Math.random() * 10 > 9){
+ if(x instanceof Player){
+ Player player = (Player)x;
+ player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage())));
+ attacker.sendMessage("CRITICAL HIT!");
+ player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
+ }
+ }
+ }
+ if(mcUsers.getProfile(attacker).getAxesInt() >= 500 && mcUsers.getProfile(attacker).getAxesInt() < 750){
+ if(Math.random() * 10 > 8){
+ if(x instanceof Player){
+ Player player = (Player)x;
+ player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage())));
+ attacker.sendMessage("CRITICAL HIT!");
+ player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
+ }
+ }
+ }
+ if(mcUsers.getProfile(attacker).getAxesInt() >= 750 && mcUsers.getProfile(attacker).getAxesInt() < 1000){
+ if(Math.random() * 10 > 7){
+ if(x instanceof Player){
+ Player player = (Player)x;
+ player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage())));
+ attacker.sendMessage("CRITICAL HIT!");
+ player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
+ }
+ }
+ }
+ if(mcUsers.getProfile(attacker).getAxesInt() >= 1000){
+ if(Math.random() * 10 > 6){
+ if(x instanceof Player){
+ Player player = (Player)x;
+ player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage())));
+ attacker.sendMessage("CRITICAL HIT!");
+ player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
+ }
+ }
+ }
+ if(x instanceof Player){
+ Player defender = (Player)x;
+ if(defender.getHealth()<= 0 && !mcUsers.getProfile(defender).isDead()){
+ mcUsers.getProfile(defender).setDead(true);
+ event.setCancelled(true); //SEE IF THIS HELPS
+ for(ItemStack herp : defender.getInventory().getContents()){
+ 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+"chopped "+ChatColor.GRAY+defender.getName() + " to death.");
+ mcUsers.getProfile(defender).setDead(true);
+ }
+ }
+ }
+ }
+ }
public void parryCheck(Player defender, EntityDamageByEntityEvent event, Entity y){
if(isSwords(defender.getItemInHand())
&& event.getDamage() > 0
@@ -796,6 +1004,14 @@ public class mcm {
player.sendMessage(ChatColor.GRAY+"Damage scales with Archery skill");
player.sendMessage(ChatColor.GRAY+"Chance to daze player opponents with high skill lvl");
}
+ if(split[0].equalsIgnoreCase("/axes")){
+ event.setCancelled(true);
+ player.sendMessage(ChatColor.GREEN+"~~AXES INFO~~");
+ player.sendMessage(ChatColor.GREEN+"Gaining Skill: "+ChatColor.DARK_GRAY+"Hacking up Monsters.");
+ player.sendMessage(ChatColor.GREEN+"~~EFFECTS~~");
+ player.sendMessage(ChatColor.GRAY+"Damage with Axes changes after 500 skill");
+ player.sendMessage(ChatColor.GRAY+"Chance to do critical hits scales with skill");
+ }
if(split[0].equalsIgnoreCase("/swords")){
event.setCancelled(true);
player.sendMessage(ChatColor.GREEN+"~~SWORDS INFO~~");
@@ -877,6 +1093,8 @@ public class mcm {
player.sendMessage(ChatColor.GREEN+"Based on your skills you will get "+ChatColor.DARK_RED+"random procs "+ChatColor.GREEN+ "when");
player.sendMessage(ChatColor.GREEN+"using your profession, like "+ChatColor.DARK_RED+"double drops "+ChatColor.GREEN+"or "+ChatColor.DARK_RED+"better repairs");
player.sendMessage(ChatColor.GREEN+"Find out mcMMO commands with /mcc");
+ 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")){
event.setCancelled(true);
@@ -906,6 +1124,7 @@ public class mcm {
player.sendMessage(ChatColor.GRAY+"/archery - Skill info");
player.sendMessage(ChatColor.GRAY+"/swords - Skill info");
player.sendMessage(ChatColor.GRAY+"/acrobatics - Skill info");
+ player.sendMessage(ChatColor.GRAY+"/axes - Skill info");
player.sendMessage(ChatColor.GRAY+"/invite - Invite players to your party");
player.sendMessage(ChatColor.GRAY+"/accept - Accept an invite");
if(mcPermissions.getInstance().mmoedit(player))
@@ -1010,13 +1229,13 @@ public class mcm {
Material mat = null;
if(type == 2 && mcUsers.getProfile(player).getExcavationInt() > 250){
//CHANCE TO GET EGGS
- if(mcUsers.getProfile(player).getExcavationInt() > 50 && Math.random() * 100 > 99){
+ if(mcLoadProperties.eggs == true && Math.random() * 100 > 99){
mat = Material.getMaterial(344);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
//CHANCE TO GET APPLES
- if(Math.random() * 100 > 99){
+ if(mcLoadProperties.apples == true && Math.random() * 100 > 99){
mat = Material.getMaterial(260);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
@@ -1031,7 +1250,7 @@ public class mcm {
}
if(mcUsers.getProfile(player).getExcavationInt() > 750){
//CHANCE TO GET CAKE
- if(Math.random() * 2000 > 1999){
+ if(mcLoadProperties.cake == true && Math.random() * 2000 > 1999){
mat = Material.getMaterial(354);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
@@ -1039,7 +1258,7 @@ public class mcm {
}
if(mcUsers.getProfile(player).getExcavationInt() > 150){
//CHANCE TO GET MUSIC
- if(Math.random() * 2000 > 1999){
+ if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){
mat = Material.getMaterial(2256);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
@@ -1048,7 +1267,7 @@ public class mcm {
}
if(mcUsers.getProfile(player).getExcavationInt() > 350){
//CHANCE TO GET DIAMOND
- if(Math.random() * 500 > 499){
+ if(mcLoadProperties.diamond == true && Math.random() * 500 > 499){
mat = Material.getMaterial(264);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
@@ -1056,7 +1275,7 @@ public class mcm {
}
if(mcUsers.getProfile(player).getExcavationInt() > 250){
//CHANCE TO GET MUSIC
- if(Math.random() * 2000 > 1999){
+ if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){
mat = Material.getMaterial(2257);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
@@ -1066,19 +1285,19 @@ public class mcm {
//SAND
if(type == 12){
//CHANCE TO GET GLOWSTONE
- if(mcUsers.getProfile(player).getExcavationInt() > 50 && Math.random() * 100 > 95){
+ if(mcLoadProperties.glowstone == true && mcUsers.getProfile(player).getExcavationInt() > 50 && Math.random() * 100 > 95){
mat = Material.getMaterial(348);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
//CHANCE TO GET SLOWSAND
- if(mcUsers.getProfile(player).getExcavationInt() > 650 && Math.random() * 200 > 199){
+ if(mcLoadProperties.slowsand == true && mcUsers.getProfile(player).getExcavationInt() > 650 && Math.random() * 200 > 199){
mat = Material.getMaterial(88);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
//CHANCE TO GET DIAMOND
- if(mcUsers.getProfile(player).getExcavationInt() > 500 && Math.random() * 500 > 499){
+ if(mcLoadProperties.diamond == true && mcUsers.getProfile(player).getExcavationInt() > 500 && Math.random() * 500 > 499){
mat = Material.getMaterial(264);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
@@ -1087,7 +1306,7 @@ public class mcm {
//GRASS OR DIRT
if((type == 2 || type == 3) && mcUsers.getProfile(player).getExcavationInt() > 25){
//CHANCE TO GET GLOWSTONE
- if(Math.random() * 100 > 95){
+ if(mcLoadProperties.glowstone == true && Math.random() * 100 > 95){
mat = Material.getMaterial(348);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
@@ -1096,20 +1315,21 @@ public class mcm {
//GRAVEL
if(type == 13){
//CHANCE TO GET NETHERRACK
- if(mcUsers.getProfile(player).getExcavationInt() > 850 && Math.random() * 200 > 199){
+ if(mcLoadProperties.netherrack == true && mcUsers.getProfile(player).getExcavationInt() > 850 && Math.random() * 200 > 199){
mat = Material.getMaterial(87);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
//CHANCE TO GET SULPHUR
- if(mcUsers.getProfile(player).getExcavationInt() > 75){
+ if(mcLoadProperties.sulphur == true && mcUsers.getProfile(player).getExcavationInt() > 75){
if(Math.random() * 10 > 9){
mat = Material.getMaterial(289);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
}
- if(mcUsers.getProfile(player).getExcavationInt() > 175){
+ //CHANCE TO GET BONES
+ if(mcLoadProperties.bones == true && mcUsers.getProfile(player).getExcavationInt() > 175){
if(Math.random() * 10 > 6){
mat = Material.getMaterial(352);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
@@ -1117,13 +1337,15 @@ public class mcm {
}
}
//CHANCE TO GET COAL
- if(mcUsers.getProfile(player).getExcavationInt() > 125){
+ /*
+ if(mcLoadProperties.coal == true && mcUsers.getProfile(player).getExcavationInt() > 125){
if(Math.random() * 100 > 99){
mat = Material.getMaterial(263);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is);
}
}
+ */
}
}
public void woodCuttingProcCheck(Player player, Block block, Location loc){
diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml
index 095a48459..6a84bc2d0 100644
--- a/mcMMO/plugin.yml
+++ b/mcMMO/plugin.yml
@@ -1,3 +1,3 @@
name: mcMMO
main: com.gmail.nossr50.mcMMO
-version: 0.5.17
\ No newline at end of file
+version: 0.6
\ No newline at end of file