mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
MySQL 90% done + Other junk
This commit is contained in:
parent
3352a74765
commit
9b22c82c02
127
mcMMO/com/gmail/nossr50/Database.java
Normal file
127
mcMMO/com/gmail/nossr50/Database.java
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
|
public class Database {
|
||||||
|
|
||||||
|
private Connection conn;
|
||||||
|
|
||||||
|
public Database() {
|
||||||
|
|
||||||
|
// Load the driver instance
|
||||||
|
try {
|
||||||
|
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// handle the error
|
||||||
|
}
|
||||||
|
|
||||||
|
// make the connection
|
||||||
|
try {
|
||||||
|
conn = DriverManager.getConnection("jdbc:mysql://" + mcLoadProperties.MySQLserverName + ":" + mcLoadProperties.MySQLport + "/" + mcLoadProperties.MySQLdbName + "?user=" + mcLoadProperties.MySQLuserName + "&password=" + mcLoadProperties.MySQLdbPass);
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
// handle any errors
|
||||||
|
System.out.println("SQLException: " + ex.getMessage());
|
||||||
|
System.out.println("SQLState: " + ex.getSQLState());
|
||||||
|
System.out.println("VendorError: " + ex.getErrorCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// write query
|
||||||
|
public boolean Write(String sql) {
|
||||||
|
try {
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
stmt = this.conn.prepareStatement(sql);
|
||||||
|
stmt.executeUpdate();
|
||||||
|
return true;
|
||||||
|
} catch(SQLException ex) {
|
||||||
|
System.out.println("SQLException: " + ex.getMessage());
|
||||||
|
System.out.println("SQLState: " + ex.getSQLState());
|
||||||
|
System.out.println("VendorError: " + ex.getErrorCode());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get Int
|
||||||
|
// only return first row / first field
|
||||||
|
public Integer GetInt(String sql) {
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
Integer result = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
stmt = this.conn.prepareStatement(sql);
|
||||||
|
if (stmt.executeQuery() != null) {
|
||||||
|
stmt.executeQuery();
|
||||||
|
rs = stmt.getResultSet();
|
||||||
|
rs.next();
|
||||||
|
result = rs.getInt(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (SQLException ex) {
|
||||||
|
System.out.println("SQLException: " + ex.getMessage());
|
||||||
|
System.out.println("SQLState: " + ex.getSQLState());
|
||||||
|
System.out.println("VendorError: " + ex.getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// read query
|
||||||
|
public HashMap<Integer, ArrayList<String>> Read(String sql) {
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
stmt = this.conn.prepareStatement(sql);
|
||||||
|
if (stmt.executeQuery() != null) {
|
||||||
|
stmt.executeQuery();
|
||||||
|
rs = stmt.getResultSet();
|
||||||
|
while (rs.next()) {
|
||||||
|
ArrayList<String> Col = new ArrayList<String>();
|
||||||
|
for(int i=1;i<=rs.getMetaData().getColumnCount();i++) {
|
||||||
|
Col.add(rs.getString(i));
|
||||||
|
}
|
||||||
|
Rows.put(rs.getRow(),Col);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (SQLException ex) {
|
||||||
|
System.out.println("SQLException: " + ex.getMessage());
|
||||||
|
System.out.println("SQLState: " + ex.getSQLState());
|
||||||
|
System.out.println("VendorError: " + ex.getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// release dataset
|
||||||
|
if (rs != null) {
|
||||||
|
try {
|
||||||
|
rs.close();
|
||||||
|
} catch (SQLException sqlEx) { } // ignore
|
||||||
|
rs = null;
|
||||||
|
}
|
||||||
|
if (stmt != null) {
|
||||||
|
try {
|
||||||
|
stmt.close();
|
||||||
|
} catch (SQLException sqlEx) { } // ignore
|
||||||
|
stmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
11
mcMMO/com/gmail/nossr50/datatypes/FakeBlockBreakEvent.java
Normal file
11
mcMMO/com/gmail/nossr50/datatypes/FakeBlockBreakEvent.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package com.gmail.nossr50.datatypes;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
|
||||||
|
public class FakeBlockBreakEvent extends BlockBreakEvent {
|
||||||
|
public FakeBlockBreakEvent(Block theBlock, Player player) {
|
||||||
|
super(theBlock, player);
|
||||||
|
}
|
||||||
|
}
|
1686
mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java
Normal file
1686
mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java
Normal file
File diff suppressed because it is too large
Load Diff
29
mcMMO/com/gmail/nossr50/datatypes/Tree.java
Normal file
29
mcMMO/com/gmail/nossr50/datatypes/Tree.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package com.gmail.nossr50.datatypes;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.PlayerStat;
|
||||||
|
|
||||||
|
public class Tree {
|
||||||
|
|
||||||
|
TreeNode root = null;
|
||||||
|
|
||||||
|
public Tree(){}
|
||||||
|
|
||||||
|
public void add(String p, int in)
|
||||||
|
{
|
||||||
|
if(root == null)
|
||||||
|
root = new TreeNode(p, in);
|
||||||
|
else
|
||||||
|
root.add(p,in);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerStat[] inOrder()
|
||||||
|
{
|
||||||
|
ArrayList<PlayerStat> order = root.inOrder(new ArrayList<PlayerStat>());
|
||||||
|
return order.toArray(new PlayerStat[order.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
45
mcMMO/com/gmail/nossr50/datatypes/TreeNode.java
Normal file
45
mcMMO/com/gmail/nossr50/datatypes/TreeNode.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package com.gmail.nossr50.datatypes;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.PlayerStat;
|
||||||
|
|
||||||
|
public class TreeNode {
|
||||||
|
TreeNode left = null
|
||||||
|
, right = null;
|
||||||
|
PlayerStat ps = new PlayerStat();
|
||||||
|
|
||||||
|
public TreeNode(String p, int in) {ps.statVal = in; ps.name = p;}
|
||||||
|
|
||||||
|
public void add (String p, int in) {
|
||||||
|
if (in >= ps.statVal)
|
||||||
|
{
|
||||||
|
if (left == null)
|
||||||
|
left = new TreeNode(p,in);
|
||||||
|
else
|
||||||
|
left.add(p, in);
|
||||||
|
}
|
||||||
|
else if(in < ps.statVal)
|
||||||
|
{
|
||||||
|
if (right == null)
|
||||||
|
right = new TreeNode(p,in);
|
||||||
|
else
|
||||||
|
right.add(p, in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<PlayerStat> inOrder(ArrayList<PlayerStat> a)
|
||||||
|
{
|
||||||
|
if(left != null)
|
||||||
|
a = left.inOrder(a);
|
||||||
|
|
||||||
|
a.add(ps);
|
||||||
|
|
||||||
|
if(right != null)
|
||||||
|
a = right.inOrder(a);
|
||||||
|
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
@ -4,8 +4,7 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.PlayerList.PlayerProfile;
|
|
||||||
|
|
||||||
|
|
||||||
public class mcAcrobatics {
|
public class mcAcrobatics {
|
||||||
@ -18,7 +17,7 @@ public class mcAcrobatics {
|
|||||||
}
|
}
|
||||||
public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){
|
public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){
|
||||||
if(player != null && mcPermissions.getInstance().acrobatics(player)){
|
if(player != null && mcPermissions.getInstance().acrobatics(player)){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
int acrovar = PP.getAcrobaticsInt();
|
int acrovar = PP.getAcrobaticsInt();
|
||||||
if(player.isSneaking())
|
if(player.isSneaking())
|
||||||
acrovar = acrovar * 2;
|
acrovar = acrovar * 2;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -12,7 +13,7 @@ import org.bukkit.event.block.BlockListener;
|
|||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.PlayerList.PlayerProfile;
|
import com.gmail.nossr50.datatypes.FakeBlockBreakEvent;
|
||||||
|
|
||||||
|
|
||||||
public class mcBlockListener extends BlockListener {
|
public class mcBlockListener extends BlockListener {
|
||||||
@ -43,7 +44,7 @@ public class mcBlockListener extends BlockListener {
|
|||||||
|
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
ItemStack inhand = player.getItemInHand();
|
ItemStack inhand = player.getItemInHand();
|
||||||
if(event.isCancelled())
|
if(event.isCancelled())
|
||||||
@ -159,7 +160,7 @@ public class mcBlockListener extends BlockListener {
|
|||||||
if(event.isCancelled())
|
if(event.isCancelled())
|
||||||
return;
|
return;
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
ItemStack inhand = player.getItemInHand();
|
ItemStack inhand = player.getItemInHand();
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
/*
|
/*
|
||||||
|
@ -17,9 +17,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.PlayerList.PlayerProfile;
|
|
||||||
|
|
||||||
|
|
||||||
public class mcCombat {
|
public class mcCombat {
|
||||||
private static mcMMO plugin;
|
private static mcMMO plugin;
|
||||||
@ -32,16 +30,16 @@ public class mcCombat {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
PlayerProfile PPa = mcUsers.getProfile(attacker);
|
||||||
Player defender = (Player)x;
|
Player defender = (Player)x;
|
||||||
PlayerProfile PPd = mcUsers.getProfile(defender.getName());
|
PlayerProfile PPd = mcUsers.getProfile(defender);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* COMPATABILITY CHECKS (Stuff that wouldn't happen normally in MC basically...)
|
* COMPATABILITY CHECKS (Stuff that wouldn't happen normally in MC basically...)
|
||||||
*/
|
*/
|
||||||
if(mcUsers.getProfile(defender.getName()) == null)
|
if(mcUsers.getProfile(defender) == null)
|
||||||
mcUsers.addUser(defender);
|
mcUsers.addUser(defender);
|
||||||
if(attacker != null && defender != null && mcUsers.getProfile(attacker.getName()).inParty() && mcUsers.getProfile(defender.getName()).inParty()){
|
if(attacker != null && defender != null && mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){
|
||||||
if(mcParty.getInstance().inSameParty(defender, attacker)){
|
if(mcParty.getInstance().inSameParty(defender, attacker)){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
@ -101,7 +99,7 @@ public class mcCombat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
|
public static void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
|
||||||
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
PlayerProfile PPa = mcUsers.getProfile(attacker);
|
||||||
if(x instanceof Squid){
|
if(x instanceof Squid){
|
||||||
if(!mcConfig.getInstance().isBleedTracked(x)){
|
if(!mcConfig.getInstance().isBleedTracked(x)){
|
||||||
bleedCheck(attacker, x);
|
bleedCheck(attacker, x);
|
||||||
@ -146,7 +144,7 @@ public class mcCombat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void playerVersusAnimalsChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, int type){
|
public static void playerVersusAnimalsChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, int type){
|
||||||
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
PlayerProfile PPa = mcUsers.getProfile(attacker);
|
||||||
if(x instanceof Animals){
|
if(x instanceof Animals){
|
||||||
if(!mcConfig.getInstance().isBleedTracked(x)){
|
if(!mcConfig.getInstance().isBleedTracked(x)){
|
||||||
bleedCheck(attacker, x);
|
bleedCheck(attacker, x);
|
||||||
@ -171,7 +169,7 @@ public class mcCombat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void playerVersusMonsterChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
|
public static void playerVersusMonsterChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
|
||||||
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
PlayerProfile PPa = mcUsers.getProfile(attacker);
|
||||||
if(x instanceof Monster){
|
if(x instanceof Monster){
|
||||||
/*
|
/*
|
||||||
* AXE PROC CHECKS
|
* AXE PROC CHECKS
|
||||||
@ -257,7 +255,7 @@ public class mcCombat {
|
|||||||
Entity x = event.getEntity();
|
Entity x = event.getEntity();
|
||||||
if(event.getProjectile().toString().equals("CraftArrow") && x instanceof Player){
|
if(event.getProjectile().toString().equals("CraftArrow") && x instanceof Player){
|
||||||
Player defender = (Player)x;
|
Player defender = (Player)x;
|
||||||
PlayerProfile PPd = mcUsers.getProfile(defender.getName());
|
PlayerProfile PPd = mcUsers.getProfile(defender);
|
||||||
if(PPd == null)
|
if(PPd == null)
|
||||||
mcUsers.addUser(defender);
|
mcUsers.addUser(defender);
|
||||||
if(mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getTypeId() == 0){
|
if(mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getTypeId() == 0){
|
||||||
@ -279,7 +277,7 @@ public class mcCombat {
|
|||||||
*/
|
*/
|
||||||
if(y instanceof Player){
|
if(y instanceof Player){
|
||||||
Player attacker = (Player)y;
|
Player attacker = (Player)y;
|
||||||
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
PlayerProfile PPa = mcUsers.getProfile(attacker);
|
||||||
if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){
|
if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){
|
||||||
if(!mcConfig.getInstance().isTracked(x) && event.getDamage() > 0){
|
if(!mcConfig.getInstance().isTracked(x) && event.getDamage() > 0){
|
||||||
mcConfig.getInstance().addArrowTrack(x, 0);
|
mcConfig.getInstance().addArrowTrack(x, 0);
|
||||||
@ -396,7 +394,7 @@ public class mcCombat {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player defender = (Player)x;
|
Player defender = (Player)x;
|
||||||
PlayerProfile PPd = mcUsers.getProfile(defender.getName());
|
PlayerProfile PPd = mcUsers.getProfile(defender);
|
||||||
/*
|
/*
|
||||||
* Stuff for the daze proc
|
* Stuff for the daze proc
|
||||||
*/
|
*/
|
||||||
@ -449,7 +447,7 @@ public class mcCombat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static boolean simulateUnarmedProc(Player player){
|
public static boolean simulateUnarmedProc(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(PP.getUnarmedInt() >= 1000){
|
if(PP.getUnarmedInt() >= 1000){
|
||||||
if(Math.random() * 4000 <= 1000){
|
if(Math.random() * 4000 <= 1000){
|
||||||
return true;
|
return true;
|
||||||
@ -462,7 +460,7 @@ public class mcCombat {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public static void bleedCheck(Player attacker, Entity x){
|
public static void bleedCheck(Player attacker, Entity x){
|
||||||
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
PlayerProfile PPa = mcUsers.getProfile(attacker);
|
||||||
if(mcPermissions.getInstance().swords(attacker) && mcm.isSwords(attacker.getItemInHand())){
|
if(mcPermissions.getInstance().swords(attacker) && mcm.isSwords(attacker.getItemInHand())){
|
||||||
if(PPa.getSwordsInt() >= 750){
|
if(PPa.getSwordsInt() >= 750){
|
||||||
if(Math.random() * 1000 >= 750){
|
if(Math.random() * 1000 >= 750){
|
||||||
@ -470,7 +468,7 @@ public class mcCombat {
|
|||||||
mcConfig.getInstance().addToBleedQue(x);
|
mcConfig.getInstance().addToBleedQue(x);
|
||||||
if(x instanceof Player){
|
if(x instanceof Player){
|
||||||
Player target = (Player)x;
|
Player target = (Player)x;
|
||||||
mcUsers.getProfile(target.getName()).addBleedTicks(3);
|
mcUsers.getProfile(target).addBleedTicks(3);
|
||||||
}
|
}
|
||||||
attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**");
|
attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**");
|
||||||
}
|
}
|
||||||
@ -479,7 +477,7 @@ public class mcCombat {
|
|||||||
mcConfig.getInstance().addToBleedQue(x);
|
mcConfig.getInstance().addToBleedQue(x);
|
||||||
if(x instanceof Player){
|
if(x instanceof Player){
|
||||||
Player target = (Player)x;
|
Player target = (Player)x;
|
||||||
mcUsers.getProfile(target.getName()).addBleedTicks(2);
|
mcUsers.getProfile(target).addBleedTicks(2);
|
||||||
}
|
}
|
||||||
attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**");
|
attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**");
|
||||||
}
|
}
|
||||||
@ -542,7 +540,7 @@ public class mcCombat {
|
|||||||
if(!target.getName().equals(attacker.getName()) && targets >= 1){
|
if(!target.getName().equals(attacker.getName()) && targets >= 1){
|
||||||
target.damage(event.getDamage() / 4);
|
target.damage(event.getDamage() / 4);
|
||||||
target.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!");
|
target.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!");
|
||||||
mcUsers.getProfile(target.getName()).addBleedTicks(5);
|
mcUsers.getProfile(target).addBleedTicks(5);
|
||||||
targets--;
|
targets--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -568,7 +566,7 @@ public class mcCombat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Entity x){
|
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Entity x){
|
||||||
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
PlayerProfile PPa = mcUsers.getProfile(attacker);
|
||||||
if(mcm.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
if(mcm.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
||||||
if(PPa.getAxesInt() >= 750){
|
if(PPa.getAxesInt() >= 750){
|
||||||
if(Math.random() * 1000 <= 750){
|
if(Math.random() * 1000 <= 750){
|
||||||
@ -598,7 +596,7 @@ public class mcCombat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void parryCheck(Player defender, EntityDamageByEntityEvent event, Entity y){
|
public static void parryCheck(Player defender, EntityDamageByEntityEvent event, Entity y){
|
||||||
PlayerProfile PPd = mcUsers.getProfile(defender.getName());
|
PlayerProfile PPd = mcUsers.getProfile(defender);
|
||||||
if(defender != null && mcm.isSwords(defender.getItemInHand())
|
if(defender != null && mcm.isSwords(defender.getItemInHand())
|
||||||
&& mcPermissions.getInstance().swords(defender)){
|
&& mcPermissions.getInstance().swords(defender)){
|
||||||
if(PPd.getSwordsInt() >= 900){
|
if(PPd.getSwordsInt() >= 900){
|
||||||
|
@ -17,7 +17,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
import org.bukkit.event.entity.EntityListener;
|
import org.bukkit.event.entity.EntityListener;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import com.gmail.nossr50.PlayerList.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
|
|
||||||
|
|
||||||
public class mcEntityListener extends EntityListener {
|
public class mcEntityListener extends EntityListener {
|
||||||
@ -82,7 +82,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
*/
|
*/
|
||||||
if(e instanceof Player){
|
if(e instanceof Player){
|
||||||
Player defender = (Player)e;
|
Player defender = (Player)e;
|
||||||
PlayerProfile PPd = mcUsers.getProfile(defender.getName());
|
PlayerProfile PPd = mcUsers.getProfile(defender);
|
||||||
if(defender != null && mcConfig.getInstance().isGodModeToggled(defender.getName()))
|
if(defender != null && mcConfig.getInstance().isGodModeToggled(defender.getName()))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if(PPd == null)
|
if(PPd == null)
|
||||||
@ -119,7 +119,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
*/
|
*/
|
||||||
mcSkills.monitorSkills(attacker);
|
mcSkills.monitorSkills(attacker);
|
||||||
|
|
||||||
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
|
PlayerProfile PPa = mcUsers.getProfile(attacker);
|
||||||
/*
|
/*
|
||||||
* ACTIVATE ABILITIES
|
* ACTIVATE ABILITIES
|
||||||
*/
|
*/
|
||||||
@ -167,7 +167,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
*/
|
*/
|
||||||
if(e instanceof Player){
|
if(e instanceof Player){
|
||||||
Player defender = (Player)e;
|
Player defender = (Player)e;
|
||||||
PlayerProfile PPd = mcUsers.getProfile(defender.getName());
|
PlayerProfile PPd = mcUsers.getProfile(defender);
|
||||||
if(f instanceof Player){
|
if(f instanceof Player){
|
||||||
Player attacker = (Player)f;
|
Player attacker = (Player)f;
|
||||||
if(mcParty.getInstance().inSameParty(defender, attacker)){
|
if(mcParty.getInstance().inSameParty(defender, attacker)){
|
||||||
@ -240,7 +240,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
if(mcTaming.hasOwner(theWolf, plugin) && mcTaming.getInstance().getOwner(theWolf, plugin) != null){
|
if(mcTaming.hasOwner(theWolf, plugin) && mcTaming.getInstance().getOwner(theWolf, plugin) != null){
|
||||||
Player wolfMaster = mcTaming.getInstance().getOwner(theWolf, plugin);
|
Player wolfMaster = mcTaming.getInstance().getOwner(theWolf, plugin);
|
||||||
if(!event.isCancelled()){
|
if(!event.isCancelled()){
|
||||||
mcUsers.getProfile(wolfMaster.getName()).addXpToSkill(event.getDamage(), "Taming");
|
mcUsers.getProfile(wolfMaster).addXpToSkill(event.getDamage(), "Taming");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
*/
|
*/
|
||||||
if(x instanceof Player && !event.isCancelled()){
|
if(x instanceof Player && !event.isCancelled()){
|
||||||
Player herpderp = (Player)x;
|
Player herpderp = (Player)x;
|
||||||
mcUsers.getProfile(herpderp.getName()).setRecentlyHurt(System.currentTimeMillis());
|
mcUsers.getProfile(herpderp).setRecentlyHurt(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ public class mcEntityListener extends EntityListener {
|
|||||||
}
|
}
|
||||||
if(x instanceof Player){
|
if(x instanceof Player){
|
||||||
Player player = (Player)x;
|
Player player = (Player)x;
|
||||||
mcUsers.getProfile(player.getName()).setBleedTicks(0);
|
mcUsers.getProfile(player).setBleedTicks(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean isPlayer(Entity entity){
|
public boolean isPlayer(Entity entity){
|
||||||
|
@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import com.gmail.nossr50.PlayerList.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
|
|
||||||
|
|
||||||
public class mcExcavation {
|
public class mcExcavation {
|
||||||
@ -17,7 +17,7 @@ public class mcExcavation {
|
|||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
}
|
||||||
public static void gigaDrillBreakerActivationCheck(Player player, Block block, Plugin pluginx){
|
public static void gigaDrillBreakerActivationCheck(Player player, Block block, Plugin pluginx){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(mcm.isShovel(player.getItemInHand())){
|
if(mcm.isShovel(player.getItemInHand())){
|
||||||
if(block != null){
|
if(block != null){
|
||||||
if(!mcm.abilityBlockCheck(block))
|
if(!mcm.abilityBlockCheck(block))
|
||||||
@ -55,7 +55,7 @@ public class mcExcavation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void excavationProcCheck(Block block, Player player){
|
public static void excavationProcCheck(Block block, Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
int type = block.getTypeId();
|
int type = block.getTypeId();
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
ItemStack is = null;
|
ItemStack is = null;
|
||||||
|
@ -10,7 +10,7 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import com.gmail.nossr50.PlayerList.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
|
|
||||||
|
|
||||||
public class mcHerbalism {
|
public class mcHerbalism {
|
||||||
@ -22,7 +22,7 @@ public class mcHerbalism {
|
|||||||
public static void greenTerraWheat(Player player, Block block, BlockBreakEvent event){
|
public static void greenTerraWheat(Player player, Block block, BlockBreakEvent event){
|
||||||
if(block.getType() == Material.WHEAT && block.getData() == (byte) 0x07){
|
if(block.getType() == Material.WHEAT && block.getData() == (byte) 0x07){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
Material mat = Material.getMaterial(296);
|
Material mat = Material.getMaterial(296);
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
ItemStack is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
ItemStack is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||||
@ -80,7 +80,7 @@ public class mcHerbalism {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void greenTerraCheck(Player player, Block block, Plugin pluginx){
|
public static void greenTerraCheck(Player player, Block block, Plugin pluginx){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(mcm.isHoe(player.getItemInHand())){
|
if(mcm.isHoe(player.getItemInHand())){
|
||||||
if(block != null){
|
if(block != null){
|
||||||
if(!mcm.abilityBlockCheck(block))
|
if(!mcm.abilityBlockCheck(block))
|
||||||
@ -110,7 +110,7 @@ public class mcHerbalism {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void herbalismProcCheck(Block block, Player player, BlockBreakEvent event){
|
public static void herbalismProcCheck(Block block, Player player, BlockBreakEvent event){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
int type = block.getTypeId();
|
int type = block.getTypeId();
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
ItemStack is = null;
|
ItemStack is = null;
|
||||||
@ -215,7 +215,7 @@ public class mcHerbalism {
|
|||||||
mcSkills.XpCheck(player);
|
mcSkills.XpCheck(player);
|
||||||
}
|
}
|
||||||
public static void breadCheck(Player player, ItemStack is){
|
public static void breadCheck(Player player, ItemStack is){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(is.getTypeId() == 297){
|
if(is.getTypeId() == 297){
|
||||||
if(PP.getHerbalismInt() >= 50 && PP.getHerbalismInt() < 150){
|
if(PP.getHerbalismInt() >= 50 && PP.getHerbalismInt() < 150){
|
||||||
player.setHealth(player.getHealth() + 1);
|
player.setHealth(player.getHealth() + 1);
|
||||||
@ -237,7 +237,7 @@ public class mcHerbalism {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void stewCheck(Player player, ItemStack is){
|
public static void stewCheck(Player player, ItemStack is){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(is.getTypeId() == 282){
|
if(is.getTypeId() == 282){
|
||||||
if(PP.getHerbalismInt() >= 50 && PP.getHerbalismInt() < 150){
|
if(PP.getHerbalismInt() >= 50 && PP.getHerbalismInt() < 150){
|
||||||
player.setHealth(player.getHealth() + 1);
|
player.setHealth(player.getHealth() + 1);
|
||||||
|
@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import com.gmail.nossr50.PlayerList.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
|
|
||||||
|
|
||||||
public class mcItem {
|
public class mcItem {
|
||||||
@ -20,7 +20,7 @@ public class mcItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void chimaerawing(Player player, Plugin plugin){
|
public static void chimaerawing(Player player, Plugin plugin){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
ItemStack is = player.getItemInHand();
|
ItemStack is = player.getItemInHand();
|
||||||
Block block = player.getLocation().getBlock();
|
Block block = player.getLocation().getBlock();
|
||||||
if(mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == 288){
|
if(mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == 288){
|
||||||
|
@ -8,6 +8,8 @@ import java.io.IOException;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.Tree;
|
||||||
|
|
||||||
public class mcLeaderboard {
|
public class mcLeaderboard {
|
||||||
static String location = "plugins/mcMMO/mcmmo.users";
|
static String location = "plugins/mcMMO/mcmmo.users";
|
||||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
@ -38,6 +40,7 @@ public class mcLeaderboard {
|
|||||||
String line = "";
|
String line = "";
|
||||||
while((line = in.readLine()) != null)
|
while((line = in.readLine()) != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
String[] character = line.split(":");
|
String[] character = line.split(":");
|
||||||
String p = character[0];
|
String p = character[0];
|
||||||
|
|
||||||
@ -187,6 +190,8 @@ public class mcLeaderboard {
|
|||||||
return null; //Shouldn't get here
|
return null; //Shouldn't get here
|
||||||
}
|
}
|
||||||
public static void updateLeaderboard(PlayerStat ps, String statName){
|
public static void updateLeaderboard(PlayerStat ps, String statName){
|
||||||
|
if(mcLoadProperties.useMySQL)
|
||||||
|
return;
|
||||||
String theLocation = "plugins/mcMMO/" + statName + ".mcmmo";
|
String theLocation = "plugins/mcMMO/" + statName + ".mcmmo";
|
||||||
try {
|
try {
|
||||||
//Open the file
|
//Open the file
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
public class mcLoadProperties {
|
public class mcLoadProperties {
|
||||||
public static Boolean 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 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 String mctop, addxp, mcability, mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
|
public static String 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 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;
|
||||||
|
|
||||||
public static void loadMain(){
|
public static void loadMain(){
|
||||||
String propertiesFile = mcMMO.maindirectory + "mcmmo.properties";
|
String propertiesFile = mcMMO.maindirectory + "mcmmo.properties";
|
||||||
@ -20,9 +20,22 @@ public class mcLoadProperties {
|
|||||||
berserkCooldown = properties.getInteger("berserkCooldown", 240);
|
berserkCooldown = properties.getInteger("berserkCooldown", 240);
|
||||||
serratedStrikeCooldown = properties.getInteger("serratedStrikeCooldown", 240);
|
serratedStrikeCooldown = properties.getInteger("serratedStrikeCooldown", 240);
|
||||||
skullSplitterCooldown = properties.getInteger("skullSplitterCooldown", 240);
|
skullSplitterCooldown = properties.getInteger("skullSplitterCooldown", 240);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MySQL Stuff
|
||||||
|
*/
|
||||||
|
|
||||||
|
MySQLserverName = properties.getString("MySQLServer", "ipofserver");
|
||||||
|
MySQLdbPass = properties.getString("MySQLdbPass", "defaultdbpass");
|
||||||
|
MySQLdbName = properties.getString("MySQLdbName", "defaultdbname");
|
||||||
|
MySQLuserName = properties.getString("MySQLuserName", "defaultusername");
|
||||||
|
MySQLport = properties.getInteger("MySQLport", 3306);
|
||||||
|
useMySQL = properties.getBoolean("mysql", false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* OTHER
|
* OTHER
|
||||||
*/
|
*/
|
||||||
|
|
||||||
archeryFireRateLimit = properties.getBoolean("archeryFireRateLimit", true);
|
archeryFireRateLimit = properties.getBoolean("archeryFireRateLimit", true);
|
||||||
myspawnclearsinventory = properties.getBoolean("mySpawnClearsInventory", true);
|
myspawnclearsinventory = properties.getBoolean("mySpawnClearsInventory", true);
|
||||||
xpGainMultiplier = properties.getInteger("xpGainMultiplier", 1);
|
xpGainMultiplier = properties.getInteger("xpGainMultiplier", 1);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
import com.gmail.nossr50.PlayerList.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
import com.nijiko.Messaging;
|
import com.nijiko.Messaging;
|
||||||
import com.nijiko.permissions.PermissionHandler;
|
import com.nijiko.permissions.PermissionHandler;
|
||||||
@ -11,7 +11,17 @@ import java.io.File;
|
|||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.DatabaseMetaData;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.Statement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -34,6 +44,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public static PermissionHandler PermissionsHandler = null;
|
public static PermissionHandler PermissionsHandler = null;
|
||||||
private Permissions permissions;
|
private Permissions permissions;
|
||||||
private Timer mcMMO_Timer = new Timer(true);
|
private Timer mcMMO_Timer = new Timer(true);
|
||||||
|
public static Database database = null;
|
||||||
|
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(1000));
|
mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(1000));
|
||||||
@ -81,12 +92,23 @@ public class mcMMO extends JavaPlugin {
|
|||||||
pm.registerEvent(Event.Type.PLAYER_RESPAWN, playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_RESPAWN, playerListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.PLAYER_ITEM_HELD, playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_ITEM_HELD, playerListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.Highest, this);
|
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.Highest, this);
|
||||||
|
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
|
||||||
|
|
||||||
PluginDescriptionFile pdfFile = this.getDescription();
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
mcPermissions.initialize(getServer());
|
mcPermissions.initialize(getServer());
|
||||||
mcLeaderboard.makeLeaderboards(); //Make the leaderboards
|
mcLoadMySQL();
|
||||||
|
|
||||||
|
//mcLeaderboard.makeLeaderboards(); //Make the leaderboards
|
||||||
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void mcLoadMySQL() {
|
||||||
|
if (mcLoadProperties.useMySQL) {
|
||||||
|
// create database object
|
||||||
|
database = new Database();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setupPermissions() {
|
public void setupPermissions() {
|
||||||
Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
|
Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
|
||||||
if(this.PermissionsHandler == null) {
|
if(this.PermissionsHandler == null) {
|
||||||
@ -106,8 +128,8 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean inSameParty(Player playera, Player playerb){
|
public boolean inSameParty(Player playera, Player playerb){
|
||||||
if(mcUsers.getProfile(playera.getName()).inParty() && mcUsers.getProfile(playerb.getName()).inParty()){
|
if(mcUsers.getProfile(playera).inParty() && mcUsers.getProfile(playerb).inParty()){
|
||||||
if(mcUsers.getProfile(playera.getName()).getParty().equals(mcUsers.getProfile(playerb.getName()).getParty())){
|
if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -117,12 +139,12 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void addXp(Player player, String skillname, Integer newvalue){
|
public void addXp(Player player, String skillname, Integer newvalue){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
PP.addXpToSkill(newvalue, skillname);
|
PP.addXpToSkill(newvalue, skillname);
|
||||||
mcSkills.XpCheck(player);
|
mcSkills.XpCheck(player);
|
||||||
}
|
}
|
||||||
public void modifySkill(Player player, String skillname, Integer newvalue){
|
public void modifySkill(Player player, String skillname, Integer newvalue){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
PP.modifyskill(newvalue, skillname);
|
PP.modifyskill(newvalue, skillname);
|
||||||
}
|
}
|
||||||
public ArrayList<String> getParties(){
|
public ArrayList<String> getParties(){
|
||||||
@ -151,11 +173,11 @@ public class mcMMO extends JavaPlugin {
|
|||||||
return parties;
|
return parties;
|
||||||
}
|
}
|
||||||
public static String getPartyName(Player player){
|
public static String getPartyName(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
return PP.getParty();
|
return PP.getParty();
|
||||||
}
|
}
|
||||||
public static boolean inParty(Player player){
|
public static boolean inParty(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
return PP.inParty();
|
return PP.inParty();
|
||||||
}
|
}
|
||||||
public boolean isAdminChatToggled(Player player){
|
public boolean isAdminChatToggled(Player player){
|
||||||
|
@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import com.gmail.nossr50.PlayerList.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
|
|
||||||
|
|
||||||
public class mcMining {
|
public class mcMining {
|
||||||
@ -18,7 +18,7 @@ public class mcMining {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void superBreakerCheck(Player player, Block block, Plugin pluginx){
|
public static void superBreakerCheck(Player player, Block block, Plugin pluginx){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(mcm.isMiningPick(player.getItemInHand())){
|
if(mcm.isMiningPick(player.getItemInHand())){
|
||||||
if(block != null){
|
if(block != null){
|
||||||
if(!mcm.abilityBlockCheck(block))
|
if(!mcm.abilityBlockCheck(block))
|
||||||
@ -94,7 +94,7 @@ public class mcMining {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void blockProcCheck(Block block, Player player){
|
public static void blockProcCheck(Block block, Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(player != null){
|
if(player != null){
|
||||||
if(Math.random() * 1000 <= PP.getMiningInt()){
|
if(Math.random() * 1000 <= PP.getMiningInt()){
|
||||||
blockProcSimulate(block);
|
blockProcSimulate(block);
|
||||||
@ -103,7 +103,7 @@ public class mcMining {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void miningBlockCheck(Player player, Block block){
|
public static void miningBlockCheck(Player player, Block block){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(mcConfig.getInstance().isBlockWatched(block) || block.getData() == (byte) 5)
|
if(mcConfig.getInstance().isBlockWatched(block) || block.getData() == (byte) 5)
|
||||||
return;
|
return;
|
||||||
int xp = 0;
|
int xp = 0;
|
||||||
@ -171,7 +171,7 @@ public class mcMining {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void SuperBreakerBlockCheck(Player player, Block block){
|
public static void SuperBreakerBlockCheck(Player player, Block block){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
|
if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
|
||||||
mcm.damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss);
|
mcm.damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss);
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
|
@ -17,12 +17,12 @@ public class mcParty {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
public boolean inSameParty(Player playera, Player playerb){
|
public boolean inSameParty(Player playera, Player playerb){
|
||||||
if(mcUsers.getProfile(playera.getName()) == null || mcUsers.getProfile(playerb.getName()) == null){
|
if(mcUsers.getProfile(playera) == null || mcUsers.getProfile(playerb) == null){
|
||||||
mcUsers.addUser(playera);
|
mcUsers.addUser(playera);
|
||||||
mcUsers.addUser(playerb);
|
mcUsers.addUser(playerb);
|
||||||
}
|
}
|
||||||
if(mcUsers.getProfile(playera.getName()).inParty() && mcUsers.getProfile(playerb.getName()).inParty()){
|
if(mcUsers.getProfile(playera).inParty() && mcUsers.getProfile(playerb).inParty()){
|
||||||
if(mcUsers.getProfile(playera.getName()).getParty().equals(mcUsers.getProfile(playerb.getName()).getParty())){
|
if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -36,7 +36,7 @@ public class mcParty {
|
|||||||
int x = 0;
|
int x = 0;
|
||||||
for(Player hurrdurr : players){
|
for(Player hurrdurr : players){
|
||||||
if(player != null && hurrdurr != null){
|
if(player != null && hurrdurr != null){
|
||||||
if(mcUsers.getProfile(player.getName()).getParty().equals(mcUsers.getProfile(hurrdurr.getName()).getParty()))
|
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(hurrdurr).getParty()))
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,11 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
import org.bukkit.event.player.PlayerListener;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.PlayerList.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
|
|
||||||
|
|
||||||
public class mcPlayerListener extends PlayerListener {
|
public class mcPlayerListener extends PlayerListener {
|
||||||
@ -30,9 +31,10 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
plugin = instance;
|
plugin = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(player != null){
|
if(player != null){
|
||||||
PP.setRespawnATS(System.currentTimeMillis());
|
PP.setRespawnATS(System.currentTimeMillis());
|
||||||
Location mySpawn = PP.getMySpawn(player);
|
Location mySpawn = PP.getMySpawn(player);
|
||||||
@ -66,6 +68,9 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
mcUsers.addUser(player);
|
mcUsers.addUser(player);
|
||||||
}
|
}
|
||||||
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
|
mcUsers.removeUser(event.getPlayer());
|
||||||
|
}
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if(mcPermissions.getInstance().motd(player)){
|
if(mcPermissions.getInstance().motd(player)){
|
||||||
@ -75,7 +80,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
Action action = event.getAction();
|
Action action = event.getAction();
|
||||||
Block block = event.getClickedBlock();
|
Block block = event.getClickedBlock();
|
||||||
//Archery Nerf
|
//Archery Nerf
|
||||||
@ -162,7 +167,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
String[] split = event.getMessage().split(" ");
|
String[] split = event.getMessage().split(" ");
|
||||||
String playerName = player.getName();
|
String playerName = player.getName();
|
||||||
//Check if the command is an mcMMO related help command
|
//Check if the command is an mcMMO related help command
|
||||||
@ -378,7 +383,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
if(split.length == 4){
|
if(split.length == 4){
|
||||||
if(isPlayer(split[1]) && mcm.isInt(split[3]) && mcSkills.isSkill(split[2])){
|
if(isPlayer(split[1]) && mcm.isInt(split[3]) && mcSkills.isSkill(split[2])){
|
||||||
int newvalue = Integer.valueOf(split[3]);
|
int newvalue = Integer.valueOf(split[3]);
|
||||||
mcUsers.getProfile(getPlayer(split[1]).getName()).modifyskill(newvalue, split[2]);
|
mcUsers.getProfile(getPlayer(split[1])).modifyskill(newvalue, split[2]);
|
||||||
player.sendMessage(ChatColor.RED+split[2]+" has been modified.");
|
player.sendMessage(ChatColor.RED+split[2]+" has been modified.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -408,7 +413,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
if(split.length == 4){
|
if(split.length == 4){
|
||||||
if(isPlayer(split[1]) && mcm.isInt(split[3]) && mcSkills.isSkill(split[2])){
|
if(isPlayer(split[1]) && mcm.isInt(split[3]) && mcSkills.isSkill(split[2])){
|
||||||
int newvalue = Integer.valueOf(split[3]);
|
int newvalue = Integer.valueOf(split[3]);
|
||||||
mcUsers.getProfile(getPlayer(split[1]).getName()).addXpToSkill(newvalue, split[2]);
|
mcUsers.getProfile(getPlayer(split[1])).addXpToSkill(newvalue, split[2]);
|
||||||
getPlayer(split[1]).sendMessage(ChatColor.GREEN+"Experience granted!");
|
getPlayer(split[1]).sendMessage(ChatColor.GREEN+"Experience granted!");
|
||||||
player.sendMessage(ChatColor.RED+split[2]+" has been modified.");
|
player.sendMessage(ChatColor.RED+split[2]+" has been modified.");
|
||||||
}
|
}
|
||||||
@ -439,7 +444,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
if(isPlayer(split[1])){
|
if(isPlayer(split[1])){
|
||||||
Player target = getPlayer(split[1]);
|
Player target = getPlayer(split[1]);
|
||||||
PlayerProfile PPt = mcUsers.getProfile(target.getName());
|
PlayerProfile PPt = mcUsers.getProfile(target);
|
||||||
if(PP.getParty().equals(PPt.getParty())){
|
if(PP.getParty().equals(PPt.getParty())){
|
||||||
player.teleportTo(target);
|
player.teleportTo(target);
|
||||||
player.sendMessage(ChatColor.GREEN+"You have teleported to "+target.getName());
|
player.sendMessage(ChatColor.GREEN+"You have teleported to "+target.getName());
|
||||||
@ -459,7 +464,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
//if split[1] is a player
|
//if split[1] is a player
|
||||||
if(isPlayer(split[1])){
|
if(isPlayer(split[1])){
|
||||||
Player target = getPlayer(split[1]);
|
Player target = getPlayer(split[1]);
|
||||||
PlayerProfile PPt = mcUsers.getProfile(target.getName());
|
PlayerProfile PPt = mcUsers.getProfile(target);
|
||||||
double x,y,z;
|
double x,y,z;
|
||||||
x = target.getLocation().getX();
|
x = target.getLocation().getX();
|
||||||
y = target.getLocation().getY();
|
y = target.getLocation().getY();
|
||||||
@ -590,7 +595,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
if(PP.inParty() && split.length >= 2 && isPlayer(split[1])){
|
if(PP.inParty() && split.length >= 2 && isPlayer(split[1])){
|
||||||
Player target = getPlayer(split[1]);
|
Player target = getPlayer(split[1]);
|
||||||
PlayerProfile PPt = mcUsers.getProfile(target.getName());
|
PlayerProfile PPt = mcUsers.getProfile(target);
|
||||||
PPt.modifyInvite(PP.getParty());
|
PPt.modifyInvite(PP.getParty());
|
||||||
player.sendMessage(ChatColor.GREEN+"Invite sent successfully");
|
player.sendMessage(ChatColor.GREEN+"Invite sent successfully");
|
||||||
target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+PPt.getInvite()+" from "+player.getName());
|
target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+PPt.getInvite()+" from "+player.getName());
|
||||||
@ -627,7 +632,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
int x = 0;
|
int x = 0;
|
||||||
for(Player p : plugin.getServer().getOnlinePlayers())
|
for(Player p : plugin.getServer().getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if(PP.getParty().equals(mcUsers.getProfile(p.getName()).getParty())){
|
if(PP.getParty().equals(mcUsers.getProfile(p).getParty())){
|
||||||
if(p != null && x+1 >= mcParty.getInstance().partyCount(player, getPlayersOnline())){
|
if(p != null && x+1 >= mcParty.getInstance().partyCount(player, getPlayersOnline())){
|
||||||
tempList+= p.getName();
|
tempList+= p.getName();
|
||||||
x++;
|
x++;
|
||||||
@ -733,16 +738,18 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onPlayerChat(PlayerChatEvent event) {
|
public void onPlayerChat(PlayerChatEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
String x = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getName() + ChatColor.GREEN + ") ";
|
String x = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getName() + ChatColor.GREEN + ") ";
|
||||||
String y = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} ";
|
String y = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} ";
|
||||||
if(mcConfig.getInstance().isPartyToggled(player.getName())){
|
if(mcConfig.getInstance().isPartyToggled(player.getName())){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
log.log(Level.INFO, "[P]("+PP.getParty()+")"+"<"+player.getName()+"> "+event.getMessage());
|
log.log(Level.INFO, "[P]("+PP.getParty()+")"+"<"+player.getName()+"> "+event.getMessage());
|
||||||
for(Player herp : plugin.getServer().getOnlinePlayers()){
|
for(Player herp : plugin.getServer().getOnlinePlayers()){
|
||||||
if(mcUsers.getProfile(herp.getName()).inParty()){
|
if(mcUsers.getProfile(herp).inParty()){
|
||||||
if(mcParty.getInstance().inSameParty(herp, player)){
|
if(mcParty.getInstance().inSameParty(herp, player)){
|
||||||
herp.sendMessage(x+event.getMessage());
|
herp.sendMessage(x+event.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ 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 com.gmail.nossr50.PlayerList.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
|
|
||||||
|
|
||||||
public class mcRepair {
|
public class mcRepair {
|
||||||
@ -16,7 +16,7 @@ public class mcRepair {
|
|||||||
private static volatile mcRepair instance;
|
private static volatile mcRepair instance;
|
||||||
|
|
||||||
public static void repairCheck(Player player, ItemStack is, Block block){
|
public static void repairCheck(Player player, ItemStack is, Block block){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
short durabilityBefore = player.getItemInHand().getDurability();
|
short durabilityBefore = player.getItemInHand().getDurability();
|
||||||
short durabilityAfter = 0;
|
short durabilityAfter = 0;
|
||||||
short dif = 0;
|
short dif = 0;
|
||||||
@ -267,7 +267,7 @@ public class mcRepair {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public static short repairCalculate(Player player, short durability, short ramt){
|
public static short repairCalculate(Player player, short durability, short ramt){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
float bonus = (PP.getRepairInt() / 500);
|
float bonus = (PP.getRepairInt() / 500);
|
||||||
bonus = (ramt * bonus);
|
bonus = (ramt * bonus);
|
||||||
ramt = ramt+=bonus;
|
ramt = ramt+=bonus;
|
||||||
@ -396,7 +396,7 @@ public class mcRepair {
|
|||||||
return repairCalculate(player, durability, ramt);
|
return repairCalculate(player, durability, ramt);
|
||||||
}
|
}
|
||||||
public static void needMoreVespeneGas(ItemStack is, Player player){
|
public static void needMoreVespeneGas(ItemStack is, Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if ((isDiamondTools(is) || isDiamondArmor(is)) && PP.getRepairInt() < mcLoadProperties.repairdiamondlevel){
|
if ((isDiamondTools(is) || isDiamondArmor(is)) && PP.getRepairInt() < mcLoadProperties.repairdiamondlevel){
|
||||||
player.sendMessage(ChatColor.DARK_RED +"You're not adept enough to repair Diamond");
|
player.sendMessage(ChatColor.DARK_RED +"You're not adept enough to repair Diamond");
|
||||||
} else if (isDiamondTools(is) && !hasDiamond(player) || isIronTools(is) && !hasIron(player) || isGoldTools(is) && !hasGold(player)){
|
} else if (isDiamondTools(is) && !hasDiamond(player) || isIronTools(is) && !hasIron(player) || isGoldTools(is) && !hasGold(player)){
|
||||||
@ -417,7 +417,7 @@ public class mcRepair {
|
|||||||
player.sendMessage(ChatColor.DARK_RED+"You can't repair stacked items");
|
player.sendMessage(ChatColor.DARK_RED+"You can't repair stacked items");
|
||||||
}
|
}
|
||||||
public static boolean checkPlayerProcRepair(Player player){
|
public static boolean checkPlayerProcRepair(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(player != null){
|
if(player != null){
|
||||||
if(Math.random() * 1000 <= PP.getRepairInt()){
|
if(Math.random() * 1000 <= PP.getRepairInt()){
|
||||||
player.sendMessage(ChatColor.GRAY + "That felt easy.");
|
player.sendMessage(ChatColor.GRAY + "That felt easy.");
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import com.gmail.nossr50.PlayerList.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
|
|
||||||
|
|
||||||
public class mcSkills {
|
public class mcSkills {
|
||||||
@ -51,7 +51,7 @@ public class mcSkills {
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
public static void watchCooldowns(Player player){
|
public static void watchCooldowns(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(!PP.getGreenTerraInformed() && System.currentTimeMillis() - PP.getGreenTerraDeactivatedTimeStamp() >= (mcLoadProperties.greenTerraCooldown * 1000)){
|
if(!PP.getGreenTerraInformed() && System.currentTimeMillis() - PP.getGreenTerraDeactivatedTimeStamp() >= (mcLoadProperties.greenTerraCooldown * 1000)){
|
||||||
PP.setGreenTerraInformed(true);
|
PP.setGreenTerraInformed(true);
|
||||||
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Green Terra "+ChatColor.GREEN+"ability is refreshed!");
|
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Green Terra "+ChatColor.GREEN+"ability is refreshed!");
|
||||||
@ -82,7 +82,7 @@ public class mcSkills {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void hoeReadinessCheck(Player player){
|
public static void hoeReadinessCheck(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(mcPermissions.getInstance().herbalismAbility(player) && mcm.isHoe(player.getItemInHand()) && !PP.getHoePreparationMode()){
|
if(mcPermissions.getInstance().herbalismAbility(player) && mcm.isHoe(player.getItemInHand()) && !PP.getHoePreparationMode()){
|
||||||
if(!PP.getGreenTerraMode() && !cooldownOver(player, PP.getGreenTerraDeactivatedTimeStamp(), mcLoadProperties.greenTerraCooldown)){
|
if(!PP.getGreenTerraMode() && !cooldownOver(player, PP.getGreenTerraDeactivatedTimeStamp(), mcLoadProperties.greenTerraCooldown)){
|
||||||
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
|
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
|
||||||
@ -95,7 +95,7 @@ public class mcSkills {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void abilityActivationCheck(Player player){
|
public static void abilityActivationCheck(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(!PP.getAbilityUse())
|
if(!PP.getAbilityUse())
|
||||||
return;
|
return;
|
||||||
if(mcPermissions.getInstance().miningAbility(player) && mcm.isMiningPick(player.getItemInHand()) && !PP.getPickaxePreparationMode()){
|
if(mcPermissions.getInstance().miningAbility(player) && mcm.isMiningPick(player.getItemInHand()) && !PP.getPickaxePreparationMode()){
|
||||||
@ -147,7 +147,7 @@ public class mcSkills {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void serratedStrikesActivationCheck(Player player, Plugin pluginx){
|
public static void serratedStrikesActivationCheck(Player player, Plugin pluginx){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(mcm.isSwords(player.getItemInHand())){
|
if(mcm.isSwords(player.getItemInHand())){
|
||||||
if(PP.getSwordsPreparationMode()){
|
if(PP.getSwordsPreparationMode()){
|
||||||
PP.setSwordsPreparationMode(false);
|
PP.setSwordsPreparationMode(false);
|
||||||
@ -173,7 +173,7 @@ public class mcSkills {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void berserkActivationCheck(Player player, Plugin pluginx){
|
public static void berserkActivationCheck(Player player, Plugin pluginx){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(player.getItemInHand().getTypeId() == 0){
|
if(player.getItemInHand().getTypeId() == 0){
|
||||||
if(PP.getFistsPreparationMode()){
|
if(PP.getFistsPreparationMode()){
|
||||||
PP.setFistsPreparationMode(false);
|
PP.setFistsPreparationMode(false);
|
||||||
@ -198,7 +198,7 @@ public class mcSkills {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void skullSplitterCheck(Player player, Plugin pluginx){
|
public static void skullSplitterCheck(Player player, Plugin pluginx){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(mcm.isAxes(player.getItemInHand()) && mcPermissions.getInstance().axesAbility(player)){
|
if(mcm.isAxes(player.getItemInHand()) && mcPermissions.getInstance().axesAbility(player)){
|
||||||
/*
|
/*
|
||||||
* CHECK FOR AXE PREP MODE
|
* CHECK FOR AXE PREP MODE
|
||||||
@ -230,7 +230,7 @@ public class mcSkills {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void monitorSkills(Player player){
|
public static void monitorSkills(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(PP == null)
|
if(PP == null)
|
||||||
mcUsers.addUser(player);
|
mcUsers.addUser(player);
|
||||||
if(PP.getHoePreparationMode() && System.currentTimeMillis() - PP.getHoePreparationATS() >= 4000){
|
if(PP.getHoePreparationMode() && System.currentTimeMillis() - PP.getHoePreparationATS() >= 4000){
|
||||||
@ -336,7 +336,7 @@ public class mcSkills {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void XpCheck(Player player){
|
public static void XpCheck(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
/*
|
/*
|
||||||
* TAMING
|
* TAMING
|
||||||
*/
|
*/
|
||||||
|
@ -5,7 +5,7 @@ import java.util.TimerTask;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
|
|
||||||
import com.gmail.nossr50.PlayerList.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
|
|
||||||
|
|
||||||
public class mcTimer extends TimerTask{
|
public class mcTimer extends TimerTask{
|
||||||
@ -19,7 +19,7 @@ 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 = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(player == null)
|
if(player == null)
|
||||||
continue;
|
continue;
|
||||||
if(PP == null)
|
if(PP == null)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import com.gmail.nossr50.PlayerList.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
|
|
||||||
|
|
||||||
public class mcWoodCutting {
|
public class mcWoodCutting {
|
||||||
@ -22,7 +22,7 @@ public class mcWoodCutting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void woodCuttingProcCheck(Player player, Block block){
|
public static void woodCuttingProcCheck(Player player, Block block){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
byte type = block.getData();
|
byte type = block.getData();
|
||||||
Material mat = Material.getMaterial(block.getTypeId());
|
Material mat = Material.getMaterial(block.getTypeId());
|
||||||
if(player != null){
|
if(player != null){
|
||||||
@ -33,7 +33,7 @@ public class mcWoodCutting {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void treeFellerCheck(Player player, Block block, Plugin pluginx){
|
public static void treeFellerCheck(Player player, Block block, Plugin pluginx){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(mcm.isAxes(player.getItemInHand())){
|
if(mcm.isAxes(player.getItemInHand())){
|
||||||
if(block != null){
|
if(block != null){
|
||||||
if(!mcm.abilityBlockCheck(block))
|
if(!mcm.abilityBlockCheck(block))
|
||||||
@ -69,7 +69,7 @@ public class mcWoodCutting {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void treeFeller(Block block, Player player){
|
public static void treeFeller(Block block, Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
int radius = 1;
|
int radius = 1;
|
||||||
if(PP.getWoodCuttingXPInt() >= 500)
|
if(PP.getWoodCuttingXPInt() >= 500)
|
||||||
radius++;
|
radius++;
|
||||||
|
@ -14,7 +14,8 @@ import org.bukkit.event.player.PlayerChatEvent;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import com.gmail.nossr50.PlayerList.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
|
import com.gmail.nossr50.datatypes.FakeBlockBreakEvent;
|
||||||
|
|
||||||
public class mcm {
|
public class mcm {
|
||||||
/*
|
/*
|
||||||
@ -27,7 +28,7 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int getPowerLevel(Player player){
|
public static int getPowerLevel(Player player){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
int x = 0;
|
int x = 0;
|
||||||
if(mcPermissions.getInstance().mining(player))
|
if(mcPermissions.getInstance().mining(player))
|
||||||
x+=PP.getMiningInt();
|
x+=PP.getMiningInt();
|
||||||
@ -297,7 +298,7 @@ public class mcm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void mcmmoHelpCheck(String[] split, Player player, PlayerChatEvent event){
|
public static void mcmmoHelpCheck(String[] split, Player player, PlayerChatEvent event){
|
||||||
PlayerProfile PP = mcUsers.getProfile(player.getName());
|
PlayerProfile PP = mcUsers.getProfile(player);
|
||||||
if(split[0].equalsIgnoreCase("/woodcutting")){
|
if(split[0].equalsIgnoreCase("/woodcutting")){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
float skillvalue = (float)PP.getWoodCuttingInt();
|
float skillvalue = (float)PP.getWoodCuttingInt();
|
||||||
|
Loading…
Reference in New Issue
Block a user