mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
1.0.07 WIP
This commit is contained in:
parent
139f50c5d1
commit
e8049597a5
@ -1,5 +1,16 @@
|
|||||||
Changelog:
|
Changelog:
|
||||||
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
|
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
|
||||||
|
Version 1.0.07
|
||||||
|
Leaderboards ignore players with the respective stat at 0
|
||||||
|
Reconnecting to MySQL will reload player data
|
||||||
|
Fixed a NPE with MySQL's Leaderboards
|
||||||
|
Removed "Loop iteration" debug message from mcMMO
|
||||||
|
|
||||||
|
Version 1.0.06
|
||||||
|
MySQL will attempt to reconnect if the connection is closed
|
||||||
|
Breaking the bottom block of Cactus/Reeds will award the correct experience and double drops
|
||||||
|
Added support for Minecraft Statistics
|
||||||
|
Fixed NPE with /myspawn command
|
||||||
|
|
||||||
Version 1.0.05
|
Version 1.0.05
|
||||||
PVP interactions now check for permissions before handing out any experience
|
PVP interactions now check for permissions before handing out any experience
|
||||||
|
@ -18,9 +18,11 @@ import com.gmail.nossr50.config.LoadProperties;
|
|||||||
public class Database {
|
public class Database {
|
||||||
|
|
||||||
private Connection conn;
|
private Connection conn;
|
||||||
|
private mcMMO plugin;
|
||||||
|
|
||||||
public Database() {
|
public Database(mcMMO instance)
|
||||||
|
{
|
||||||
|
plugin = instance;
|
||||||
// Load the driver instance
|
// Load the driver instance
|
||||||
try {
|
try {
|
||||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||||
@ -92,9 +94,55 @@ public class Database {
|
|||||||
"`world` varchar(50) NOT NULL DEFAULT ''," +
|
"`world` varchar(50) NOT NULL DEFAULT ''," +
|
||||||
"PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
"PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||||
}
|
}
|
||||||
// write query
|
// check if its closed
|
||||||
public boolean Write(String sql) {
|
private void reconnect()
|
||||||
|
{
|
||||||
|
System.out.println("[mcMMO] Reconnecting to MySQL...");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
conn = DriverManager.getConnection("jdbc:mysql://" + LoadProperties.MySQLserverName + ":" + LoadProperties.MySQLport + "/" + LoadProperties.MySQLdbName + "?user=" + LoadProperties.MySQLuserName + "&password=" + LoadProperties.MySQLdbPass);
|
||||||
|
|
||||||
|
System.out.println("[mcMMO] Connection success!");
|
||||||
|
} catch (SQLException ex)
|
||||||
|
{
|
||||||
|
System.out.println("[mcMMO] Connection to MySQL failed! Check status of MySQL server!");
|
||||||
|
System.out.println("SQLException: " + ex.getMessage());
|
||||||
|
System.out.println("SQLState: " + ex.getSQLState());
|
||||||
|
System.out.println("VendorError: " + ex.getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if(conn.isValid(5)){
|
||||||
|
Users.clearUsers();
|
||||||
|
|
||||||
|
for(Player x : plugin.getServer().getOnlinePlayers())
|
||||||
|
{
|
||||||
|
Users.addUser(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
//Herp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// write query
|
||||||
|
public boolean Write(String sql)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Double check connection to MySQL
|
||||||
|
*/
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(!conn.isValid(5))
|
||||||
|
{
|
||||||
|
reconnect();
|
||||||
|
}
|
||||||
|
} catch (SQLException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
stmt = this.conn.prepareStatement(sql);
|
stmt = this.conn.prepareStatement(sql);
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
@ -114,6 +162,20 @@ public class Database {
|
|||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
Integer result = 0;
|
Integer result = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Double check connection to MySQL
|
||||||
|
*/
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(!conn.isValid(5))
|
||||||
|
{
|
||||||
|
reconnect();
|
||||||
|
}
|
||||||
|
} catch (SQLException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
stmt = this.conn.prepareStatement(sql);
|
stmt = this.conn.prepareStatement(sql);
|
||||||
if (stmt.executeQuery() != null) {
|
if (stmt.executeQuery() != null) {
|
||||||
@ -136,6 +198,20 @@ public class Database {
|
|||||||
|
|
||||||
// read query
|
// read query
|
||||||
public HashMap<Integer, ArrayList<String>> Read(String sql) {
|
public HashMap<Integer, ArrayList<String>> Read(String sql) {
|
||||||
|
/*
|
||||||
|
* Double check connection to MySQL
|
||||||
|
*/
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(!conn.isValid(5))
|
||||||
|
{
|
||||||
|
reconnect();
|
||||||
|
}
|
||||||
|
} catch (SQLException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
|
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
|
||||||
|
@ -144,14 +144,17 @@ public class Leaderboard {
|
|||||||
//HERP
|
//HERP
|
||||||
BufferedReader in = new BufferedReader(file);
|
BufferedReader in = new BufferedReader(file);
|
||||||
StringBuilder writer = new StringBuilder();
|
StringBuilder writer = new StringBuilder();
|
||||||
String line = "";
|
|
||||||
for(PlayerStat p : ps)
|
for(PlayerStat p : ps)
|
||||||
{
|
{
|
||||||
if(p.name.equals("$mcMMO_DummyInfo"))
|
if(p.name.equals("$mcMMO_DummyInfo"))
|
||||||
continue;
|
continue;
|
||||||
|
if(p.statVal == 0)
|
||||||
|
continue;
|
||||||
writer.append(p.name + ":" + p.statVal);
|
writer.append(p.name + ":" + p.statVal);
|
||||||
writer.append("\r\n");
|
writer.append("\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
in.close();
|
in.close();
|
||||||
//Write the new file
|
//Write the new file
|
||||||
FileWriter out = new FileWriter(theLocation);
|
FileWriter out = new FileWriter(theLocation);
|
||||||
|
@ -3,7 +3,7 @@ package com.gmail.nossr50.config;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
|
||||||
public class LoadProperties {
|
public class LoadProperties {
|
||||||
public static Boolean enableCobbleToMossy, useMySQL, cocoabeans, archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
|
public static Boolean enableCobbleToMossy, useMySQL, cocoabeans, archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
|
||||||
public static String MySQLtablePrefix, MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass, mctop, addxp, mcability, mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
|
public static String MySQLtablePrefix, MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass, mctop, addxp, mcability, mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
|
||||||
public static int MySQLport, xpGainMultiplier, superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
|
public static int MySQLport, xpGainMultiplier, superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
|
||||||
|
|
||||||
|
@ -47,7 +47,8 @@ public class PlayerProfile
|
|||||||
public PlayerProfile(Player player)
|
public PlayerProfile(Player player)
|
||||||
{
|
{
|
||||||
thisplayer = player;
|
thisplayer = player;
|
||||||
if (LoadProperties.useMySQL) {
|
if (LoadProperties.useMySQL)
|
||||||
|
{
|
||||||
if(!loadMySQL(player)) {
|
if(!loadMySQL(player)) {
|
||||||
addMySQLPlayer(player);
|
addMySQLPlayer(player);
|
||||||
loadMySQL(player);//This is probably not needed anymore, could just delete
|
loadMySQL(player);//This is probably not needed anymore, could just delete
|
||||||
@ -82,6 +83,7 @@ public class PlayerProfile
|
|||||||
myspawnworld = spawn.get(1).get(0);
|
myspawnworld = spawn.get(1).get(0);
|
||||||
myspawn = spawn.get(1).get(1) + "," + spawn.get(1).get(2) + "," + spawn.get(1).get(3);
|
myspawn = spawn.get(1).get(1) + "," + spawn.get(1).get(2) + "," + spawn.get(1).get(3);
|
||||||
HashMap<Integer, ArrayList<String>> cooldowns = mcMMO.database.Read("SELECT mining, woodcutting, unarmed, herbalism, excavation, swords, axes FROM "+LoadProperties.MySQLtablePrefix+"cooldowns WHERE user_id = " + id);
|
HashMap<Integer, ArrayList<String>> cooldowns = mcMMO.database.Read("SELECT mining, woodcutting, unarmed, herbalism, excavation, swords, axes FROM "+LoadProperties.MySQLtablePrefix+"cooldowns WHERE user_id = " + id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* I'm still learning MySQL, this is a fix for adding a new table
|
* I'm still learning MySQL, this is a fix for adding a new table
|
||||||
* its not pretty but it works
|
* its not pretty but it works
|
||||||
|
@ -619,7 +619,7 @@ public class m {
|
|||||||
player.sendMessage(ChatColor.RED+"Chance to Daze: "+ChatColor.YELLOW+percentagedaze+"%");
|
player.sendMessage(ChatColor.RED+"Chance to Daze: "+ChatColor.YELLOW+percentagedaze+"%");
|
||||||
player.sendMessage(ChatColor.RED+"Chance to Retrieve Arrows: "+ChatColor.YELLOW+percentage+"%");
|
player.sendMessage(ChatColor.RED+"Chance to Retrieve Arrows: "+ChatColor.YELLOW+percentage+"%");
|
||||||
player.sendMessage(ChatColor.RED+"Length of Ignition: "+ChatColor.YELLOW+(ignition / 20)+" seconds");
|
player.sendMessage(ChatColor.RED+"Length of Ignition: "+ChatColor.YELLOW+(ignition / 20)+" seconds");
|
||||||
player.sendMessage(ChatColor.RED+"Damage+ (Rank"+rank+"): Bonus "+rank+" damage");
|
player.sendMessage(ChatColor.RED+"Damage+ (Rank"+rank+"):"+ChatColor.YELLOW+" Bonus "+rank+" damage");
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/axes")){
|
if(split[0].equalsIgnoreCase("/axes")){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -851,12 +851,13 @@ public class m {
|
|||||||
player.sendMessage(ChatColor.DARK_AQUA+"Double Drops (All Herbs): "+ChatColor.GREEN+"Double the normal loot");
|
player.sendMessage(ChatColor.DARK_AQUA+"Double Drops (All Herbs): "+ChatColor.GREEN+"Double the normal loot");
|
||||||
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
|
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
|
||||||
player.sendMessage(ChatColor.RED+"Green Terra Length: "+ChatColor.YELLOW+ticks+"s");
|
player.sendMessage(ChatColor.RED+"Green Terra Length: "+ChatColor.YELLOW+ticks+"s");
|
||||||
player.sendMessage(ChatColor.RED+"Green Thumb Chance: "+gpercentage+"%");
|
player.sendMessage(ChatColor.RED+"Green Thumb Chance: "+ChatColor.YELLOW+gpercentage+"%");
|
||||||
player.sendMessage(ChatColor.RED+"Green Thumb Stage: Wheat grows in stage "+bonus);
|
player.sendMessage(ChatColor.RED+"Green Thumb Stage: "+ChatColor.YELLOW+"Wheat grows in stage "+bonus);
|
||||||
player.sendMessage(ChatColor.RED+"Double Drop Chance: "+percentage+"%");
|
player.sendMessage(ChatColor.RED+"Double Drop Chance: "+ChatColor.YELLOW+percentage+"%");
|
||||||
player.sendMessage(ChatColor.RED+"Food+ (Rank"+rank+"): Bonus "+rank+" healing");
|
player.sendMessage(ChatColor.RED+"Food+ (Rank"+rank+"): "+ChatColor.YELLOW+"Bonus "+rank+" healing");
|
||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/excavation")){
|
if(split[0].equalsIgnoreCase("/excavation"))
|
||||||
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
int ticks = 2;
|
int ticks = 2;
|
||||||
int x = PP.getExcavationInt();
|
int x = PP.getExcavationInt();
|
||||||
|
@ -5,6 +5,7 @@ import org.bukkit.ChatColor;
|
|||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Statistic;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -155,6 +156,8 @@ public class mcBlockListener extends BlockListener {
|
|||||||
if(Math.random() * 10 > 9)
|
if(Math.random() * 10 > 9)
|
||||||
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
|
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
|
||||||
}
|
}
|
||||||
|
if(blockx.getType() != Material.AIR)
|
||||||
|
player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType());
|
||||||
blockx.setType(Material.AIR);
|
blockx.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,6 +236,7 @@ public class mcBlockListener extends BlockListener {
|
|||||||
byte type = block.getData();
|
byte type = block.getData();
|
||||||
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
|
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
|
player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType());
|
||||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||||
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
||||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
||||||
@ -251,6 +255,7 @@ public class mcBlockListener extends BlockListener {
|
|||||||
mat = Material.SNOW_BALL;
|
mat = Material.SNOW_BALL;
|
||||||
byte type = block.getData();
|
byte type = block.getData();
|
||||||
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
|
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
|
||||||
|
player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType());
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
||||||
}
|
}
|
||||||
@ -282,6 +287,7 @@ public class mcBlockListener extends BlockListener {
|
|||||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), x);
|
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), x);
|
||||||
}
|
}
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
|
player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,8 @@ public class mcEntityListener extends EntityListener {
|
|||||||
/*
|
/*
|
||||||
* CHECK FOR INVULNERABILITY
|
* CHECK FOR INVULNERABILITY
|
||||||
*/
|
*/
|
||||||
if(event.getEntity() instanceof Player){
|
if(event.getEntity() instanceof Player)
|
||||||
|
{
|
||||||
Player defender = (Player)event.getEntity();
|
Player defender = (Player)event.getEntity();
|
||||||
PlayerProfile PPd = Users.getProfile(defender);
|
PlayerProfile PPd = Users.getProfile(defender);
|
||||||
if(defender != null && Config.getInstance().isGodModeToggled(defender.getName()))
|
if(defender != null && Config.getInstance().isGodModeToggled(defender.getName()))
|
||||||
@ -71,7 +72,8 @@ public class mcEntityListener extends EntityListener {
|
|||||||
Users.addUser(defender);
|
Users.addUser(defender);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event.getEntity() instanceof CraftEntity){
|
if(event.getEntity() instanceof CraftEntity)
|
||||||
|
{
|
||||||
CraftEntity cEntity = (CraftEntity)event.getEntity();
|
CraftEntity cEntity = (CraftEntity)event.getEntity();
|
||||||
if(cEntity.getHandle() instanceof EntityLiving)
|
if(cEntity.getHandle() instanceof EntityLiving)
|
||||||
{
|
{
|
||||||
|
@ -50,14 +50,18 @@ public class mcMMO extends JavaPlugin {
|
|||||||
private Timer mcMMO_Timer = new Timer(true);
|
private Timer mcMMO_Timer = new Timer(true);
|
||||||
public static Database database = null;
|
public static Database database = null;
|
||||||
|
|
||||||
public void onEnable() {
|
public void onEnable()
|
||||||
|
{
|
||||||
|
|
||||||
new File(maindirectory).mkdir();
|
new File(maindirectory).mkdir();
|
||||||
mcProperties.makeProperties(Properties, log); //Make Props file
|
mcProperties.makeProperties(Properties, log); //Make Props file
|
||||||
LoadProperties.loadMain(); //Load Props file
|
LoadProperties.loadMain(); //Load Props file
|
||||||
Users.getInstance().loadUsers(); //Load Users file
|
Users.getInstance().loadUsers(); //Load Users file
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* REGISTER EVENTS
|
* REGISTER EVENTS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PluginManager pm = getServer().getPluginManager();
|
PluginManager pm = getServer().getPluginManager();
|
||||||
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this);
|
||||||
@ -86,10 +90,11 @@ public class mcMMO extends JavaPlugin {
|
|||||||
mcMMO_Timer.schedule(new mcTimer(this), (long)0, (long)(1000));
|
mcMMO_Timer.schedule(new mcTimer(this), (long)0, (long)(1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mcLoadMySQL() {
|
public void mcLoadMySQL()
|
||||||
|
{
|
||||||
if (LoadProperties.useMySQL) {
|
if (LoadProperties.useMySQL) {
|
||||||
// create database object
|
// create database object
|
||||||
database = new Database();
|
database = new Database(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,6 +313,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
* MYSQL LEADERBOARDS
|
* MYSQL LEADERBOARDS
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics";
|
||||||
if(split.length >= 2 && Skills.isSkill(split[1]))
|
if(split.length >= 2 && Skills.isSkill(split[1]))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -336,11 +337,11 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
//If a page number is specified
|
//If a page number is specified
|
||||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT "+lowercase+", user_id FROM "
|
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT "+lowercase+", user_id FROM "
|
||||||
+LoadProperties.MySQLtablePrefix+"skills ORDER BY `"+LoadProperties.MySQLtablePrefix+"skills`.`"+lowercase+"` DESC ");
|
+LoadProperties.MySQLtablePrefix+"skills WHERE "+lowercase+" > 0 ORDER BY `"+LoadProperties.MySQLtablePrefix+"skills`.`"+lowercase+"` DESC ");
|
||||||
|
|
||||||
for(int i=n;i<=n+10;i++)
|
for(int i=n;i<=n+10;i++)
|
||||||
{
|
{
|
||||||
if (i > userslist.size())
|
if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||||
break;
|
break;
|
||||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||||
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
||||||
@ -349,10 +350,10 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
//If no page number is specified
|
//If no page number is specified
|
||||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT "+lowercase+", user_id FROM "
|
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT "+lowercase+", user_id FROM "
|
||||||
+LoadProperties.MySQLtablePrefix+"skills ORDER BY `"+LoadProperties.MySQLtablePrefix+"skills`.`"+lowercase+"` DESC ");
|
+LoadProperties.MySQLtablePrefix+"skills WHERE "+lowercase+" > 0 ORDER BY `"+LoadProperties.MySQLtablePrefix+"skills`.`"+lowercase+"` DESC ");
|
||||||
for(int i=1;i<=10;i++) //i<=userslist.size()
|
for(int i=1;i<=10;i++) //i<=userslist.size()
|
||||||
{
|
{
|
||||||
if (i > userslist.size())
|
if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||||
break;
|
break;
|
||||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||||
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
||||||
@ -373,11 +374,11 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
n = n * (n2-1);
|
n = n * (n2-1);
|
||||||
}
|
}
|
||||||
//If a page number is specified
|
//If a page number is specified
|
||||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics, user_id FROM "
|
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT "+powerlevel+", user_id FROM "
|
||||||
+LoadProperties.MySQLtablePrefix+"skills ORDER BY taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics DESC ");
|
+LoadProperties.MySQLtablePrefix+"skills WHERE "+powerlevel+" > 0 ORDER BY taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics DESC ");
|
||||||
for(int i=n;i<=n+10;i++)
|
for(int i=n;i<=n+10;i++)
|
||||||
{
|
{
|
||||||
if (i > userslist.size())
|
if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||||
break;
|
break;
|
||||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||||
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
||||||
@ -385,10 +386,10 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics, user_id FROM "
|
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics, user_id FROM "
|
||||||
+LoadProperties.MySQLtablePrefix+"skills ORDER BY taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics DESC ");
|
+LoadProperties.MySQLtablePrefix+"skills WHERE "+powerlevel+" > 0 ORDER BY taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics DESC ");
|
||||||
for(int i=1;i<=10;i++)
|
for(int i=1;i<=10;i++)
|
||||||
{
|
{
|
||||||
if (i > userslist.size())
|
if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||||
break;
|
break;
|
||||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||||
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
||||||
@ -836,13 +837,8 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
//player.sendMessage("MMO DEBUG CODE 5");
|
//player.sendMessage("MMO DEBUG CODE 5");
|
||||||
mySpawn.setWorld(plugin.getServer().getWorlds().get(0));
|
mySpawn.setWorld(plugin.getServer().getWorlds().get(0));
|
||||||
}
|
}
|
||||||
//player.sendMessage("MMO DEBUG CODE 3");
|
|
||||||
player.teleportTo(mySpawn); //It's done twice because teleporting from one world to another is weird
|
player.teleportTo(mySpawn); //It's done twice because teleporting from one world to another is weird
|
||||||
player.teleportTo(mySpawn);
|
player.teleportTo(mySpawn);
|
||||||
//Two lines of teleporting to prevent a bug when players try teleporting from one world to another bringing them to that worlds spawn at first.
|
|
||||||
//player.sendMessage("MMO DEBUG CODE 4");
|
|
||||||
if(LoadProperties.myspawnclearsinventory)
|
|
||||||
player.sendMessage("Traveled to your MySpawn");
|
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.RED+"Configure your myspawn first with a bed.");
|
player.sendMessage(ChatColor.RED+"Configure your myspawn first with a bed.");
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,8 @@ public class mcTimer extends TimerTask{
|
|||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
Player[] playerlist = plugin.getServer().getOnlinePlayers();
|
Player[] playerlist = plugin.getServer().getOnlinePlayers();
|
||||||
for(Player player : playerlist){
|
for(Player player : playerlist)
|
||||||
|
{
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
if(player == null)
|
if(player == null)
|
||||||
continue;
|
continue;
|
||||||
@ -38,12 +39,13 @@ public class mcTimer extends TimerTask{
|
|||||||
/*
|
/*
|
||||||
* PLAYER BLEED MONITORING
|
* PLAYER BLEED MONITORING
|
||||||
*/
|
*/
|
||||||
if(thecount % 2 == 0 && player != null && PP != null && PP.getBleedTicks() >= 1){
|
if(thecount % 2 == 0 && PP != null && PP.getBleedTicks() >= 1){
|
||||||
player.damage(2);
|
player.damage(2);
|
||||||
PP.decreaseBleedTicks();
|
PP.decreaseBleedTicks();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcPermissions.getInstance().regeneration(player) && PP != null && System.currentTimeMillis() >= PP.getRecentlyHurt() + 60000){
|
if(mcPermissions.getInstance().regeneration(player) && PP != null && System.currentTimeMillis() >= PP.getRecentlyHurt() + 60000)
|
||||||
|
{
|
||||||
if(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){
|
if(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){
|
||||||
if(player != null &&
|
if(player != null &&
|
||||||
player.getHealth() > 0 && player.getHealth() < 20
|
player.getHealth() > 0 && player.getHealth() < 20
|
||||||
@ -75,9 +77,11 @@ public class mcTimer extends TimerTask{
|
|||||||
if(thecount % 2 == 0)
|
if(thecount % 2 == 0)
|
||||||
Swords.bleedSimulate();
|
Swords.bleedSimulate();
|
||||||
|
|
||||||
if(thecount < 40){
|
if(thecount < 40)
|
||||||
|
{
|
||||||
thecount++;
|
thecount++;
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
thecount = 1;
|
thecount = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,25 +165,80 @@ public class Herbalism {
|
|||||||
if(block.getData() != (byte) 5){
|
if(block.getData() != (byte) 5){
|
||||||
//Cactus
|
//Cactus
|
||||||
if(type == 81){
|
if(type == 81){
|
||||||
mat = Material.getMaterial(block.getTypeId());
|
//Setup the loop
|
||||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
World world = block.getWorld();
|
||||||
if(player != null){
|
Block[] blockArray = new Block[3];
|
||||||
if(Math.random() * 1000 <= PP.getHerbalismInt()){
|
blockArray[0] = block;
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
blockArray[1] = world.getBlockAt(block.getX(), block.getY()+1, block.getZ());
|
||||||
}
|
blockArray[2] = world.getBlockAt(block.getX(), block.getY()+2, block.getZ());
|
||||||
|
|
||||||
|
Material[] materialArray = new Material[3];
|
||||||
|
materialArray[0] = blockArray[0].getType();
|
||||||
|
materialArray[1] = blockArray[1].getType();
|
||||||
|
materialArray[2] = blockArray[2].getType();
|
||||||
|
|
||||||
|
byte[] byteArray = new byte[3];
|
||||||
|
byteArray[0] = blockArray[0].getData();
|
||||||
|
byteArray[1] = blockArray[0].getData();
|
||||||
|
byteArray[2] = blockArray[0].getData();
|
||||||
|
|
||||||
|
int x = 0;
|
||||||
|
for(Block target : blockArray)
|
||||||
|
{
|
||||||
|
if(materialArray[x] == Material.CACTUS)
|
||||||
|
{
|
||||||
|
is = new ItemStack(Material.CACTUS, 1, (byte)0, (byte)0);
|
||||||
|
if(byteArray[x] != (byte) 5)
|
||||||
|
{
|
||||||
|
if(Math.random() * 1000 <= PP.getHerbalismInt())
|
||||||
|
{
|
||||||
|
loc.getWorld().dropItemNaturally(target.getLocation(), is);
|
||||||
}
|
}
|
||||||
PP.addHerbalismXP(3 * LoadProperties.xpGainMultiplier);
|
PP.addHerbalismXP(3 * LoadProperties.xpGainMultiplier);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
//Sugar Canes
|
//Sugar Canes
|
||||||
if(type == 83){
|
if(type == 83){
|
||||||
|
//Setup the loop
|
||||||
|
World world = block.getWorld();
|
||||||
|
Block[] blockArray = new Block[3];
|
||||||
|
blockArray[0] = block;
|
||||||
|
blockArray[1] = world.getBlockAt(block.getX(), block.getY()+1, block.getZ());
|
||||||
|
blockArray[2] = world.getBlockAt(block.getX(), block.getY()+2, block.getZ());
|
||||||
|
|
||||||
|
Material[] materialArray = new Material[3];
|
||||||
|
materialArray[0] = blockArray[0].getType();
|
||||||
|
materialArray[1] = blockArray[1].getType();
|
||||||
|
materialArray[2] = blockArray[2].getType();
|
||||||
|
|
||||||
|
byte[] byteArray = new byte[3];
|
||||||
|
byteArray[0] = blockArray[0].getData();
|
||||||
|
byteArray[1] = blockArray[0].getData();
|
||||||
|
byteArray[2] = blockArray[0].getData();
|
||||||
|
|
||||||
|
int x = 0;
|
||||||
|
for(Block target : blockArray)
|
||||||
|
{
|
||||||
|
if(materialArray[x] == Material.SUGAR_CANE_BLOCK)
|
||||||
|
{
|
||||||
is = new ItemStack(Material.SUGAR_CANE, 1, (byte)0, (byte)0);
|
is = new ItemStack(Material.SUGAR_CANE, 1, (byte)0, (byte)0);
|
||||||
if(player != null){
|
//Check for being placed by the player
|
||||||
if(Math.random() * 1000 <= PP.getHerbalismInt()){
|
if(byteArray[x] != (byte) 5)
|
||||||
loc.getWorld().dropItemNaturally(loc, is);
|
{
|
||||||
}
|
if(Math.random() * 1000 <= PP.getHerbalismInt())
|
||||||
|
{
|
||||||
|
loc.getWorld().dropItemNaturally(target.getLocation(), is);
|
||||||
}
|
}
|
||||||
PP.addHerbalismXP(3 * LoadProperties.xpGainMultiplier);
|
PP.addHerbalismXP(3 * LoadProperties.xpGainMultiplier);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Pumpkins
|
//Pumpkins
|
||||||
if((type == 91 || type == 86) && !Config.getInstance().isBlockWatched(block)){
|
if((type == 91 || type == 86) && !Config.getInstance().isBlockWatched(block)){
|
||||||
mat = Material.getMaterial(block.getTypeId());
|
mat = Material.getMaterial(block.getTypeId());
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.skills;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Statistic;
|
||||||
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;
|
||||||
@ -22,7 +23,8 @@ public class Mining {
|
|||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void superBreakerCheck(Player player, Block block, Plugin pluginx){
|
public static void superBreakerCheck(Player player, Block block, Plugin pluginx)
|
||||||
|
{
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
if(m.isMiningPick(player.getItemInHand())){
|
if(m.isMiningPick(player.getItemInHand())){
|
||||||
if(block != null){
|
if(block != null){
|
||||||
@ -53,7 +55,8 @@ public class Mining {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void blockProcSimulate(Block block){
|
public static void blockProcSimulate(Block block)
|
||||||
|
{
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
Material mat = Material.getMaterial(block.getTypeId());
|
Material mat = Material.getMaterial(block.getTypeId());
|
||||||
byte damage = 0;
|
byte damage = 0;
|
||||||
@ -99,7 +102,8 @@ public class Mining {
|
|||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void blockProcCheck(Block block, Player player){
|
public static void blockProcCheck(Block block, Player player)
|
||||||
|
{
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
if(player != null){
|
if(player != null){
|
||||||
if(Math.random() * 1000 <= PP.getMiningInt()){
|
if(Math.random() * 1000 <= PP.getMiningInt()){
|
||||||
@ -108,7 +112,8 @@ public class Mining {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void miningBlockCheck(Player player, Block block){
|
public static void miningBlockCheck(Player player, Block block)
|
||||||
|
{
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
if(Config.getInstance().isBlockWatched(block) || block.getData() == (byte) 5)
|
if(Config.getInstance().isBlockWatched(block) || block.getData() == (byte) 5)
|
||||||
return;
|
return;
|
||||||
@ -185,7 +190,8 @@ public class Mining {
|
|||||||
int xp = 0;
|
int xp = 0;
|
||||||
byte damage = 0;
|
byte damage = 0;
|
||||||
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
|
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
|
||||||
if(block.getTypeId() == 1 || block.getTypeId() == 24){
|
if(block.getTypeId() == 1 || block.getTypeId() == 24)
|
||||||
|
{
|
||||||
if(!Config.getInstance().isBlockWatched(block) && block.getData() != (byte) 5){
|
if(!Config.getInstance().isBlockWatched(block) && block.getData() != (byte) 5){
|
||||||
xp += 3;
|
xp += 3;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
@ -198,10 +204,12 @@ public class Mining {
|
|||||||
}
|
}
|
||||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
//NETHERRACK
|
//NETHERRACK
|
||||||
if(block.getTypeId() == 87){
|
if(block.getTypeId() == 87)
|
||||||
|
{
|
||||||
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
||||||
xp += 3;
|
xp += 3;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
@ -210,10 +218,12 @@ public class Mining {
|
|||||||
mat = Material.getMaterial(87);
|
mat = Material.getMaterial(87);
|
||||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
//GLOWSTONE
|
//GLOWSTONE
|
||||||
if(block.getTypeId() == 89){
|
if(block.getTypeId() == 89)
|
||||||
|
{
|
||||||
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
||||||
xp += 3;
|
xp += 3;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
@ -222,10 +232,12 @@ public class Mining {
|
|||||||
mat = Material.getMaterial(348);
|
mat = Material.getMaterial(348);
|
||||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
//COAL
|
//COAL
|
||||||
if(block.getTypeId() == 16){
|
if(block.getTypeId() == 16)
|
||||||
|
{
|
||||||
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
||||||
xp += 10;
|
xp += 10;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
@ -234,10 +246,12 @@ public class Mining {
|
|||||||
mat = Material.getMaterial(263);
|
mat = Material.getMaterial(263);
|
||||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
//GOLD
|
//GOLD
|
||||||
if(block.getTypeId() == 14 && m.getTier(player) >= 3){
|
if(block.getTypeId() == 14 && m.getTier(player) >= 3)
|
||||||
|
{
|
||||||
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
||||||
xp += 35;
|
xp += 35;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
@ -245,10 +259,12 @@ public class Mining {
|
|||||||
}
|
}
|
||||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
//OBSIDIAN
|
//OBSIDIAN
|
||||||
if(block.getTypeId() == 49 && m.getTier(player) >= 4){
|
if(block.getTypeId() == 49 && m.getTier(player) >= 4)
|
||||||
|
{
|
||||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||||
m.damageTool(player, (short) 104);
|
m.damageTool(player, (short) 104);
|
||||||
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
||||||
@ -259,10 +275,12 @@ public class Mining {
|
|||||||
mat = Material.getMaterial(49);
|
mat = Material.getMaterial(49);
|
||||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
//DIAMOND
|
//DIAMOND
|
||||||
if(block.getTypeId() == 56 && m.getTier(player) >= 3){
|
if(block.getTypeId() == 56 && m.getTier(player) >= 3)
|
||||||
|
{
|
||||||
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
||||||
xp += 75;
|
xp += 75;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
@ -271,10 +289,12 @@ public class Mining {
|
|||||||
mat = Material.getMaterial(264);
|
mat = Material.getMaterial(264);
|
||||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
//IRON
|
//IRON
|
||||||
if(block.getTypeId() == 15 && m.getTier(player) >= 2){
|
if(block.getTypeId() == 15 && m.getTier(player) >= 2)
|
||||||
|
{
|
||||||
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
||||||
xp += 25;
|
xp += 25;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
@ -282,11 +302,14 @@ public class Mining {
|
|||||||
}
|
}
|
||||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
//REDSTONE
|
//REDSTONE
|
||||||
if((block.getTypeId() == 73 || block.getTypeId() == 74) && m.getTier(player) >= 4){
|
if((block.getTypeId() == 73 || block.getTypeId() == 74) && m.getTier(player) >= 4)
|
||||||
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
|
{
|
||||||
|
if(!Config.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5)
|
||||||
|
{
|
||||||
xp += 15;
|
xp += 15;
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
blockProcCheck(block, player);
|
blockProcCheck(block, player);
|
||||||
@ -296,9 +319,11 @@ public class Mining {
|
|||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
if(Math.random() * 10 > 5){
|
if(Math.random() * 10 > 5)
|
||||||
|
{
|
||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
}
|
}
|
||||||
|
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
//LAPUS
|
//LAPUS
|
||||||
@ -314,6 +339,7 @@ public class Mining {
|
|||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
loc.getWorld().dropItemNaturally(loc, item);
|
loc.getWorld().dropItemNaturally(loc, item);
|
||||||
|
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
if(block.getData() != (byte) 5)
|
if(block.getData() != (byte) 5)
|
||||||
|
@ -85,7 +85,8 @@ public class Swords {
|
|||||||
int targets = 0;
|
int targets = 0;
|
||||||
Entity x = event.getEntity();
|
Entity x = event.getEntity();
|
||||||
targets = m.getTier(attacker);
|
targets = m.getTier(attacker);
|
||||||
for(Entity derp : x.getWorld().getEntities()){
|
for(Entity derp : x.getWorld().getEntities())
|
||||||
|
{
|
||||||
if(m.getDistance(x.getLocation(), derp.getLocation()) < 5){
|
if(m.getDistance(x.getLocation(), derp.getLocation()) < 5){
|
||||||
if(derp instanceof Player){
|
if(derp instanceof Player){
|
||||||
Player target = (Player)derp;
|
Player target = (Player)derp;
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
name: mcMMO
|
name: mcMMO
|
||||||
main: com.gmail.nossr50.mcMMO
|
main: com.gmail.nossr50.mcMMO
|
||||||
version: 1.0.05
|
version: 1.0.07
|
Loading…
Reference in New Issue
Block a user