mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
All changes for McMMO up to 0.6
Removed BackOff, was a half done request mod anyways meh
This commit is contained in:
parent
33012856d4
commit
09ca2b3b0d
@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
|
||||||
<classpathentry kind="lib" path="C:/MC Server/bukkit.jar"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
|
||||||
</classpath>
|
|
@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>BackOff</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
@ -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
|
|
Binary file not shown.
Binary file not shown.
@ -1,3 +0,0 @@
|
|||||||
name: BackOff
|
|
||||||
main: com.bukkit.nossr50.BackOff.BackOff
|
|
||||||
version: 1.0
|
|
@ -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<Player, Boolean> debugees = new HashMap<Player, Boolean>();
|
|
||||||
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.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<String> backOffList = new ArrayList<String>();
|
|
||||||
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<String> ibackOffList = new ArrayList<String>();
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
name: BackOff
|
|
||||||
main: com.bukkit.nossr50.BackOff.BackOff
|
|
||||||
version: 1.0
|
|
@ -58,14 +58,14 @@ public class mcBlockListener extends BlockListener {
|
|||||||
*/
|
*/
|
||||||
if(block.getTypeId() == 17
|
if(block.getTypeId() == 17
|
||||||
&& mcPermissions.getInstance().woodcutting(player)){
|
&& mcPermissions.getInstance().woodcutting(player)){
|
||||||
mcUsers.getProfile(player).addwgather(1);
|
mcUsers.getProfile(player).addwgather(1);
|
||||||
mcm.getInstance().woodCuttingProcCheck(player, block, loc);
|
mcm.getInstance().woodCuttingProcCheck(player, block, loc);
|
||||||
}
|
}
|
||||||
mcm.getInstance().simulateSkillUp(player);
|
mcm.getInstance().simulateSkillUp(player);
|
||||||
/*
|
/*
|
||||||
* EXCAVATION
|
* EXCAVATION
|
||||||
*/
|
*/
|
||||||
if(mcPermissions.getInstance().excavation(player))
|
if(mcPermissions.getInstance().excavation(player) && block != null && player != null)
|
||||||
mcm.getInstance().excavationProcCheck(block, player);
|
mcm.getInstance().excavationProcCheck(block, player);
|
||||||
/*
|
/*
|
||||||
* HERBALISM
|
* HERBALISM
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
package com.gmail.nossr50;
|
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 java.util.logging.Logger;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public class mcConfig {
|
public class mcConfig {
|
||||||
private static volatile mcConfig instance;
|
private static volatile mcConfig instance;
|
||||||
@ -28,6 +31,7 @@ public class mcConfig {
|
|||||||
public void removeAdminToggled(String playerName) {adminChatList.remove(adminChatList.indexOf(playerName));}
|
public void removeAdminToggled(String playerName) {adminChatList.remove(adminChatList.indexOf(playerName));}
|
||||||
public void addPartyToggled(String playerName) {partyChatList.add(playerName);}
|
public void addPartyToggled(String playerName) {partyChatList.add(playerName);}
|
||||||
public void addAdminToggled(String playerName) {adminChatList.add(playerName);}
|
public void addAdminToggled(String playerName) {adminChatList.add(playerName);}
|
||||||
|
|
||||||
public static mcConfig getInstance() {
|
public static mcConfig getInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new mcConfig();
|
instance = new mcConfig();
|
||||||
@ -48,49 +52,5 @@ public class mcConfig {
|
|||||||
addPartyToggled(playerName);
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -29,25 +29,6 @@ public class mcEntityListener extends EntityListener {
|
|||||||
public mcEntityListener(final mcMMO plugin) {
|
public mcEntityListener(final mcMMO plugin) {
|
||||||
this.plugin = 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) {
|
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||||
Entity x = event.getEntity(); //Defender
|
Entity x = event.getEntity(); //Defender
|
||||||
Entity y = event.getDamager(); //Attacker
|
Entity y = event.getDamager(); //Attacker
|
||||||
@ -110,7 +91,11 @@ public class mcEntityListener extends EntityListener {
|
|||||||
*/
|
*/
|
||||||
if(y instanceof Player){
|
if(y instanceof Player){
|
||||||
Player attacker = (Player)y;
|
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
|
* Defender is Monster
|
||||||
*/
|
*/
|
||||||
@ -174,6 +159,10 @@ public class mcEntityListener extends EntityListener {
|
|||||||
* Attacker is Player
|
* Attacker is Player
|
||||||
*/
|
*/
|
||||||
if(x instanceof Player){
|
if(x instanceof Player){
|
||||||
|
if(mcLoadProperties.pvp == false){
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Player defender = (Player)x;
|
Player defender = (Player)x;
|
||||||
/*
|
/*
|
||||||
* Stuff for the daze proc
|
* Stuff for the daze proc
|
||||||
|
26
mcMMO/com/gmail/nossr50/mcLoadProperties.java
Normal file
26
mcMMO/com/gmail/nossr50/mcLoadProperties.java
Normal file
@ -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
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,7 @@ import com.nijiko.permissions.Control;
|
|||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@ -22,6 +23,8 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
|
|
||||||
public class mcMMO extends JavaPlugin {
|
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");
|
public static final Logger log = Logger.getLogger("Minecraft");
|
||||||
private final mcPlayerListener playerListener = new mcPlayerListener(this);
|
private final mcPlayerListener playerListener = new mcPlayerListener(this);
|
||||||
private final mcBlockListener blockListener = new mcBlockListener(this);
|
private final mcBlockListener blockListener = new mcBlockListener(this);
|
||||||
@ -36,6 +39,48 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onEnable() {
|
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();
|
mcUsers.getInstance().loadUsers();
|
||||||
PluginManager pm = getServer().getPluginManager();
|
PluginManager pm = getServer().getPluginManager();
|
||||||
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
||||||
@ -70,10 +115,11 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Permissions getPermissions() {
|
public Permissions getPermissions() {
|
||||||
return permissions;
|
return permissions;
|
||||||
}
|
}
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
System.out.println("mcMMO disabled.");
|
System.out.println("mcMMO was disabled.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,6 +154,13 @@ public class mcPermissions {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public boolean axes(Player player) {
|
||||||
|
if (permissionsEnabled) {
|
||||||
|
return permission(player, "mcmmo.skills.axes");
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
public boolean acrobatics(Player player) {
|
public boolean acrobatics(Player player) {
|
||||||
if (permissionsEnabled) {
|
if (permissionsEnabled) {
|
||||||
return permission(player, "mcmmo.skills.acrobatics");
|
return permission(player, "mcmmo.skills.acrobatics");
|
||||||
|
@ -31,6 +31,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
if(mcUsers.getProfile(player).getMySpawn(player) != null)
|
if(mcUsers.getProfile(player).getMySpawn(player) != null)
|
||||||
event.setRespawnLocation(mcUsers.getProfile(player).getMySpawn(player));
|
event.setRespawnLocation(mcUsers.getProfile(player).getMySpawn(player));
|
||||||
}
|
}
|
||||||
|
//HELLO CODE PEAKERS!
|
||||||
}
|
}
|
||||||
public Player[] getPlayersOnline() {
|
public Player[] getPlayersOnline() {
|
||||||
return plugin.getServer().getOnlinePlayers();
|
return plugin.getServer().getOnlinePlayers();
|
||||||
@ -177,7 +178,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
player.sendMessage("Excavation Skill: "+mcUsers.getProfile(target).getExcavation());
|
player.sendMessage("Excavation Skill: "+mcUsers.getProfile(target).getExcavation());
|
||||||
player.sendMessage("Archery Skill: "+mcUsers.getProfile(target).getArchery());
|
player.sendMessage("Archery Skill: "+mcUsers.getProfile(target).getArchery());
|
||||||
player.sendMessage("Swords Skill: "+mcUsers.getProfile(target).getSwords());
|
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("Acrobatics Skill: "+mcUsers.getProfile(target).getAcrobatics());
|
||||||
player.sendMessage(ChatColor.GREEN+"~~COORDINATES~~");
|
player.sendMessage(ChatColor.GREEN+"~~COORDINATES~~");
|
||||||
player.sendMessage("X: "+x);
|
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 + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getExcavation());
|
||||||
player.sendMessage(ChatColor.YELLOW + "Archery Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getArchery());
|
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 + "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.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAcrobatics());
|
||||||
player.sendMessage(ChatColor.DARK_RED+"TOTAL SKILL: "+ChatColor.GREEN+
|
player.sendMessage(ChatColor.DARK_RED+"TOTAL SKILL: "+ChatColor.GREEN+
|
||||||
(mcUsers.getProfile(player).getAcrobaticsInt()+
|
(mcUsers.getProfile(player).getAcrobaticsInt()+
|
||||||
@ -341,9 +342,6 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
player.sendMessage(ChatColor.RED+"Configure your myspawn first with /setmyspawn");
|
player.sendMessage(ChatColor.RED+"Configure your myspawn first with /setmyspawn");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
public void onItemHeldChange(PlayerItemHeldEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
}
|
}
|
||||||
public void onPlayerChat(PlayerChatEvent event) {
|
public void onPlayerChat(PlayerChatEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
64
mcMMO/com/gmail/nossr50/mcProperties.java
Normal file
64
mcMMO/com/gmail/nossr50/mcProperties.java
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -61,6 +61,9 @@ public class mcm {
|
|||||||
else if(skillname.equals("woodcutting")){
|
else if(skillname.equals("woodcutting")){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if(skillname.equals("excavation")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if(skillname.equals("repair")){
|
else if(skillname.equals("repair")){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -78,7 +81,11 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
else if(skillname.equals("unarmed")){
|
else if(skillname.equals("unarmed")){
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
|
else if(skillname.equals("axes")){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,6 +98,7 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void simulateNaturalDrops(Entity entity){
|
public void simulateNaturalDrops(Entity entity){
|
||||||
Location loc = entity.getLocation();
|
Location loc = entity.getLocation();
|
||||||
if(entity instanceof Pig){
|
if(entity instanceof Pig){
|
||||||
@ -427,6 +435,13 @@ public class mcm {
|
|||||||
return false;
|
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){
|
public boolean simulateUnarmedProc(Player player){
|
||||||
if(mcUsers.getProfile(player).getUnarmedInt() >= 750){
|
if(mcUsers.getProfile(player).getUnarmedInt() >= 750){
|
||||||
if(Math.random() * 10 > 4){
|
if(Math.random() * 10 > 4){
|
||||||
@ -441,6 +456,10 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
public void playerVersusPlayerChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, Plugin plugin){
|
public void playerVersusPlayerChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, Plugin plugin){
|
||||||
if(x instanceof Player){
|
if(x instanceof Player){
|
||||||
|
if(mcLoadProperties.pvp == false){
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Player defender = (Player)x;
|
Player defender = (Player)x;
|
||||||
if(mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){
|
if(mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){
|
||||||
if(inSameParty(defender, attacker)){
|
if(inSameParty(defender, attacker)){
|
||||||
@ -448,6 +467,10 @@ public class mcm {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* AXE CRITICAL CHECK
|
||||||
|
*/
|
||||||
|
axeCriticalCheckPlayer(attacker, event, x, plugin);
|
||||||
if(mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0){
|
if(mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0){
|
||||||
//DMG MODIFIER
|
//DMG MODIFIER
|
||||||
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
|
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()+")");
|
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
|
* UNARMED VS SQUID
|
||||||
*/
|
*/
|
||||||
@ -568,8 +608,17 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
public void playerVersusAnimalsChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, int type){
|
public void playerVersusAnimalsChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, int type){
|
||||||
if(x instanceof Animals){
|
if(x instanceof Animals){
|
||||||
if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
|
|
||||||
Animals defender = (Animals)event.getEntity();
|
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)
|
if(defender.getHealth() <= 0)
|
||||||
return;
|
return;
|
||||||
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
|
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){
|
public void playerVersusMonsterChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
|
||||||
if(x instanceof Monster){
|
if(x instanceof Monster){
|
||||||
|
/*
|
||||||
|
* AXE PROC CHECKS
|
||||||
|
*/
|
||||||
|
axeCriticalCheckMonster(attacker, event, x);
|
||||||
Monster defender = (Monster)event.getEntity();
|
Monster defender = (Monster)event.getEntity();
|
||||||
if(isSwords(attacker.getItemInHand())
|
if(isSwords(attacker.getItemInHand())
|
||||||
&& defender.getHealth() > 0
|
&& defender.getHealth() > 0
|
||||||
@ -639,6 +692,26 @@ public class mcm {
|
|||||||
attacker.sendMessage(ChatColor.YELLOW+"Swords skill increased by 1. Total ("+mcUsers.getProfile(attacker).getSwords()+")");
|
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(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
|
||||||
if(defender.getHealth() <= 0)
|
if(defender.getHealth() <= 0)
|
||||||
return;
|
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){
|
public int calculateDamage(Player player, int dmg){
|
||||||
int health = player.getHealth();
|
int health = player.getHealth();
|
||||||
if(health - dmg <0){
|
if(health - dmg <0){
|
||||||
@ -725,6 +810,129 @@ public class mcm {
|
|||||||
return health;
|
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){
|
public void parryCheck(Player defender, EntityDamageByEntityEvent event, Entity y){
|
||||||
if(isSwords(defender.getItemInHand())
|
if(isSwords(defender.getItemInHand())
|
||||||
&& event.getDamage() > 0
|
&& event.getDamage() > 0
|
||||||
@ -796,6 +1004,14 @@ public class mcm {
|
|||||||
player.sendMessage(ChatColor.GRAY+"Damage scales with Archery skill");
|
player.sendMessage(ChatColor.GRAY+"Damage scales with Archery skill");
|
||||||
player.sendMessage(ChatColor.GRAY+"Chance to daze player opponents with high skill lvl");
|
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")){
|
if(split[0].equalsIgnoreCase("/swords")){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.sendMessage(ChatColor.GREEN+"~~SWORDS INFO~~");
|
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+"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+"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+"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")){
|
if(split[0].equalsIgnoreCase("/mcc")){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -906,6 +1124,7 @@ public class mcm {
|
|||||||
player.sendMessage(ChatColor.GRAY+"/archery - Skill info");
|
player.sendMessage(ChatColor.GRAY+"/archery - Skill info");
|
||||||
player.sendMessage(ChatColor.GRAY+"/swords - Skill info");
|
player.sendMessage(ChatColor.GRAY+"/swords - Skill info");
|
||||||
player.sendMessage(ChatColor.GRAY+"/acrobatics - 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+"/invite - Invite players to your party");
|
||||||
player.sendMessage(ChatColor.GRAY+"/accept - Accept an invite");
|
player.sendMessage(ChatColor.GRAY+"/accept - Accept an invite");
|
||||||
if(mcPermissions.getInstance().mmoedit(player))
|
if(mcPermissions.getInstance().mmoedit(player))
|
||||||
@ -1010,13 +1229,13 @@ public class mcm {
|
|||||||
Material mat = null;
|
Material mat = null;
|
||||||
if(type == 2 && mcUsers.getProfile(player).getExcavationInt() > 250){
|
if(type == 2 && mcUsers.getProfile(player).getExcavationInt() > 250){
|
||||||
//CHANCE TO GET EGGS
|
//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);
|
mat = Material.getMaterial(344);
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
}
|
}
|
||||||
//CHANCE TO GET APPLES
|
//CHANCE TO GET APPLES
|
||||||
if(Math.random() * 100 > 99){
|
if(mcLoadProperties.apples == true && Math.random() * 100 > 99){
|
||||||
mat = Material.getMaterial(260);
|
mat = Material.getMaterial(260);
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
@ -1031,7 +1250,7 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
if(mcUsers.getProfile(player).getExcavationInt() > 750){
|
if(mcUsers.getProfile(player).getExcavationInt() > 750){
|
||||||
//CHANCE TO GET CAKE
|
//CHANCE TO GET CAKE
|
||||||
if(Math.random() * 2000 > 1999){
|
if(mcLoadProperties.cake == true && Math.random() * 2000 > 1999){
|
||||||
mat = Material.getMaterial(354);
|
mat = Material.getMaterial(354);
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
@ -1039,7 +1258,7 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
if(mcUsers.getProfile(player).getExcavationInt() > 150){
|
if(mcUsers.getProfile(player).getExcavationInt() > 150){
|
||||||
//CHANCE TO GET MUSIC
|
//CHANCE TO GET MUSIC
|
||||||
if(Math.random() * 2000 > 1999){
|
if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){
|
||||||
mat = Material.getMaterial(2256);
|
mat = Material.getMaterial(2256);
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
@ -1048,7 +1267,7 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
if(mcUsers.getProfile(player).getExcavationInt() > 350){
|
if(mcUsers.getProfile(player).getExcavationInt() > 350){
|
||||||
//CHANCE TO GET DIAMOND
|
//CHANCE TO GET DIAMOND
|
||||||
if(Math.random() * 500 > 499){
|
if(mcLoadProperties.diamond == true && Math.random() * 500 > 499){
|
||||||
mat = Material.getMaterial(264);
|
mat = Material.getMaterial(264);
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
@ -1056,7 +1275,7 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
if(mcUsers.getProfile(player).getExcavationInt() > 250){
|
if(mcUsers.getProfile(player).getExcavationInt() > 250){
|
||||||
//CHANCE TO GET MUSIC
|
//CHANCE TO GET MUSIC
|
||||||
if(Math.random() * 2000 > 1999){
|
if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){
|
||||||
mat = Material.getMaterial(2257);
|
mat = Material.getMaterial(2257);
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
@ -1066,19 +1285,19 @@ public class mcm {
|
|||||||
//SAND
|
//SAND
|
||||||
if(type == 12){
|
if(type == 12){
|
||||||
//CHANCE TO GET GLOWSTONE
|
//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);
|
mat = Material.getMaterial(348);
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
}
|
}
|
||||||
//CHANCE TO GET SLOWSAND
|
//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);
|
mat = Material.getMaterial(88);
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
}
|
}
|
||||||
//CHANCE TO GET DIAMOND
|
//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);
|
mat = Material.getMaterial(264);
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
@ -1087,7 +1306,7 @@ public class mcm {
|
|||||||
//GRASS OR DIRT
|
//GRASS OR DIRT
|
||||||
if((type == 2 || type == 3) && mcUsers.getProfile(player).getExcavationInt() > 25){
|
if((type == 2 || type == 3) && mcUsers.getProfile(player).getExcavationInt() > 25){
|
||||||
//CHANCE TO GET GLOWSTONE
|
//CHANCE TO GET GLOWSTONE
|
||||||
if(Math.random() * 100 > 95){
|
if(mcLoadProperties.glowstone == true && Math.random() * 100 > 95){
|
||||||
mat = Material.getMaterial(348);
|
mat = Material.getMaterial(348);
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
@ -1096,20 +1315,21 @@ public class mcm {
|
|||||||
//GRAVEL
|
//GRAVEL
|
||||||
if(type == 13){
|
if(type == 13){
|
||||||
//CHANCE TO GET NETHERRACK
|
//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);
|
mat = Material.getMaterial(87);
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
}
|
}
|
||||||
//CHANCE TO GET SULPHUR
|
//CHANCE TO GET SULPHUR
|
||||||
if(mcUsers.getProfile(player).getExcavationInt() > 75){
|
if(mcLoadProperties.sulphur == true && mcUsers.getProfile(player).getExcavationInt() > 75){
|
||||||
if(Math.random() * 10 > 9){
|
if(Math.random() * 10 > 9){
|
||||||
mat = Material.getMaterial(289);
|
mat = Material.getMaterial(289);
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
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){
|
if(Math.random() * 10 > 6){
|
||||||
mat = Material.getMaterial(352);
|
mat = Material.getMaterial(352);
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
@ -1117,13 +1337,15 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//CHANCE TO GET COAL
|
//CHANCE TO GET COAL
|
||||||
if(mcUsers.getProfile(player).getExcavationInt() > 125){
|
/*
|
||||||
|
if(mcLoadProperties.coal == true && mcUsers.getProfile(player).getExcavationInt() > 125){
|
||||||
if(Math.random() * 100 > 99){
|
if(Math.random() * 100 > 99){
|
||||||
mat = Material.getMaterial(263);
|
mat = Material.getMaterial(263);
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
loc.getWorld().dropItemNaturally(loc, is);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void woodCuttingProcCheck(Player player, Block block, Location loc){
|
public void woodCuttingProcCheck(Player player, Block block, Location loc){
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
name: mcMMO
|
name: mcMMO
|
||||||
main: com.gmail.nossr50.mcMMO
|
main: com.gmail.nossr50.mcMMO
|
||||||
version: 0.5.17
|
version: 0.6
|
Loading…
Reference in New Issue
Block a user