mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
mcMMO version 1.0.04
This commit is contained in:
parent
f016ce1a9d
commit
dfd7f8839c
@ -1,5 +1,17 @@
|
||||
Changelog:
|
||||
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
|
||||
Version 1.0.04
|
||||
Fixed bug where players would be informed incorrectly when their cooldowns refreshed
|
||||
Fixed exploit where players could reconnect to reset their cooldowns
|
||||
Added new "cooldowns" table to MySQL
|
||||
Berserk now breaks through snow
|
||||
Lightning no longer gives Taming XP
|
||||
Shortened /mcc to fit the screen
|
||||
|
||||
Version 1.0.03
|
||||
Bleed will no longer trigger on friendly wolves
|
||||
Axes criticals will no longer trigger on friendly wolves
|
||||
|
||||
Version 1.0.02
|
||||
Fixed bug where the Timer would start before everything else was ready
|
||||
Fixed bug where mcrefresh also required mcability permission node
|
||||
|
@ -60,9 +60,9 @@ public class Combat {
|
||||
combatAbilityChecks(attacker, PPa, pluginx);
|
||||
|
||||
//Check for offensive procs
|
||||
Axes.axeCriticalCheck(attacker, eventb); //Axe Criticals
|
||||
Axes.axeCriticalCheck(attacker, eventb, pluginx); //Axe Criticals
|
||||
if(!Config.getInstance().isBleedTracked(event.getEntity())) //Swords Bleed
|
||||
Swords.bleedCheck(attacker, event.getEntity());
|
||||
Swords.bleedCheck(attacker, event.getEntity(), pluginx);
|
||||
if(event.getEntity() instanceof Player){
|
||||
Player defender = (Player)event.getEntity();
|
||||
Unarmed.disarmProcCheck(attacker, defender);
|
||||
@ -199,7 +199,7 @@ public class Combat {
|
||||
/*
|
||||
* TEMPORARY FIX AS WOLVES AREN'T TRIGGERING DAMAGE EVENTS WHEN ATTACKING NON PLAYERS AT THE TIME OF WRITING
|
||||
*/
|
||||
if(!event.isCancelled()){
|
||||
if(!event.isCancelled() && event.getCause() != DamageCause.LIGHTNING){
|
||||
PPo.addTamingXP(event.getDamage() * 3);
|
||||
Skills.XpCheck(master);
|
||||
}
|
||||
@ -217,14 +217,15 @@ public class Combat {
|
||||
}
|
||||
}
|
||||
|
||||
public static void combatAbilityChecks(Player attacker, PlayerProfile PPa, Plugin pluginx){
|
||||
public static void combatAbilityChecks(Player attacker, PlayerProfile PPa, Plugin pluginx)
|
||||
{
|
||||
//Check to see if any abilities need to be activated
|
||||
if(PPa.getAxePreparationMode())
|
||||
Skills.skullSplitterCheck(attacker, pluginx);
|
||||
Axes.skullSplitterCheck(attacker, pluginx);
|
||||
if(PPa.getSwordsPreparationMode())
|
||||
Skills.serratedStrikesActivationCheck(attacker, pluginx);
|
||||
Swords.serratedStrikesActivationCheck(attacker, pluginx);
|
||||
if(PPa.getFistsPreparationMode())
|
||||
Skills.berserkActivationCheck(attacker, pluginx);
|
||||
Unarmed.berserkActivationCheck(attacker, pluginx);
|
||||
}
|
||||
public static void archeryCheck(EntityDamageByProjectileEvent event){
|
||||
Entity y = event.getDamager();
|
||||
|
@ -46,6 +46,19 @@ public class Database {
|
||||
"`party` varchar(100) NOT NULL DEFAULT ''," +
|
||||
"PRIMARY KEY (`id`)," +
|
||||
"UNIQUE KEY `user` (`user`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
|
||||
Write("CREATE TABLE IF NOT EXISTS `"+LoadProperties.MySQLtablePrefix+"cooldowns` (`user_id` int(10) unsigned NOT NULL," +
|
||||
"`taming` int(32) unsigned NOT NULL DEFAULT '0'," +
|
||||
"`mining` int(32) unsigned NOT NULL DEFAULT '0'," +
|
||||
"`woodcutting` int(32) unsigned NOT NULL DEFAULT '0'," +
|
||||
"`repair` int(32) unsigned NOT NULL DEFAULT '0'," +
|
||||
"`unarmed` int(32) unsigned NOT NULL DEFAULT '0'," +
|
||||
"`herbalism` int(32) unsigned NOT NULL DEFAULT '0'," +
|
||||
"`excavation` int(32) unsigned NOT NULL DEFAULT '0'," +
|
||||
"`archery` int(32) unsigned NOT NULL DEFAULT '0'," +
|
||||
"`swords` int(32) unsigned NOT NULL DEFAULT '0'," +
|
||||
"`axes` int(32) unsigned NOT NULL DEFAULT '0'," +
|
||||
"`acrobatics` int(32) unsigned NOT NULL DEFAULT '0'," +
|
||||
"PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
Write("CREATE TABLE IF NOT EXISTS `"+LoadProperties.MySQLtablePrefix+"skills` (`user_id` int(10) unsigned NOT NULL," +
|
||||
"`taming` int(10) unsigned NOT NULL DEFAULT '0'," +
|
||||
"`mining` int(10) unsigned NOT NULL DEFAULT '0'," +
|
||||
|
@ -73,7 +73,9 @@ public class Users {
|
||||
{
|
||||
players.clear();
|
||||
}
|
||||
|
||||
public static HashMap<Player, PlayerProfile> getProfiles(){
|
||||
return players;
|
||||
}
|
||||
|
||||
public static void removeUser(Player player){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
@ -4,11 +4,13 @@ import java.util.*;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Config {
|
||||
private static volatile Config instance;
|
||||
String location = "mcmmo.properties";
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
public static ArrayList<Player> removalQue = new ArrayList<Player>();
|
||||
static ArrayList<String> adminChatList = new ArrayList<String>();
|
||||
static ArrayList<Block> blockWatchList = new ArrayList<Block>();
|
||||
static ArrayList<Block> treeFeller = new ArrayList<Block>();
|
||||
|
@ -27,7 +27,7 @@ public class PlayerProfile
|
||||
protected final Logger log = Logger.getLogger("Minecraft");
|
||||
private String taming="0", tamingXP="0", miningXP="0", woodCuttingXP="0", woodcutting="0", repair="0", mining="0", party, myspawn, myspawnworld, unarmed="0", herbalism="0", excavation="0",
|
||||
archery="0", swords="0", axes="0", invite, acrobatics="0", repairXP="0", unarmedXP="0", herbalismXP="0", excavationXP="0", archeryXP="0", swordsXP="0", axesXP="0", acrobaticsXP="0";
|
||||
private boolean greenTerraMode, partyChatOnly = false, greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true,
|
||||
private boolean online = true, greenTerraMode, partyChatOnly = false, greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true,
|
||||
superBreakerInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode,
|
||||
serratedStrikesMode, hoePreparationMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode, pickaxePreparationMode, axePreparationMode, skullSplitterMode, berserkMode;
|
||||
private long gigaDrillBreakerCooldown = 0, berserkCooldown = 0, superBreakerCooldown = 0, skullSplitterCooldown = 0, serratedStrikesCooldown = 0,
|
||||
@ -57,6 +57,12 @@ public class PlayerProfile
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getOnline(){
|
||||
return online;
|
||||
}
|
||||
public void setOnline(Boolean bool){
|
||||
online = bool;
|
||||
}
|
||||
public int getMySQLuserId(){
|
||||
return userid;
|
||||
}
|
||||
@ -75,6 +81,25 @@ public class PlayerProfile
|
||||
HashMap<Integer, ArrayList<String>> spawn = mcMMO.database.Read("SELECT world, x, y, z FROM "+LoadProperties.MySQLtablePrefix+"spawn WHERE user_id = " + id);
|
||||
myspawnworld = spawn.get(1).get(0);
|
||||
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);
|
||||
/*
|
||||
* I'm still learning MySQL, this is a fix for adding a new table
|
||||
* its not pretty but it works
|
||||
*/
|
||||
if(cooldowns.get(1) == null)
|
||||
{
|
||||
mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"cooldowns (user_id) VALUES ("+id+")");
|
||||
}
|
||||
else
|
||||
{
|
||||
superBreakerDATS = Long.valueOf(cooldowns.get(1).get(0)) * 1000;
|
||||
treeFellerDATS = Long.valueOf(cooldowns.get(1).get(1)) * 1000;
|
||||
berserkDATS = Long.valueOf(cooldowns.get(1).get(2)) * 1000;
|
||||
greenTerraDATS = Long.valueOf(cooldowns.get(1).get(3)) * 1000;
|
||||
gigaDrillBreakerDATS = Long.valueOf(cooldowns.get(1).get(4)) * 1000;
|
||||
serratedStrikesDATS = Long.valueOf(cooldowns.get(1).get(5)) * 1000;
|
||||
skullSplitterDATS = Long.valueOf(cooldowns.get(1).get(6)) * 1000;
|
||||
}
|
||||
HashMap<Integer, ArrayList<String>> skills = mcMMO.database.Read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics FROM "+LoadProperties.MySQLtablePrefix+"skills WHERE user_id = " + id);
|
||||
taming = skills.get(1).get(0);
|
||||
mining = skills.get(1).get(1);
|
||||
@ -109,6 +134,7 @@ public class PlayerProfile
|
||||
Integer id = 0;
|
||||
mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"users (user, lastlogin) VALUES ('" + p.getName() + "'," + System.currentTimeMillis() / 1000 +")");
|
||||
id = mcMMO.database.GetInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + p.getName() + "'");
|
||||
mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"cooldowns (user_id) VALUES ("+id+")");
|
||||
mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"spawn (user_id) VALUES ("+id+")");
|
||||
mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"skills (user_id) VALUES ("+id+")");
|
||||
mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"experience (user_id) VALUES ("+id+")");
|
||||
@ -183,6 +209,22 @@ public class PlayerProfile
|
||||
taming = character[24];
|
||||
if(character.length > 25)
|
||||
tamingXP = character[25];
|
||||
//Need to store the DATS of abilities nao
|
||||
//Berserk, Gigadrillbreaker, Tree Feller, Green Terra, Serrated Strikes, Skull Splitter, Super Breaker
|
||||
if(character.length > 26)
|
||||
berserkDATS = Long.valueOf(character[26]) * 1000;
|
||||
if(character.length > 27)
|
||||
gigaDrillBreakerDATS = Long.valueOf(character[27]) * 1000;
|
||||
if(character.length > 28)
|
||||
treeFellerDATS = Long.valueOf(character[28]) * 1000;
|
||||
if(character.length > 29)
|
||||
greenTerraDATS = Long.valueOf(character[29]) * 1000;
|
||||
if(character.length > 30)
|
||||
serratedStrikesDATS = Long.valueOf(character[30]) * 1000;
|
||||
if(character.length > 31)
|
||||
skullSplitterDATS = Long.valueOf(character[31]) * 1000;
|
||||
if(character.length > 32)
|
||||
superBreakerDATS = Long.valueOf(character[32]) * 1000;
|
||||
in.close();
|
||||
return true;
|
||||
}
|
||||
@ -202,6 +244,15 @@ public class PlayerProfile
|
||||
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET lastlogin = " + timestamp.intValue() + " WHERE id = " + this.userid);
|
||||
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET party = '"+this.party+"' WHERE id = " +this.userid);
|
||||
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"spawn SET world = '" + this.myspawnworld + "', x = " +getX()+", y = "+getY()+", z = "+getZ()+" WHERE user_id = "+this.userid);
|
||||
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"cooldowns SET "
|
||||
+" mining = "+(superBreakerDATS/1000)
|
||||
+", woodcutting = "+(treeFellerDATS/1000)
|
||||
+", unarmed = "+(berserkDATS/1000)
|
||||
+", herbalism = "+(greenTerraDATS/1000)
|
||||
+", excavation = "+(gigaDrillBreakerDATS/1000)
|
||||
+", swords = " +(serratedStrikesDATS/1000)
|
||||
+", axes = "+(skullSplitterDATS/1000)
|
||||
+" WHERE user_id = "+this.userid);
|
||||
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"skills SET "
|
||||
+" taming = "+taming
|
||||
+", mining = "+mining
|
||||
@ -275,6 +326,15 @@ public class PlayerProfile
|
||||
writer.append(myspawnworld+":");
|
||||
writer.append(taming+":");
|
||||
writer.append(tamingXP+":");
|
||||
//Need to store the DATS of abilities nao
|
||||
//Berserk, Gigadrillbreaker, Tree Feller, Green Terra, Serrated Strikes, Skull Splitter, Super Breaker
|
||||
writer.append(String.valueOf(berserkDATS/1000)+":");
|
||||
writer.append(String.valueOf(gigaDrillBreakerDATS/1000)+":");
|
||||
writer.append(String.valueOf(treeFellerDATS/1000)+":");
|
||||
writer.append(String.valueOf(greenTerraDATS/1000)+":");
|
||||
writer.append(String.valueOf(serratedStrikesDATS/1000)+":");
|
||||
writer.append(String.valueOf(skullSplitterDATS/1000)+":");
|
||||
writer.append(String.valueOf(superBreakerDATS/1000)+":");
|
||||
writer.append("\r\n");
|
||||
}
|
||||
}
|
||||
@ -322,6 +382,14 @@ public class PlayerProfile
|
||||
out.append("");
|
||||
out.append(0+":"); //taming
|
||||
out.append(0+":"); //tamingXP
|
||||
out.append(0+":"); //DATS
|
||||
out.append(0+":"); //DATS
|
||||
out.append(0+":"); //DATS
|
||||
out.append(0+":"); //DATS
|
||||
out.append(0+":"); //DATS
|
||||
out.append(0+":"); //DATS
|
||||
out.append(0+":"); //DATS
|
||||
|
||||
//Add more in the same format as the line above
|
||||
|
||||
out.newLine();
|
||||
@ -498,6 +566,7 @@ public class PlayerProfile
|
||||
public long getGreenTerraDeactivatedTimeStamp() {return greenTerraDATS;}
|
||||
public void setGreenTerraDeactivatedTimeStamp(Long newvalue){
|
||||
greenTerraDATS = newvalue;
|
||||
save();
|
||||
}
|
||||
public void setGreenTerraCooldown(Long newvalue){
|
||||
greenTerraCooldown = newvalue;
|
||||
@ -527,6 +596,7 @@ public class PlayerProfile
|
||||
public long getBerserkDeactivatedTimeStamp() {return berserkDATS;}
|
||||
public void setBerserkDeactivatedTimeStamp(Long newvalue){
|
||||
berserkDATS = newvalue;
|
||||
save();
|
||||
}
|
||||
public void setBerserkCooldown(Long newvalue){
|
||||
berserkCooldown = newvalue;
|
||||
@ -556,6 +626,7 @@ public class PlayerProfile
|
||||
public long getSkullSplitterDeactivatedTimeStamp() {return skullSplitterDATS;}
|
||||
public void setSkullSplitterDeactivatedTimeStamp(Long newvalue){
|
||||
skullSplitterDATS = newvalue;
|
||||
save();
|
||||
}
|
||||
public void setSkullSplitterCooldown(Long newvalue){
|
||||
skullSplitterCooldown = newvalue;
|
||||
@ -585,6 +656,7 @@ public class PlayerProfile
|
||||
public long getSerratedStrikesDeactivatedTimeStamp() {return serratedStrikesDATS;}
|
||||
public void setSerratedStrikesDeactivatedTimeStamp(Long newvalue){
|
||||
serratedStrikesDATS = newvalue;
|
||||
save();
|
||||
}
|
||||
public void setSerratedStrikesCooldown(Long newvalue){
|
||||
serratedStrikesCooldown = newvalue;
|
||||
@ -614,6 +686,7 @@ public class PlayerProfile
|
||||
public long getGigaDrillBreakerDeactivatedTimeStamp() {return gigaDrillBreakerDATS;}
|
||||
public void setGigaDrillBreakerDeactivatedTimeStamp(Long newvalue){
|
||||
gigaDrillBreakerDATS = newvalue;
|
||||
save();
|
||||
}
|
||||
public void setGigaDrillBreakerCooldown(Long newvalue){
|
||||
gigaDrillBreakerCooldown = newvalue;
|
||||
@ -643,6 +716,7 @@ public class PlayerProfile
|
||||
public long getTreeFellerDeactivatedTimeStamp() {return treeFellerDATS;}
|
||||
public void setTreeFellerDeactivatedTimeStamp(Long newvalue){
|
||||
treeFellerDATS = newvalue;
|
||||
save();
|
||||
}
|
||||
public void setTreeFellerCooldown(Long newvalue){
|
||||
treeFellerCooldown = newvalue;
|
||||
@ -672,6 +746,7 @@ public class PlayerProfile
|
||||
public long getSuperBreakerDeactivatedTimeStamp() {return superBreakerDATS;}
|
||||
public void setSuperBreakerDeactivatedTimeStamp(Long newvalue){
|
||||
superBreakerDATS = newvalue;
|
||||
save();
|
||||
}
|
||||
public void setSuperBreakerCooldown(Long newvalue){
|
||||
superBreakerCooldown = newvalue;
|
||||
|
@ -897,7 +897,6 @@ public class m {
|
||||
if(split[0].equalsIgnoreCase("/"+LoadProperties.mcc)){
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.YELLOW+"mcMMO Commands"+ChatColor.RED+"[]---");
|
||||
player.sendMessage("/"+LoadProperties.stats+ChatColor.RED+" - View your mcMMO stats");
|
||||
if(mcPermissions.getInstance().party(player)){
|
||||
player.sendMessage(ChatColor.GREEN+"--PARTY COMMANDS--");
|
||||
player.sendMessage("/"+LoadProperties.party+" [party name] "+ChatColor.RED+"- Create/Join designated party");
|
||||
@ -909,13 +908,13 @@ public class m {
|
||||
if(mcPermissions.getInstance().partyTeleport(player))
|
||||
player.sendMessage("/"+LoadProperties.ptp+" [party member name] "+ChatColor.RED+"- Teleport to party member");
|
||||
}
|
||||
player.sendMessage(ChatColor.GREEN+"--OTHER COMMANDS--");
|
||||
player.sendMessage("/"+LoadProperties.stats+ChatColor.RED+" - View your mcMMO stats");
|
||||
player.sendMessage("/mctop <skillname> <page> "+ChatColor.RED+"- Leaderboards");
|
||||
if(mcPermissions.getInstance().mySpawn(player)){
|
||||
player.sendMessage(ChatColor.GREEN+"--MYSPAWN COMMANDS--");
|
||||
player.sendMessage("/"+LoadProperties.myspawn+" "+ChatColor.RED+"- Clears inventory & teleports to myspawn");
|
||||
player.sendMessage("/"+LoadProperties.clearmyspawn+" "+ChatColor.RED+"- Clears your MySpawn");
|
||||
}
|
||||
player.sendMessage(ChatColor.GREEN+"--OTHER COMMANDS--");
|
||||
player.sendMessage("/mctop <skillname> <page> "+ChatColor.RED+"- Leaderboards");
|
||||
if(mcPermissions.getInstance().mcAbility(player))
|
||||
player.sendMessage("/"+LoadProperties.mcability+ChatColor.RED+" - Toggle ability activation with right click");
|
||||
if(mcPermissions.getInstance().adminChat(player)){
|
||||
|
@ -203,8 +203,9 @@ public class mcBlockListener extends BlockListener {
|
||||
Mining.superBreakerCheck(player, block, plugin);
|
||||
if(PP.getShovelPreparationMode() && Excavation.canBeGigaDrillBroken(block))
|
||||
Excavation.gigaDrillBreakerActivationCheck(player, block, plugin);
|
||||
if(PP.getFistsPreparationMode() && Excavation.canBeGigaDrillBroken(block))
|
||||
Skills.berserkActivationCheck(player, plugin);
|
||||
if(PP.getFistsPreparationMode() && (Excavation.canBeGigaDrillBroken(block) || block.getTypeId() == 78))
|
||||
Unarmed.berserkActivationCheck(player, plugin);
|
||||
|
||||
/*
|
||||
* GREEN TERRA STUFF
|
||||
*/
|
||||
@ -242,10 +243,12 @@ public class mcBlockListener extends BlockListener {
|
||||
if(PP.getBerserkMode()
|
||||
&& m.blockBreakSimulate(block, player, plugin)
|
||||
&& player.getItemInHand().getTypeId() == 0
|
||||
&& Excavation.canBeGigaDrillBroken(block)){
|
||||
&& (Excavation.canBeGigaDrillBroken(block) || block.getTypeId() == 78)){
|
||||
Material mat = Material.getMaterial(block.getTypeId());
|
||||
if(block.getTypeId() == 2)
|
||||
mat = Material.DIRT;
|
||||
if(block.getTypeId() == 78)
|
||||
mat = Material.SNOW_BALL;
|
||||
byte type = block.getData();
|
||||
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
|
||||
block.setType(Material.AIR);
|
||||
|
@ -77,10 +77,13 @@ public class mcPlayerListener extends PlayerListener {
|
||||
return null;
|
||||
}
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
if(Users.getProfile(event.getPlayer()) != null){
|
||||
Users.getProfile(event.getPlayer()).setOnline(true);
|
||||
}
|
||||
Users.addUser(event.getPlayer());
|
||||
}
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
Users.removeUser(event.getPlayer());
|
||||
Users.getProfile(event.getPlayer()).setOnline(false);
|
||||
}
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
@ -12,13 +12,53 @@ import org.bukkit.plugin.Plugin;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public class Axes {
|
||||
public static void skullSplitterCheck(Player player, Plugin pluginx){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(m.isAxes(player.getItemInHand()) && mcPermissions.getInstance().axesAbility(player)){
|
||||
/*
|
||||
* CHECK FOR AXE PREP MODE
|
||||
*/
|
||||
if(PP.getAxePreparationMode()){
|
||||
PP.setAxePreparationMode(false);
|
||||
}
|
||||
int ticks = 2;
|
||||
int x = PP.getAxesInt();
|
||||
while(x >= 50){
|
||||
x-=50;
|
||||
ticks++;
|
||||
}
|
||||
|
||||
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event){
|
||||
if(!PP.getSkullSplitterMode() && Skills.cooldownOver(player, PP.getSkullSplitterDeactivatedTimeStamp(), LoadProperties.skullSplitterCooldown)){
|
||||
player.sendMessage(ChatColor.GREEN+"**SKULL SPLITTER ACTIVATED**");
|
||||
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
||||
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Skull Splitter!");
|
||||
}
|
||||
PP.setSkullSplitterTicks(ticks * 1000);
|
||||
PP.setSkullSplitterActivatedTimeStamp(System.currentTimeMillis());
|
||||
PP.setSkullSplitterDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
|
||||
PP.setSkullSplitterMode(true);
|
||||
}
|
||||
if(!PP.getSkullSplitterMode() && !Skills.cooldownOver(player, PP.getSkullSplitterDeactivatedTimeStamp(), LoadProperties.skullSplitterCooldown)){
|
||||
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
|
||||
+ChatColor.YELLOW+" ("+Skills.calculateTimeLeft(player, PP.getSkullSplitterDeactivatedTimeStamp(), LoadProperties.skullSplitterCooldown)+"s)");
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx){
|
||||
Entity x = event.getEntity();
|
||||
if(x instanceof Wolf){
|
||||
Wolf wolf = (Wolf)x;
|
||||
if(Taming.getOwner(wolf, pluginx) == attacker)
|
||||
return;
|
||||
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(wolf, pluginx)))
|
||||
return;
|
||||
}
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
||||
if(PPa.getAxesInt() >= 750){
|
||||
|
@ -45,6 +45,7 @@ public class Excavation {
|
||||
}
|
||||
PP.setGigaDrillBreakerTicks(ticks * 1000);
|
||||
PP.setGigaDrillBreakerActivatedTimeStamp(System.currentTimeMillis());
|
||||
PP.setGigaDrillBreakerDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
|
||||
PP.setGigaDrillBreakerMode(true);
|
||||
}
|
||||
|
||||
|
@ -109,6 +109,7 @@ public class Herbalism {
|
||||
}
|
||||
PP.setGreenTerraTicks(ticks * 1000);
|
||||
PP.setGreenTerraActivatedTimeStamp(System.currentTimeMillis());
|
||||
PP.setGreenTerraDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
|
||||
PP.setGreenTerraMode(true);
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@ public class Mining {
|
||||
}
|
||||
PP.setSuperBreakerTicks(ticks * 1000);
|
||||
PP.setSuperBreakerActivatedTimeStamp(System.currentTimeMillis());
|
||||
PP.setSuperBreakerDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
|
||||
PP.setSuperBreakerMode(true);
|
||||
}
|
||||
|
||||
|
@ -60,21 +60,37 @@ public class Skills {
|
||||
}
|
||||
return x;
|
||||
}
|
||||
public static boolean isAllCooldownsOver(PlayerProfile PP)
|
||||
{
|
||||
long t = System.currentTimeMillis();
|
||||
if(t - PP.getGreenTerraDeactivatedTimeStamp() >= (LoadProperties.greenTerraCooldown * 1000) &&
|
||||
t - PP.getTreeFellerDeactivatedTimeStamp() >= (LoadProperties.treeFellerCooldown * 1000) &&
|
||||
t - PP.getSuperBreakerDeactivatedTimeStamp() >= (LoadProperties.superBreakerCooldown * 1000) &&
|
||||
t - PP.getSerratedStrikesDeactivatedTimeStamp() >= (LoadProperties.serratedStrikeCooldown * 1000) &&
|
||||
t - PP.getBerserkDeactivatedTimeStamp() >= (LoadProperties.berserkCooldown * 1000) &&
|
||||
t - PP.getSkullSplitterDeactivatedTimeStamp() >= (LoadProperties.skullSplitterCooldown * 1000) &&
|
||||
t - PP.getGigaDrillBreakerDeactivatedTimeStamp() >= (LoadProperties.gigaDrillBreakerCooldown * 1000))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
public static void watchCooldowns(Player player){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(!PP.getGreenTerraInformed() && System.currentTimeMillis() - PP.getGreenTerraDeactivatedTimeStamp() >= (LoadProperties.greenTerraCooldown * 1000)){
|
||||
PP.setGreenTerraInformed(true);
|
||||
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Green Terra "+ChatColor.GREEN+"ability is refreshed!");
|
||||
}
|
||||
if(!PP.getTreeFellerInformed() && System.currentTimeMillis() - PP.getTreeFellerDeactivatedTimeStamp() >= (LoadProperties.berserkCooldown * 1000)){
|
||||
if(!PP.getTreeFellerInformed() && System.currentTimeMillis() - PP.getTreeFellerDeactivatedTimeStamp() >= (LoadProperties.greenTerraCooldown * 1000)){
|
||||
PP.setTreeFellerInformed(true);
|
||||
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Tree Feller "+ChatColor.GREEN+"ability is refreshed!");
|
||||
}
|
||||
if(!PP.getSuperBreakerInformed() && System.currentTimeMillis() - PP.getSuperBreakerDeactivatedTimeStamp() >= (LoadProperties.berserkCooldown * 1000)){
|
||||
if(!PP.getSuperBreakerInformed() && System.currentTimeMillis() - PP.getSuperBreakerDeactivatedTimeStamp() >= (LoadProperties.superBreakerCooldown * 1000)){
|
||||
PP.setSuperBreakerInformed(true);
|
||||
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Super Breaker "+ChatColor.GREEN+"ability is refreshed!");
|
||||
}
|
||||
if(!PP.getSerratedStrikesInformed() && System.currentTimeMillis() - PP.getSerratedStrikesDeactivatedTimeStamp() >= (LoadProperties.berserkCooldown * 1000)){
|
||||
if(!PP.getSerratedStrikesInformed() && System.currentTimeMillis() - PP.getSerratedStrikesDeactivatedTimeStamp() >= (LoadProperties.serratedStrikeCooldown * 1000)){
|
||||
PP.setSerratedStrikesInformed(true);
|
||||
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Serrated Strikes "+ChatColor.GREEN+"ability is refreshed!");
|
||||
}
|
||||
@ -82,11 +98,11 @@ public class Skills {
|
||||
PP.setBerserkInformed(true);
|
||||
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Berserk "+ChatColor.GREEN+"ability is refreshed!");
|
||||
}
|
||||
if(!PP.getSkullSplitterInformed() && System.currentTimeMillis() - PP.getSkullSplitterDeactivatedTimeStamp() >= (LoadProperties.berserkCooldown * 1000)){
|
||||
if(!PP.getSkullSplitterInformed() && System.currentTimeMillis() - PP.getSkullSplitterDeactivatedTimeStamp() >= (LoadProperties.skullSplitterCooldown * 1000)){
|
||||
PP.setSkullSplitterInformed(true);
|
||||
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Skull Splitter "+ChatColor.GREEN+"ability is refreshed!");
|
||||
}
|
||||
if(!PP.getGigaDrillBreakerInformed() && System.currentTimeMillis() - PP.getGigaDrillBreakerDeactivatedTimeStamp() >= (LoadProperties.berserkCooldown * 1000)){
|
||||
if(!PP.getGigaDrillBreakerInformed() && System.currentTimeMillis() - PP.getGigaDrillBreakerDeactivatedTimeStamp() >= (LoadProperties.gigaDrillBreakerCooldown * 1000)){
|
||||
PP.setGigaDrillBreakerInformed(true);
|
||||
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Giga Drill Breaker "+ChatColor.GREEN+"ability is refreshed!");
|
||||
}
|
||||
@ -104,7 +120,106 @@ public class Skills {
|
||||
PP.setHoePreparationMode(true);
|
||||
}
|
||||
}
|
||||
public static void abilityActivationCheck(Player player){
|
||||
public static void monitorSkills(Player player){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(PP == null)
|
||||
Users.addUser(player);
|
||||
if(PP.getHoePreparationMode() && System.currentTimeMillis() - PP.getHoePreparationATS() >= 4000){
|
||||
PP.setHoePreparationMode(false);
|
||||
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR HOE**");
|
||||
}
|
||||
if(PP.getAxePreparationMode() && System.currentTimeMillis() - PP.getAxePreparationATS() >= 4000){
|
||||
PP.setAxePreparationMode(false);
|
||||
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR AXE**");
|
||||
}
|
||||
if(PP.getPickaxePreparationMode() && System.currentTimeMillis() - PP.getPickaxePreparationATS() >= 4000){
|
||||
PP.setPickaxePreparationMode(false);
|
||||
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR PICKAXE**");
|
||||
}
|
||||
if(PP.getSwordsPreparationMode() && System.currentTimeMillis() - PP.getSwordsPreparationATS() >= 4000){
|
||||
PP.setSwordsPreparationMode(false);
|
||||
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SWORD**");
|
||||
}
|
||||
if(PP.getFistsPreparationMode() && System.currentTimeMillis() - PP.getFistsPreparationATS() >= 4000){
|
||||
PP.setFistsPreparationMode(false);
|
||||
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR FISTS**");
|
||||
}
|
||||
if(PP.getShovelPreparationMode() && System.currentTimeMillis() - PP.getShovelPreparationATS() >= 4000){
|
||||
PP.setShovelPreparationMode(false);
|
||||
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SHOVEL**");
|
||||
}
|
||||
/*
|
||||
* HERBALISM ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().herbalismAbility(player)){
|
||||
if(PP.getGreenTerraMode() && PP.getGreenTerraActivatedTimeStamp() + PP.getGreenTerraTicks() <= System.currentTimeMillis()){
|
||||
PP.setGreenTerraMode(false);
|
||||
PP.setGreenTerraInformed(false);
|
||||
player.sendMessage(ChatColor.RED+"**Green Terra has worn off**");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* AXES ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().axesAbility(player)){
|
||||
if(PP.getSkullSplitterMode() && PP.getSkullSplitterActivatedTimeStamp() + PP.getSkullSplitterTicks() <= System.currentTimeMillis()){
|
||||
PP.setSkullSplitterMode(false);
|
||||
PP.setSkullSplitterInformed(false);
|
||||
player.sendMessage(ChatColor.RED+"**Skull Splitter has worn off**");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* WOODCUTTING ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().woodCuttingAbility(player)){
|
||||
if(PP.getTreeFellerMode() && PP.getTreeFellerActivatedTimeStamp() + PP.getTreeFellerTicks() <= System.currentTimeMillis()){
|
||||
PP.setTreeFellerMode(false);
|
||||
PP.setTreeFellerInformed(false);
|
||||
player.sendMessage(ChatColor.RED+"**Tree Feller has worn off**");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* MINING ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().miningAbility(player)){
|
||||
if(PP.getSuperBreakerMode() && PP.getSuperBreakerActivatedTimeStamp() + PP.getSuperBreakerTicks() <= System.currentTimeMillis()){
|
||||
PP.setSuperBreakerMode(false);
|
||||
PP.setSuperBreakerInformed(false);
|
||||
player.sendMessage(ChatColor.RED+"**Super Breaker has worn off**");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* EXCAVATION ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().excavationAbility(player)){
|
||||
if(PP.getGigaDrillBreakerMode() && PP.getGigaDrillBreakerActivatedTimeStamp() + PP.getGigaDrillBreakerTicks() <= System.currentTimeMillis()){
|
||||
PP.setGigaDrillBreakerMode(false);
|
||||
PP.setGigaDrillBreakerInformed(false);
|
||||
player.sendMessage(ChatColor.RED+"**Giga Drill Breaker has worn off**");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* SWORDS ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().swordsAbility(player)){
|
||||
if(PP.getSerratedStrikesMode() && PP.getSerratedStrikesActivatedTimeStamp() + PP.getSerratedStrikesTicks() <= System.currentTimeMillis()){
|
||||
PP.setSerratedStrikesMode(false);
|
||||
PP.setSerratedStrikesInformed(false);
|
||||
player.sendMessage(ChatColor.RED+"**Serrated Strikes has worn off**");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* UNARMED ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().unarmedAbility(player)){
|
||||
if(PP.getBerserkMode() && PP.getBerserkActivatedTimeStamp() + PP.getBerserkTicks() <= System.currentTimeMillis()){
|
||||
PP.setBerserkMode(false);
|
||||
PP.setBerserkInformed(false);
|
||||
player.sendMessage(ChatColor.RED+"**Berserk has worn off**");
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void abilityActivationCheck(Player player){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(!PP.getAbilityUse())
|
||||
return;
|
||||
@ -156,195 +271,6 @@ public class Skills {
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void serratedStrikesActivationCheck(Player player, Plugin pluginx){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(m.isSwords(player.getItemInHand())){
|
||||
if(PP.getSwordsPreparationMode()){
|
||||
PP.setSwordsPreparationMode(false);
|
||||
}
|
||||
int ticks = 2;
|
||||
int x = PP.getSwordsInt();
|
||||
while(x >= 50){
|
||||
x-=50;
|
||||
ticks++;
|
||||
}
|
||||
|
||||
if(!PP.getSerratedStrikesMode() && PP.getSerratedStrikesCooldown() == 0){
|
||||
player.sendMessage(ChatColor.GREEN+"**SERRATED STRIKES ACTIVATED**");
|
||||
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
||||
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Serrated Strikes!");
|
||||
}
|
||||
PP.setSerratedStrikesTicks((ticks * 2) * 1000);
|
||||
PP.setSerratedStrikesActivatedTimeStamp(System.currentTimeMillis());
|
||||
PP.setSerratedStrikesMode(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public static void berserkActivationCheck(Player player, Plugin pluginx){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(player.getItemInHand().getTypeId() == 0){
|
||||
if(PP.getFistsPreparationMode()){
|
||||
PP.setFistsPreparationMode(false);
|
||||
}
|
||||
int ticks = 2;
|
||||
int x = PP.getUnarmedInt();
|
||||
while(x >= 50){
|
||||
x-=50;
|
||||
ticks++;
|
||||
}
|
||||
|
||||
if(!PP.getBerserkMode() && cooldownOver(player, PP.getBerserkDeactivatedTimeStamp(), LoadProperties.berserkCooldown)){
|
||||
player.sendMessage(ChatColor.GREEN+"**BERSERK ACTIVATED**");
|
||||
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
||||
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Berserk!");
|
||||
}
|
||||
PP.setBerserkTicks(ticks * 1000);
|
||||
PP.setBerserkActivatedTimeStamp(System.currentTimeMillis());
|
||||
PP.setBerserkMode(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void skullSplitterCheck(Player player, Plugin pluginx){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(m.isAxes(player.getItemInHand()) && mcPermissions.getInstance().axesAbility(player)){
|
||||
/*
|
||||
* CHECK FOR AXE PREP MODE
|
||||
*/
|
||||
if(PP.getAxePreparationMode()){
|
||||
PP.setAxePreparationMode(false);
|
||||
}
|
||||
int ticks = 2;
|
||||
int x = PP.getAxesInt();
|
||||
while(x >= 50){
|
||||
x-=50;
|
||||
ticks++;
|
||||
}
|
||||
|
||||
if(!PP.getSkullSplitterMode() && cooldownOver(player, PP.getSkullSplitterDeactivatedTimeStamp(), LoadProperties.skullSplitterCooldown)){
|
||||
player.sendMessage(ChatColor.GREEN+"**SKULL SPLITTER ACTIVATED**");
|
||||
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
||||
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Skull Splitter!");
|
||||
}
|
||||
PP.setSkullSplitterTicks(ticks * 1000);
|
||||
PP.setSkullSplitterActivatedTimeStamp(System.currentTimeMillis());
|
||||
PP.setSkullSplitterMode(true);
|
||||
}
|
||||
if(!PP.getSkullSplitterMode() && !cooldownOver(player, PP.getSkullSplitterDeactivatedTimeStamp(), LoadProperties.skullSplitterCooldown)){
|
||||
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
|
||||
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSkullSplitterDeactivatedTimeStamp(), LoadProperties.skullSplitterCooldown)+"s)");
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void monitorSkills(Player player){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(PP == null)
|
||||
Users.addUser(player);
|
||||
if(PP.getHoePreparationMode() && System.currentTimeMillis() - PP.getHoePreparationATS() >= 4000){
|
||||
PP.setHoePreparationMode(false);
|
||||
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR HOE**");
|
||||
}
|
||||
if(PP.getAxePreparationMode() && System.currentTimeMillis() - PP.getAxePreparationATS() >= 4000){
|
||||
PP.setAxePreparationMode(false);
|
||||
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR AXE**");
|
||||
}
|
||||
if(PP.getPickaxePreparationMode() && System.currentTimeMillis() - PP.getPickaxePreparationATS() >= 4000){
|
||||
PP.setPickaxePreparationMode(false);
|
||||
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR PICKAXE**");
|
||||
}
|
||||
if(PP.getSwordsPreparationMode() && System.currentTimeMillis() - PP.getSwordsPreparationATS() >= 4000){
|
||||
PP.setSwordsPreparationMode(false);
|
||||
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SWORD**");
|
||||
}
|
||||
if(PP.getFistsPreparationMode() && System.currentTimeMillis() - PP.getFistsPreparationATS() >= 4000){
|
||||
PP.setFistsPreparationMode(false);
|
||||
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR FISTS**");
|
||||
}
|
||||
if(PP.getShovelPreparationMode() && System.currentTimeMillis() - PP.getShovelPreparationATS() >= 4000){
|
||||
PP.setShovelPreparationMode(false);
|
||||
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SHOVEL**");
|
||||
}
|
||||
/*
|
||||
* HERBALISM ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().herbalismAbility(player)){
|
||||
if(PP.getGreenTerraMode() && PP.getGreenTerraActivatedTimeStamp() + PP.getGreenTerraTicks() <= System.currentTimeMillis()){
|
||||
PP.setGreenTerraMode(false);
|
||||
PP.setGreenTerraInformed(false);
|
||||
player.sendMessage(ChatColor.RED+"**Green Terra has worn off**");
|
||||
PP.setGreenTerraDeactivatedTimeStamp(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* AXES ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().axesAbility(player)){
|
||||
if(PP.getSkullSplitterMode() && PP.getSkullSplitterActivatedTimeStamp() + PP.getSkullSplitterTicks() <= System.currentTimeMillis()){
|
||||
PP.setSkullSplitterMode(false);
|
||||
PP.setSkullSplitterInformed(false);
|
||||
player.sendMessage(ChatColor.RED+"**Skull Splitter has worn off**");
|
||||
PP.setSkullSplitterDeactivatedTimeStamp(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* WOODCUTTING ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().woodCuttingAbility(player)){
|
||||
if(PP.getTreeFellerMode() && PP.getTreeFellerActivatedTimeStamp() + PP.getTreeFellerTicks() <= System.currentTimeMillis()){
|
||||
PP.setTreeFellerMode(false);
|
||||
PP.setTreeFellerInformed(false);
|
||||
player.sendMessage(ChatColor.RED+"**Tree Feller has worn off**");
|
||||
PP.setTreeFellerDeactivatedTimeStamp(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* MINING ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().miningAbility(player)){
|
||||
if(PP.getSuperBreakerMode() && PP.getSuperBreakerActivatedTimeStamp() + PP.getSuperBreakerTicks() <= System.currentTimeMillis()){
|
||||
PP.setSuperBreakerMode(false);
|
||||
PP.setSuperBreakerInformed(false);
|
||||
player.sendMessage(ChatColor.RED+"**Super Breaker has worn off**");
|
||||
PP.setSuperBreakerDeactivatedTimeStamp(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* EXCAVATION ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().excavationAbility(player)){
|
||||
if(PP.getGigaDrillBreakerMode() && PP.getGigaDrillBreakerActivatedTimeStamp() + PP.getGigaDrillBreakerTicks() <= System.currentTimeMillis()){
|
||||
PP.setGigaDrillBreakerMode(false);
|
||||
PP.setGigaDrillBreakerInformed(false);
|
||||
player.sendMessage(ChatColor.RED+"**Giga Drill Breaker has worn off**");
|
||||
PP.setGigaDrillBreakerDeactivatedTimeStamp(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* SWORDS ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().swordsAbility(player)){
|
||||
if(PP.getSerratedStrikesMode() && PP.getSerratedStrikesActivatedTimeStamp() + PP.getSerratedStrikesTicks() <= System.currentTimeMillis()){
|
||||
PP.setSerratedStrikesMode(false);
|
||||
PP.setSerratedStrikesInformed(false);
|
||||
player.sendMessage(ChatColor.RED+"**Serrated Strikes has worn off**");
|
||||
PP.setSerratedStrikesDeactivatedTimeStamp(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* UNARMED ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().unarmedAbility(player)){
|
||||
if(PP.getBerserkMode() && PP.getBerserkActivatedTimeStamp() + PP.getBerserkTicks() <= System.currentTimeMillis()){
|
||||
PP.setBerserkMode(false);
|
||||
PP.setBerserkInformed(false);
|
||||
player.sendMessage(ChatColor.RED+"**Berserk has worn off**");
|
||||
PP.setBerserkDeactivatedTimeStamp(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void XpCheck(Player player){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
/*
|
||||
|
@ -2,7 +2,6 @@ package com.gmail.nossr50.skills;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Animals;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -17,13 +16,49 @@ import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public class Swords {
|
||||
|
||||
public static void bleedCheck(Player attacker, Entity x){
|
||||
public static void serratedStrikesActivationCheck(Player player, Plugin pluginx){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(m.isSwords(player.getItemInHand())){
|
||||
if(PP.getSwordsPreparationMode()){
|
||||
PP.setSwordsPreparationMode(false);
|
||||
}
|
||||
int ticks = 2;
|
||||
int x = PP.getSwordsInt();
|
||||
while(x >= 50){
|
||||
x-=50;
|
||||
ticks++;
|
||||
}
|
||||
|
||||
if(!PP.getSerratedStrikesMode() && PP.getSerratedStrikesCooldown() == 0){
|
||||
player.sendMessage(ChatColor.GREEN+"**SERRATED STRIKES ACTIVATED**");
|
||||
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
||||
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Serrated Strikes!");
|
||||
}
|
||||
PP.setSerratedStrikesTicks((ticks * 2) * 1000);
|
||||
PP.setSerratedStrikesActivatedTimeStamp(System.currentTimeMillis());
|
||||
PP.setSerratedStrikesDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
|
||||
PP.setSerratedStrikesMode(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void bleedCheck(Player attacker, Entity x, Plugin pluginx){
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
if(x instanceof Wolf){
|
||||
Wolf wolf = (Wolf)x;
|
||||
if(Taming.getOwner(wolf, pluginx) == attacker)
|
||||
return;
|
||||
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(wolf, pluginx)))
|
||||
return;
|
||||
}
|
||||
if(mcPermissions.getInstance().swords(attacker) && m.isSwords(attacker.getItemInHand())){
|
||||
if(PPa.getSwordsInt() >= 750){
|
||||
if(Math.random() * 1000 >= 750){
|
||||
|
@ -5,11 +5,40 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
|
||||
public class Unarmed {
|
||||
public static void berserkActivationCheck(Player player, Plugin pluginx){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(player.getItemInHand().getTypeId() == 0){
|
||||
if(PP.getFistsPreparationMode()){
|
||||
PP.setFistsPreparationMode(false);
|
||||
}
|
||||
int ticks = 2;
|
||||
int x = PP.getUnarmedInt();
|
||||
while(x >= 50){
|
||||
x-=50;
|
||||
ticks++;
|
||||
}
|
||||
|
||||
if(!PP.getBerserkMode() && Skills.cooldownOver(player, PP.getBerserkDeactivatedTimeStamp(), LoadProperties.berserkCooldown)){
|
||||
player.sendMessage(ChatColor.GREEN+"**BERSERK ACTIVATED**");
|
||||
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
||||
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Berserk!");
|
||||
}
|
||||
PP.setBerserkTicks(ticks * 1000);
|
||||
PP.setBerserkActivatedTimeStamp(System.currentTimeMillis());
|
||||
PP.setBerserkDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
|
||||
PP.setBerserkMode(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void unarmedBonus(Player attacker, EntityDamageByEntityEvent event)
|
||||
{
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
|
@ -64,6 +64,7 @@ public class WoodCutting {
|
||||
}
|
||||
PP.setTreeFellerTicks(ticks * 1000);
|
||||
PP.setTreeFellerActivatedTimeStamp(System.currentTimeMillis());
|
||||
PP.setTreeFellerDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
|
||||
PP.setTreeFellerMode(true);
|
||||
}
|
||||
if(!PP.getTreeFellerMode() && !Skills.cooldownOver(player, PP.getTreeFellerDeactivatedTimeStamp(), LoadProperties.treeFellerCooldown)){
|
||||
|
@ -1,3 +1,3 @@
|
||||
name: mcMMO
|
||||
main: com.gmail.nossr50.mcMMO
|
||||
version: 1.0.02
|
||||
version: 1.0.04
|
Loading…
Reference in New Issue
Block a user