mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
The performance of this next update should be quite a step up from previous versions ;)
This commit is contained in:
parent
e621ab67d2
commit
434e7000f2
@ -1,8 +1,14 @@
|
|||||||
Changelog:
|
Changelog:
|
||||||
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
|
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
|
||||||
Version 1.0.51
|
Version 1.0.51
|
||||||
Converted many big numbers to much smaller numbers reducing memory usage
|
Brand new XP Bars and Skill Icons designed by BrandonXP
|
||||||
XP Bars
|
Noises added to leveling
|
||||||
|
MySpawn now works correctly when you are in the nether
|
||||||
|
MySpawn message when you right click a bed is now squelched
|
||||||
|
Intervals at which players renegerate hp have doubled in length
|
||||||
|
Rewrote many variables stored per player to be integer instead of long, reducing overall memory usage of mcMMO
|
||||||
|
Rewrote the Timer mcMMO relies on to instead use the BukkitScheduler for performance
|
||||||
|
Fixed the party member list of /party
|
||||||
|
|
||||||
Version 1.0.50
|
Version 1.0.50
|
||||||
New /xprate command for those with mcmmo.admin permissions!
|
New /xprate command for those with mcmmo.admin permissions!
|
||||||
|
@ -67,13 +67,11 @@ public class Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(PP.getMySpawn(player) != null)
|
if(PP.getMySpawn(player, plugin) != null)
|
||||||
{
|
{
|
||||||
Location mySpawn = PP.getMySpawn(player);
|
Location mySpawn = PP.getMySpawn(player, plugin);
|
||||||
if(mySpawn != null && plugin.getServer().getWorld(PP.getMySpawnWorld(plugin)) != null)
|
|
||||||
mySpawn.setWorld(plugin.getServer().getWorld(PP.getMySpawnWorld(plugin)));
|
|
||||||
if(mySpawn != null){
|
if(mySpawn != null){
|
||||||
player.teleport(mySpawn);//Do it twice to prevent weird stuff
|
player.teleport(mySpawn); //Do it twice to prevent weird stuff
|
||||||
player.teleport(mySpawn);
|
player.teleport(mySpawn);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.contrib;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -26,9 +27,18 @@ public class SpoutStuff
|
|||||||
{
|
{
|
||||||
//Contrib stuff
|
//Contrib stuff
|
||||||
SoundManager SM = SpoutManager.getSoundManager();
|
SoundManager SM = SpoutManager.getSoundManager();
|
||||||
SpoutPlayer sPlayer = (SpoutPlayer)player;
|
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||||
SM.playSoundEffect(sPlayer, effect, location);
|
SM.playSoundEffect(sPlayer, effect, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void playLevelUpNoise(Player player)
|
||||||
|
{
|
||||||
|
SoundManager SM = SpoutManager.getSoundManager();
|
||||||
|
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||||
|
String r = String.valueOf((int) (Math.random()*8));
|
||||||
|
SM.playCustomMusic(Bukkit.getServer().getPluginManager().getPlugin("mcMMO"), sPlayer, "http://dl.dropbox.com/u/18212134/ANUSOUND/"+r+".wav", false);
|
||||||
|
}
|
||||||
|
|
||||||
public static void levelUpNotification(SkillType skillType, SpoutPlayer sPlayer)
|
public static void levelUpNotification(SkillType skillType, SpoutPlayer sPlayer)
|
||||||
{
|
{
|
||||||
PlayerProfile PP = Users.getProfile(sPlayer);
|
PlayerProfile PP = Users.getProfile(sPlayer);
|
||||||
@ -247,6 +257,7 @@ public class SpoutStuff
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sPlayer.sendNotification(ChatColor.GREEN+"Level Up!", ChatColor.YELLOW+m.getCapitalized(skillType.toString())+ChatColor.DARK_AQUA+" ("+ChatColor.GREEN+PP.getSkillLevel(skillType)+ChatColor.DARK_AQUA+")", mat);
|
sPlayer.sendNotification(ChatColor.GREEN+"Level Up!", ChatColor.YELLOW+m.getCapitalized(skillType.toString())+ChatColor.DARK_AQUA+" ("+ChatColor.GREEN+PP.getSkillLevel(skillType)+ChatColor.DARK_AQUA+")", mat);
|
||||||
|
playLevelUpNoise(sPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer getNotificationTier(Integer level)
|
public static Integer getNotificationTier(Integer level)
|
||||||
|
@ -1068,7 +1068,7 @@ public class PlayerProfile
|
|||||||
public boolean isDead(){
|
public boolean isDead(){
|
||||||
return dead;
|
return dead;
|
||||||
}
|
}
|
||||||
public Location getMySpawn(Player player)
|
public Location getMySpawn(Player player, Plugin plugin)
|
||||||
{
|
{
|
||||||
Location loc = null;
|
Location loc = null;
|
||||||
if(myspawn != null)
|
if(myspawn != null)
|
||||||
@ -1082,7 +1082,9 @@ public class PlayerProfile
|
|||||||
|
|
||||||
loc.setYaw(0);
|
loc.setYaw(0);
|
||||||
loc.setPitch(0);
|
loc.setPitch(0);
|
||||||
if(loc.getX() != 0 && loc.getY() != 0 && loc.getZ() != 0 && loc.getWorld() != null){
|
if(loc.getX() != 0 && loc.getY() != 0 && loc.getZ() != 0 && loc.getWorld() != null)
|
||||||
|
{
|
||||||
|
loc.setWorld(plugin.getServer().getWorld(this.getMySpawnWorld(plugin)));
|
||||||
return loc;
|
return loc;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -66,12 +66,14 @@ public class mcPlayerListener extends PlayerListener
|
|||||||
if(player != null && PP != null)
|
if(player != null && PP != null)
|
||||||
{
|
{
|
||||||
PP.setRespawnATS(System.currentTimeMillis());
|
PP.setRespawnATS(System.currentTimeMillis());
|
||||||
Location mySpawn = PP.getMySpawn(player);
|
|
||||||
if(mySpawn != null && plugin.getServer().getWorld(PP.getMySpawnWorld(plugin)) != null)
|
Location mySpawn = PP.getMySpawn(player, plugin);
|
||||||
mySpawn.setWorld(plugin.getServer().getWorld(PP.getMySpawnWorld(plugin)));
|
|
||||||
if(mySpawn != null)
|
if(mySpawn != null)
|
||||||
{
|
{
|
||||||
event.setRespawnLocation(mySpawn);
|
{
|
||||||
|
event.setRespawnLocation(mySpawn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,7 +90,7 @@ public class mcPlayerListener extends PlayerListener
|
|||||||
* GARBAGE COLLECTION
|
* GARBAGE COLLECTION
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//Discard the PlayerProfile object
|
//Discard the PlayerProfile object
|
||||||
Users.removeUser(event.getPlayer());
|
Users.removeUser(event.getPlayer());
|
||||||
if(LoadProperties.spoutEnabled)
|
if(LoadProperties.spoutEnabled)
|
||||||
{
|
{
|
||||||
@ -107,9 +109,7 @@ public class mcPlayerListener extends PlayerListener
|
|||||||
|
|
||||||
if(mcPermissions.getInstance().motd(player) && LoadProperties.enableMotd)
|
if(mcPermissions.getInstance().motd(player) && LoadProperties.enableMotd)
|
||||||
{
|
{
|
||||||
//player.sendMessage(ChatColor.BLUE +"This server is running mcMMO "+plugin.getDescription().getVersion()+" type /"+ChatColor.YELLOW+LoadProperties.mcmmo+ChatColor.BLUE+ " for help.");
|
|
||||||
player.sendMessage(mcLocale.getString("mcPlayerListener.MOTD", new Object[] {plugin.getDescription().getVersion(), LoadProperties.mcmmo}));
|
player.sendMessage(mcLocale.getString("mcPlayerListener.MOTD", new Object[] {plugin.getDescription().getVersion(), LoadProperties.mcmmo}));
|
||||||
//player.sendMessage(ChatColor.GREEN+"http://mcmmo.wikia.com"+ChatColor.BLUE+" - mcMMO Wiki");
|
|
||||||
player.sendMessage(mcLocale.getString("mcPlayerListener.WIKI"));
|
player.sendMessage(mcLocale.getString("mcPlayerListener.WIKI"));
|
||||||
}
|
}
|
||||||
if(plugin.xpevent)
|
if(plugin.xpevent)
|
||||||
@ -156,7 +156,7 @@ public class mcPlayerListener extends PlayerListener
|
|||||||
if(mcPermissions.getInstance().setMySpawn(player)){
|
if(mcPermissions.getInstance().setMySpawn(player)){
|
||||||
PP.setMySpawn(loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName());
|
PP.setMySpawn(loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName());
|
||||||
}
|
}
|
||||||
player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnSet"));
|
//player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnSet"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@ import java.io.OutputStream;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@ -78,7 +77,7 @@ public class mcMMO extends JavaPlugin
|
|||||||
public static mcPermissions permissionHandler = new mcPermissions();
|
public static mcPermissions permissionHandler = new mcPermissions();
|
||||||
private Permissions permissions;
|
private Permissions permissions;
|
||||||
|
|
||||||
private Timer mcMMO_Timer = new Timer(true); //BLEED AND REGENERATION
|
private Runnable mcMMO_Timer = new mcTimer(this); //BLEED AND REGENERATION
|
||||||
//private Timer mcMMO_SpellTimer = new Timer(true);
|
//private Timer mcMMO_SpellTimer = new Timer(true);
|
||||||
|
|
||||||
public static Database database = null;
|
public static Database database = null;
|
||||||
@ -167,7 +166,7 @@ public class mcMMO extends JavaPlugin
|
|||||||
|
|
||||||
for(Player player : getServer().getOnlinePlayers()){Users.addUser(player);} //In case of reload add all users back into PlayerProfile
|
for(Player player : getServer().getOnlinePlayers()){Users.addUser(player);} //In case of reload add all users back into PlayerProfile
|
||||||
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||||
mcMMO_Timer.schedule(new mcTimer(this), (long)0, (long)(1000));
|
Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, mcMMO_Timer, 0, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void download(Logger log, URL url, File file) throws IOException
|
public static void download(Logger log, URL url, File file) throws IOException
|
||||||
@ -1175,23 +1174,30 @@ public class mcMMO extends JavaPlugin
|
|||||||
player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.addxp+" playername skillname xp");
|
player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.addxp+" playername skillname xp");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(LoadProperties.ptpEnable && label.equalsIgnoreCase(LoadProperties.ptp) && PP != null && PP.inParty()){
|
else if(LoadProperties.ptpEnable && label.equalsIgnoreCase(LoadProperties.ptp) && PP.inParty())
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
if(!mcPermissions.getInstance().partyTeleport(player)){
|
if(!mcPermissions.getInstance().partyTeleport(player))
|
||||||
|
{
|
||||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
|
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(split.length < 2){
|
if(split.length < 2)
|
||||||
|
{
|
||||||
player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.ptp+" <playername>");
|
player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.ptp+" <playername>");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(!isPlayer(split[1])){
|
if(!isPlayer(split[1]))
|
||||||
|
{
|
||||||
player.sendMessage("That is not a valid player");
|
player.sendMessage("That is not a valid player");
|
||||||
}
|
}
|
||||||
if(isPlayer(split[1])){
|
if(isPlayer(split[1]))
|
||||||
|
{
|
||||||
Player target = getPlayer(split[1]);
|
Player target = getPlayer(split[1]);
|
||||||
PlayerProfile PPt = Users.getProfile(target);
|
PlayerProfile PPt = Users.getProfile(target);
|
||||||
if(PP.getParty().equals(PPt.getParty())){
|
if(PP.getParty().equals(PPt.getParty()))
|
||||||
|
{
|
||||||
player.teleport(target);
|
player.teleport(target);
|
||||||
player.sendMessage(ChatColor.GREEN+"You have teleported to "+target.getName());
|
player.sendMessage(ChatColor.GREEN+"You have teleported to "+target.getName());
|
||||||
target.sendMessage(ChatColor.GREEN+player.getName() + " has teleported to you.");
|
target.sendMessage(ChatColor.GREEN+player.getName() + " has teleported to you.");
|
||||||
@ -1400,12 +1406,12 @@ public class mcMMO extends JavaPlugin
|
|||||||
{
|
{
|
||||||
if(Pinstance.isPartyLeader(p, PP.getParty()))
|
if(Pinstance.isPartyLeader(p, PP.getParty()))
|
||||||
{
|
{
|
||||||
tempList+=ChatColor.GOLD+p.getName();
|
tempList+=ChatColor.GOLD+p.getName()+", ";
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tempList+= ChatColor.WHITE+p.getName();
|
tempList+= ChatColor.WHITE+p.getName()+", ";
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1697,18 +1703,18 @@ public class mcMMO extends JavaPlugin
|
|||||||
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
|
player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(System.currentTimeMillis() < PP.getMySpawnATS() + 3600000){
|
if(System.currentTimeMillis() < (PP.getMySpawnATS()*1000) + 3600000){
|
||||||
long x = ((PP.getMySpawnATS() + 3600000) - System.currentTimeMillis());
|
long x = (((PP.getMySpawnATS()*1000) + 3600000) - System.currentTimeMillis());
|
||||||
int y = (int) (x/60000);
|
int y = (int) (x/60000);
|
||||||
int z = (int) ((x/1000) - (y*60));
|
int z = (int) ((x/1000) - (y*60));
|
||||||
player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnTimeNotice", new Object[] {y, z}));
|
player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnTimeNotice", new Object[] {y, z}));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
PP.setMySpawnATS(System.currentTimeMillis());
|
PP.setMySpawnATS(System.currentTimeMillis());
|
||||||
if(PP.getMySpawn(player) != null){
|
if(PP.getMySpawn(player, this) != null)
|
||||||
Location mySpawn = PP.getMySpawn(player);
|
{
|
||||||
if(mySpawn != null && this.getServer().getWorld(PP.getMySpawnWorld(this)) != null)
|
Location mySpawn = PP.getMySpawn(player, this);
|
||||||
mySpawn.setWorld(this.getServer().getWorld(PP.getMySpawnWorld(this)));
|
|
||||||
if(mySpawn != null){
|
if(mySpawn != null){
|
||||||
//It's done twice because it acts oddly when you are in another world
|
//It's done twice because it acts oddly when you are in another world
|
||||||
player.teleport(mySpawn);
|
player.teleport(mySpawn);
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
import java.util.TimerTask;
|
|
||||||
|
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
@ -9,7 +7,7 @@ import com.gmail.nossr50.skills.Skills;
|
|||||||
import com.gmail.nossr50.skills.Swords;
|
import com.gmail.nossr50.skills.Swords;
|
||||||
|
|
||||||
|
|
||||||
public class mcTimer extends TimerTask
|
public class mcTimer implements Runnable
|
||||||
{
|
{
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
int thecount = 1;
|
int thecount = 1;
|
||||||
@ -40,23 +38,6 @@ public class mcTimer extends TimerTask
|
|||||||
*/
|
*/
|
||||||
Skills.watchCooldowns(player);
|
Skills.watchCooldowns(player);
|
||||||
|
|
||||||
/*
|
|
||||||
* MANA MONITORING
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
if(mcPermissions.getInstance().sorcery(player) && thecount == 20 && PP.getCurrentMana() < PP.getMaxMana())
|
|
||||||
{
|
|
||||||
PP.setMana(PP.getCurrentMana()+PP.getMaxMana()/5);
|
|
||||||
|
|
||||||
//MAKE SURE THE MANA IS NOT ABOVE MAXIMUM
|
|
||||||
if(PP.getMaxMana() < PP.getCurrentMana())
|
|
||||||
PP.setMana(PP.getMaxMana());
|
|
||||||
|
|
||||||
if(PP.getMaxMana() != PP.getCurrentMana())
|
|
||||||
player.sendMessage(Messages.getString("Sorcery.Current_Mana")+" "+ChatColor.GREEN+PP.getCurrentMana()+"/"+PP.getMaxMana());
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PLAYER BLEED MONITORING
|
* PLAYER BLEED MONITORING
|
||||||
*/
|
*/
|
||||||
@ -68,14 +49,14 @@ public class mcTimer extends TimerTask
|
|||||||
|
|
||||||
if(LoadProperties.enableRegen && mcPermissions.getInstance().regeneration(player) && System.currentTimeMillis() >= PP.getRecentlyHurt() + 60000)
|
if(LoadProperties.enableRegen && mcPermissions.getInstance().regeneration(player) && System.currentTimeMillis() >= PP.getRecentlyHurt() + 60000)
|
||||||
{
|
{
|
||||||
if(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){
|
if(thecount == 20 || thecount == 40 || thecount == 60 || thecount == 80){
|
||||||
if(player != null &&
|
if(player != null &&
|
||||||
player.getHealth() > 0 && player.getHealth() < 20
|
player.getHealth() > 0 && player.getHealth() < 20
|
||||||
&& m.getPowerLevel(player) >= 1000){
|
&& m.getPowerLevel(player) >= 1000){
|
||||||
player.setHealth(m.calculateHealth(player.getHealth(), 1));
|
player.setHealth(m.calculateHealth(player.getHealth(), 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(thecount == 20 || thecount == 40){
|
if(thecount == 40 || thecount == 80){
|
||||||
if(player != null &&
|
if(player != null &&
|
||||||
player.getHealth() > 0 && player.getHealth() < 20
|
player.getHealth() > 0 && player.getHealth() < 20
|
||||||
&& m.getPowerLevel(player) >= 500
|
&& m.getPowerLevel(player) >= 500
|
||||||
@ -83,7 +64,7 @@ public class mcTimer extends TimerTask
|
|||||||
player.setHealth(m.calculateHealth(player.getHealth(), 1));
|
player.setHealth(m.calculateHealth(player.getHealth(), 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(thecount == 40)
|
if(thecount == 80)
|
||||||
{
|
{
|
||||||
if(player != null &&
|
if(player != null &&
|
||||||
player.getHealth() > 0 && player.getHealth() < 20
|
player.getHealth() > 0 && player.getHealth() < 20
|
||||||
@ -104,7 +85,7 @@ public class mcTimer extends TimerTask
|
|||||||
|
|
||||||
//SETUP FOR HP REGEN/BLEED
|
//SETUP FOR HP REGEN/BLEED
|
||||||
thecount++;
|
thecount++;
|
||||||
if(thecount >= 41)
|
if(thecount >= 81)
|
||||||
thecount = 1;
|
thecount = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@ public class Axes {
|
|||||||
ticks++;
|
ticks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!PP.getSkullSplitterMode() && Skills.cooldownOver(player, PP.getSkullSplitterDeactivatedTimeStamp(), LoadProperties.skullSplitterCooldown)){
|
if(!PP.getSkullSplitterMode() && Skills.cooldownOver(player, (PP.getSkullSplitterDeactivatedTimeStamp()*1000), LoadProperties.skullSplitterCooldown))
|
||||||
|
{
|
||||||
player.sendMessage(mcLocale.getString("Skills.SkullSplitterOn"));
|
player.sendMessage(mcLocale.getString("Skills.SkullSplitterOn"));
|
||||||
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
||||||
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||||
@ -45,9 +46,9 @@ public class Axes {
|
|||||||
PP.setSkullSplitterDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
|
PP.setSkullSplitterDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
|
||||||
PP.setSkullSplitterMode(true);
|
PP.setSkullSplitterMode(true);
|
||||||
}
|
}
|
||||||
if(!PP.getSkullSplitterMode() && !Skills.cooldownOver(player, PP.getSkullSplitterDeactivatedTimeStamp(), LoadProperties.skullSplitterCooldown)){
|
if(!PP.getSkullSplitterMode() && !Skills.cooldownOver(player, (PP.getSkullSplitterDeactivatedTimeStamp()*1000), LoadProperties.skullSplitterCooldown)){
|
||||||
player.sendMessage(mcLocale.getString("Skills.TooTired")
|
player.sendMessage(mcLocale.getString("Skills.TooTired")
|
||||||
+ChatColor.YELLOW+" ("+Skills.calculateTimeLeft(player, PP.getSkullSplitterDeactivatedTimeStamp(), LoadProperties.skullSplitterCooldown)+"s)");
|
+ChatColor.YELLOW+" ("+Skills.calculateTimeLeft(player, (PP.getSkullSplitterDeactivatedTimeStamp()*1000), LoadProperties.skullSplitterCooldown)+"s)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@ import com.gmail.nossr50.datatypes.SkillType;
|
|||||||
import com.gmail.nossr50.locale.mcLocale;
|
import com.gmail.nossr50.locale.mcLocale;
|
||||||
|
|
||||||
|
|
||||||
public class Skills {
|
public class Skills
|
||||||
|
{
|
||||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
public void updateSQLfromFile(Player player){
|
public void updateSQLfromFile(Player player){
|
||||||
|
@ -19,16 +19,20 @@ import com.gmail.nossr50.locale.mcLocale;
|
|||||||
import com.gmail.nossr50.config.*;
|
import com.gmail.nossr50.config.*;
|
||||||
|
|
||||||
|
|
||||||
public class WoodCutting {
|
public class WoodCutting
|
||||||
|
{
|
||||||
static int w = 0;
|
static int w = 0;
|
||||||
private static boolean isdone = false;
|
private static boolean isdone = false;
|
||||||
|
|
||||||
public static void woodCuttingProcCheck(Player player, Block block){
|
public static void woodCuttingProcCheck(Player player, Block block)
|
||||||
|
{
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.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)
|
||||||
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.WOODCUTTING)){
|
{
|
||||||
|
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.WOODCUTTING))
|
||||||
|
{
|
||||||
ItemStack item = new ItemStack(mat, 1, (short) 0, type);
|
ItemStack item = new ItemStack(mat, 1, (short) 0, type);
|
||||||
block.getWorld().dropItemNaturally(block.getLocation(), item);
|
block.getWorld().dropItemNaturally(block.getLocation(), item);
|
||||||
}
|
}
|
||||||
@ -53,14 +57,17 @@ public class WoodCutting {
|
|||||||
}
|
}
|
||||||
int ticks = 2;
|
int ticks = 2;
|
||||||
int x = PP.getSkillLevel(SkillType.WOODCUTTING);
|
int x = PP.getSkillLevel(SkillType.WOODCUTTING);
|
||||||
while(x >= 50){
|
while(x >= 50)
|
||||||
|
{
|
||||||
x-=50;
|
x-=50;
|
||||||
ticks++;
|
ticks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!PP.getTreeFellerMode() && Skills.cooldownOver(player, PP.getTreeFellerDeactivatedTimeStamp(), LoadProperties.treeFellerCooldown)){
|
if(!PP.getTreeFellerMode() && Skills.cooldownOver(player, (PP.getTreeFellerDeactivatedTimeStamp()*1000), LoadProperties.treeFellerCooldown))
|
||||||
|
{
|
||||||
player.sendMessage(mcLocale.getString("Skills.TreeFellerOn"));
|
player.sendMessage(mcLocale.getString("Skills.TreeFellerOn"));
|
||||||
for(Player y : pluginx.getServer().getOnlinePlayers()){
|
for(Player y : pluginx.getServer().getOnlinePlayers())
|
||||||
|
{
|
||||||
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||||
y.sendMessage(mcLocale.getString("Skills.TreeFellerPlayer", new Object[] {player.getName()}));
|
y.sendMessage(mcLocale.getString("Skills.TreeFellerPlayer", new Object[] {player.getName()}));
|
||||||
}
|
}
|
||||||
@ -68,9 +75,9 @@ public class WoodCutting {
|
|||||||
PP.setTreeFellerDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
|
PP.setTreeFellerDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
|
||||||
PP.setTreeFellerMode(true);
|
PP.setTreeFellerMode(true);
|
||||||
}
|
}
|
||||||
if(!PP.getTreeFellerMode() && !Skills.cooldownOver(player, PP.getTreeFellerDeactivatedTimeStamp(), LoadProperties.treeFellerCooldown)){
|
if(!PP.getTreeFellerMode() && !Skills.cooldownOver(player, (PP.getTreeFellerDeactivatedTimeStamp()*1000), LoadProperties.treeFellerCooldown)){
|
||||||
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."
|
||||||
+ChatColor.YELLOW+" ("+Skills.calculateTimeLeft(player, PP.getTreeFellerDeactivatedTimeStamp(), LoadProperties.treeFellerCooldown)+"s)");
|
+ChatColor.YELLOW+" ("+Skills.calculateTimeLeft(player, (PP.getTreeFellerDeactivatedTimeStamp()*1000), LoadProperties.treeFellerCooldown)+"s)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,9 +108,11 @@ public class WoodCutting {
|
|||||||
}
|
}
|
||||||
toAdd.clear();
|
toAdd.clear();
|
||||||
}
|
}
|
||||||
public static void addBlocksToTreeFelling(ArrayList<Block> blocklist, ArrayList<Block> toAdd, Integer radius){
|
public static void addBlocksToTreeFelling(ArrayList<Block> blocklist, ArrayList<Block> toAdd, Integer radius)
|
||||||
|
{
|
||||||
int u = 0;
|
int u = 0;
|
||||||
for (Block x : blocklist){
|
for (Block x : blocklist)
|
||||||
|
{
|
||||||
u++;
|
u++;
|
||||||
if(toAdd.contains(x))
|
if(toAdd.contains(x))
|
||||||
continue;
|
continue;
|
||||||
@ -131,11 +140,13 @@ public class WoodCutting {
|
|||||||
/*
|
/*
|
||||||
* Add more blocks to blocklist so they can be 'felled'
|
* Add more blocks to blocklist so they can be 'felled'
|
||||||
*/
|
*/
|
||||||
for(Block xx : toAdd){
|
for(Block xx : toAdd)
|
||||||
|
{
|
||||||
if(!blocklist.contains(xx))
|
if(!blocklist.contains(xx))
|
||||||
blocklist.add(xx);
|
blocklist.add(xx);
|
||||||
}
|
}
|
||||||
if(u >= blocklist.size()){
|
if(u >= blocklist.size())
|
||||||
|
{
|
||||||
isdone = true;
|
isdone = true;
|
||||||
} else {
|
} else {
|
||||||
isdone = false;
|
isdone = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user