This commit is contained in:
Glitchfinder 2013-01-10 09:27:05 -08:00
commit f8c5c380b1
118 changed files with 2050 additions and 1996 deletions

View File

@ -33,6 +33,7 @@ Version 1.3.13-dev
= Fixed a bug where dropped items did not retain custom NBT data = Fixed a bug where dropped items did not retain custom NBT data
= Fixed a bug which caused a potentially infinite recursion in a btree structure = Fixed a bug which caused a potentially infinite recursion in a btree structure
= Fixed a NPE with custom blocks = Fixed a NPE with custom blocks
= Fixed a bug with Blast Mining never dropping debris blocks
! GJ stopped being a lazy slacker and got stuff done ! GJ stopped being a lazy slacker and got stuff done
! Changed code that uses SpoutPlugin to make it compatible with the latest version ! Changed code that uses SpoutPlugin to make it compatible with the latest version
! Changed Reimplemented skill level and power level caps. ! Changed Reimplemented skill level and power level caps.

View File

@ -43,42 +43,41 @@ public class InspectCommand implements CommandExecutor {
return true; return true;
} }
else {
if (sender instanceof Player && !sender.isOp() && !Permissions.inspectOfflineBypass((Player) sender)) {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
return true;
}
PlayerProfile profile = new PlayerProfile(args[0], false); //Temporary Profile
if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", new Object[] { args[0] }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Excavation.Listener"), profile.getSkillLevel(SkillType.EXCAVATION), profile.getSkillXpLevel(SkillType.EXCAVATION), profile.getXpToLevel(SkillType.EXCAVATION) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Fishing.Listener"), profile.getSkillLevel(SkillType.FISHING), profile.getSkillXpLevel(SkillType.FISHING), profile.getXpToLevel(SkillType.FISHING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Herbalism.Listener"), profile.getSkillLevel(SkillType.HERBALISM), profile.getSkillXpLevel(SkillType.HERBALISM), profile.getXpToLevel(SkillType.HERBALISM) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Mining.Listener"), profile.getSkillLevel(SkillType.MINING), profile.getSkillXpLevel(SkillType.MINING), profile.getXpToLevel(SkillType.MINING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Woodcutting.Listener"), profile.getSkillLevel(SkillType.WOODCUTTING), profile.getSkillXpLevel(SkillType.WOODCUTTING), profile.getXpToLevel(SkillType.WOODCUTTING) }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Axes.Listener"), profile.getSkillLevel(SkillType.AXES), profile.getSkillXpLevel(SkillType.AXES), profile.getXpToLevel(SkillType.AXES) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Archery.Listener"), profile.getSkillLevel(SkillType.ARCHERY), profile.getSkillXpLevel(SkillType.ARCHERY), profile.getXpToLevel(SkillType.ARCHERY) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Swords.Listener"), profile.getSkillLevel(SkillType.SWORDS), profile.getSkillXpLevel(SkillType.SWORDS), profile.getXpToLevel(SkillType.SWORDS) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Taming.Listener"), profile.getSkillLevel(SkillType.TAMING), profile.getSkillXpLevel(SkillType.TAMING), profile.getXpToLevel(SkillType.TAMING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Unarmed.Listener"), profile.getSkillLevel(SkillType.UNARMED), profile.getSkillXpLevel(SkillType.UNARMED), profile.getXpToLevel(SkillType.UNARMED) }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Acrobatics.Listener"), profile.getSkillLevel(SkillType.ACROBATICS), profile.getSkillXpLevel(SkillType.ACROBATICS), profile.getXpToLevel(SkillType.ACROBATICS) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Repair.Listener"), profile.getSkillLevel(SkillType.REPAIR), profile.getSkillXpLevel(SkillType.REPAIR), profile.getXpToLevel(SkillType.REPAIR) }));
if (sender instanceof Player && !sender.isOp() && !Permissions.inspectOfflineBypass((Player) sender)) {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
return true; return true;
} }
PlayerProfile profile = new PlayerProfile(args[0], false); //Temporary Profile
if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", new Object[] { args[0] }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Excavation.Listener"), profile.getSkillLevel(SkillType.EXCAVATION), profile.getSkillXpLevel(SkillType.EXCAVATION), profile.getXpToLevel(SkillType.EXCAVATION) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Fishing.Listener"), profile.getSkillLevel(SkillType.FISHING), profile.getSkillXpLevel(SkillType.FISHING), profile.getXpToLevel(SkillType.FISHING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Herbalism.Listener"), profile.getSkillLevel(SkillType.HERBALISM), profile.getSkillXpLevel(SkillType.HERBALISM), profile.getXpToLevel(SkillType.HERBALISM) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Mining.Listener"), profile.getSkillLevel(SkillType.MINING), profile.getSkillXpLevel(SkillType.MINING), profile.getXpToLevel(SkillType.MINING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Woodcutting.Listener"), profile.getSkillLevel(SkillType.WOODCUTTING), profile.getSkillXpLevel(SkillType.WOODCUTTING), profile.getXpToLevel(SkillType.WOODCUTTING) }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Axes.Listener"), profile.getSkillLevel(SkillType.AXES), profile.getSkillXpLevel(SkillType.AXES), profile.getXpToLevel(SkillType.AXES) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Archery.Listener"), profile.getSkillLevel(SkillType.ARCHERY), profile.getSkillXpLevel(SkillType.ARCHERY), profile.getXpToLevel(SkillType.ARCHERY) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Swords.Listener"), profile.getSkillLevel(SkillType.SWORDS), profile.getSkillXpLevel(SkillType.SWORDS), profile.getXpToLevel(SkillType.SWORDS) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Taming.Listener"), profile.getSkillLevel(SkillType.TAMING), profile.getSkillXpLevel(SkillType.TAMING), profile.getXpToLevel(SkillType.TAMING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Unarmed.Listener"), profile.getSkillLevel(SkillType.UNARMED), profile.getSkillXpLevel(SkillType.UNARMED), profile.getXpToLevel(SkillType.UNARMED) }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Acrobatics.Listener"), profile.getSkillLevel(SkillType.ACROBATICS), profile.getSkillXpLevel(SkillType.ACROBATICS), profile.getXpToLevel(SkillType.ACROBATICS) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Repair.Listener"), profile.getSkillLevel(SkillType.REPAIR), profile.getSkillXpLevel(SkillType.REPAIR), profile.getXpToLevel(SkillType.REPAIR) }));
return true;
default: default:
sender.sendMessage(usage); sender.sendMessage(usage);
return true; return true;

View File

@ -62,46 +62,45 @@ public class MctopCommand implements CommandExecutor {
return true; return true;
} }
} }
else {
String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing";
switch (args.length) { String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing";
case 0:
sqlDisplay(1, powerlevel, sender);
return true;
case 1: switch (args.length) {
if (Misc.isInt(args[0])) { case 0:
sqlDisplay(Integer.valueOf(args[0]), powerlevel, sender); sqlDisplay(1, powerlevel, sender);
} return true;
else if (Skills.isSkill(args[0])) {
sqlDisplay(1, args[0].toLowerCase(), sender);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
}
return true; case 1:
if (Misc.isInt(args[0])) {
sqlDisplay(Integer.valueOf(args[0]), powerlevel, sender);
}
else if (Skills.isSkill(args[0])) {
sqlDisplay(1, args[0].toLowerCase(), sender);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
}
case 2: return true;
if (!Skills.isSkill(args[0])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (Misc.isInt(args[1])) { case 2:
sqlDisplay(Integer.valueOf(args[1]), args[0].toLowerCase(), sender); if (!Skills.isSkill(args[0])) {
} sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
else {
sender.sendMessage(usage);
}
return true;
default:
sender.sendMessage(usage);
return true; return true;
} }
if (Misc.isInt(args[1])) {
sqlDisplay(Integer.valueOf(args[1]), args[0].toLowerCase(), sender);
}
else {
sender.sendMessage(usage);
}
return true;
default:
sender.sendMessage(usage);
return true;
} }
} }

View File

@ -56,16 +56,14 @@ public class InviteCommand implements CommandExecutor {
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.1")); target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.1"));
return true; return true;
} }
else {
player.sendMessage(LocaleLoader.getString("Party.Locked")); player.sendMessage(LocaleLoader.getString("Party.Locked"));
return true;
}
}
else {
player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
return true; return true;
} }
player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
return true;
default: default:
sender.sendMessage(usage); sender.sendMessage(usage);
return true; return true;

View File

@ -87,7 +87,7 @@ public class PartyCommand implements CommandExecutor {
player.sendMessage(LocaleLoader.getString("Commands.Party.Leave")); player.sendMessage(LocaleLoader.getString("Commands.Party.Leave"));
} }
else { else {
player.sendMessage("Commands.Party.None"); player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
} }
} }
else if (args[0].equals("?")) { else if (args[0].equals("?")) {
@ -140,7 +140,7 @@ public class PartyCommand implements CommandExecutor {
Party newParty = partyManagerInstance.getParty(args[0]); Party newParty = partyManagerInstance.getParty(args[0]);
// Check to see if the party exists, and if it does, can the player join it? // Check to see if the party exists, and if it does, can the player join it?
if (newParty != null && !partyManagerInstance.checkJoinability(player, playerProfile, newParty, null)) { if (newParty != null && !partyManagerInstance.checkJoinability(player, newParty, null)) {
return true; // End before any event is fired. return true; // End before any event is fired.
} }
@ -186,18 +186,17 @@ public class PartyCommand implements CommandExecutor {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] {args[1]})); player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] {args[1]}));
return true; return true;
} }
else {
String partyName = party.getName();
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, null, EventReason.KICKED_FROM_PARTY);
plugin.getServer().getPluginManager().callEvent(event); String partyName = party.getName();
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, null, EventReason.KICKED_FROM_PARTY);
if (event.isCancelled()) { plugin.getServer().getPluginManager().callEvent(event);
return true;
}
partyManagerInstance.removeFromParty(args[1], party); if (event.isCancelled()) {
return true;
} }
partyManagerInstance.removeFromParty(args[1], party);
} }
else { else {
player.sendMessage(LocaleLoader.getString("Party.NotOwner")); player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
@ -209,16 +208,15 @@ public class PartyCommand implements CommandExecutor {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] {args[1]})); player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] {args[1]}));
return true; return true;
} }
else {
partyManagerInstance.setPartyLeader(args[1], party); partyManagerInstance.setPartyLeader(args[1], party);
}
} }
} }
else { else {
Party newParty = partyManagerInstance.getParty(args[0]); Party newParty = partyManagerInstance.getParty(args[0]);
// Check to see if the party exists, and if it does, can the player join it? // Check to see if the party exists, and if it does, can the player join it?
if (newParty != null && !partyManagerInstance.checkJoinability(player, playerProfile, newParty, args[1])) { if (newParty != null && !partyManagerInstance.checkJoinability(player, newParty, args[1])) {
return true; // End before any event is fired. return true; // End before any event is fired.
} }
@ -237,7 +235,7 @@ public class PartyCommand implements CommandExecutor {
Party newParty = partyManagerInstance.getParty(args[0]); Party newParty = partyManagerInstance.getParty(args[0]);
// Check to see if the party exists, and if it does, can the player join it? // Check to see if the party exists, and if it does, can the player join it?
if (newParty != null && !partyManagerInstance.checkJoinability(player, playerProfile, newParty, args[1])) { if (newParty != null && !partyManagerInstance.checkJoinability(player, newParty, args[1])) {
return true; // End before any event is fired. return true; // End before any event is fired.
} }

View File

@ -44,24 +44,24 @@ public class AcrobaticsCommand extends SkillCommand {
float gracefulRollChanceF; float gracefulRollChanceF;
// DODGE // DODGE
if(skillValue >= dodgeMaxBonusLevel) dodgeChanceF = dodgeChanceMax; if (skillValue >= dodgeMaxBonusLevel) dodgeChanceF = dodgeChanceMax;
else dodgeChanceF = (float) (((double) dodgeChanceMax / (double) dodgeMaxBonusLevel) * skillValue); else dodgeChanceF = (float) (((double) dodgeChanceMax / (double) dodgeMaxBonusLevel) * skillValue);
dodgeChance = df.format(dodgeChanceF); dodgeChance = df.format(dodgeChanceF);
if(dodgeChanceF + dodgeChanceF * 0.3333D >= 100D) dodgeChanceLucky = df.format(100D); if (dodgeChanceF + dodgeChanceF * 0.3333D >= 100D) dodgeChanceLucky = df.format(100D);
else dodgeChanceLucky = df.format(dodgeChanceF + dodgeChanceF * 0.3333D); else dodgeChanceLucky = df.format(dodgeChanceF + dodgeChanceF * 0.3333D);
// ROLL // ROLL
if(skillValue >= rollMaxBonusLevel) rollChanceF = rollChanceMax; if (skillValue >= rollMaxBonusLevel) rollChanceF = rollChanceMax;
else rollChanceF = (float) (((double) rollChanceMax / (double) rollMaxBonusLevel) * skillValue); else rollChanceF = (float) (((double) rollChanceMax / (double) rollMaxBonusLevel) * skillValue);
rollChance = df.format(rollChanceF); rollChance = df.format(rollChanceF);
if(rollChanceF + rollChanceF * 0.3333D >= 100D) rollChanceLucky = df.format(100D); if (rollChanceF + rollChanceF * 0.3333D >= 100D) rollChanceLucky = df.format(100D);
else rollChanceLucky = df.format(rollChanceF + rollChanceF * 0.3333D); else rollChanceLucky = df.format(rollChanceF + rollChanceF * 0.3333D);
// GRACEFULROLL // GRACEFULROLL
if(skillValue >= gracefulRollMaxBonusLevel) gracefulRollChanceF = gracefulRollChanceMax; if (skillValue >= gracefulRollMaxBonusLevel) gracefulRollChanceF = gracefulRollChanceMax;
else gracefulRollChanceF = (float) (((double) gracefulRollChanceMax / (double) gracefulRollMaxBonusLevel) * skillValue); else gracefulRollChanceF = (float) (((double) gracefulRollChanceMax / (double) gracefulRollMaxBonusLevel) * skillValue);
gracefulRollChance = df.format(gracefulRollChanceF); gracefulRollChance = df.format(gracefulRollChanceF);
if(gracefulRollChanceF + gracefulRollChanceF * 0.3333D >= 100D) gracefulRollChanceLucky = df.format(100D); if (gracefulRollChanceF + gracefulRollChanceF * 0.3333D >= 100D) gracefulRollChanceLucky = df.format(100D);
else gracefulRollChanceLucky = df.format(gracefulRollChanceF + gracefulRollChanceF * 0.3333D); else gracefulRollChanceLucky = df.format(gracefulRollChanceF + gracefulRollChanceF * 0.3333D);
} }

View File

@ -50,17 +50,17 @@ public class ArcheryCommand extends SkillCommand {
else skillShotBonus = percent.format(bonus); else skillShotBonus = percent.format(bonus);
// Daze // Daze
if(skillValue >= dazeMaxBonusLevel) dazeChanceF = dazeBonusMax; if (skillValue >= dazeMaxBonusLevel) dazeChanceF = dazeBonusMax;
else dazeChanceF = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * skillValue); else dazeChanceF = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * skillValue);
dazeChance = df.format(dazeChanceF); dazeChance = df.format(dazeChanceF);
if(dazeChanceF + dazeChanceF * 0.3333D >= 100D) dazeChanceLucky = df.format(100D); if (dazeChanceF + dazeChanceF * 0.3333D >= 100D) dazeChanceLucky = df.format(100D);
else dazeChanceLucky = df.format(dazeChanceF + dazeChanceF * 0.3333D); else dazeChanceLucky = df.format(dazeChanceF + dazeChanceF * 0.3333D);
// Retrieve // Retrieve
if(skillValue >= retrieveMaxBonusLevel) retrieveChanceF = retrieveBonusMax; if (skillValue >= retrieveMaxBonusLevel) retrieveChanceF = retrieveBonusMax;
else retrieveChanceF = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * skillValue); else retrieveChanceF = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * skillValue);
retrieveChance = df.format(retrieveChanceF); retrieveChance = df.format(retrieveChanceF);
if(retrieveChanceF + retrieveChanceF * 0.3333D >= 100D) retrieveChanceLucky = df.format(100D); if (retrieveChanceF + retrieveChanceF * 0.3333D >= 100D) retrieveChanceLucky = df.format(100D);
else retrieveChanceLucky = df.format(retrieveChanceF + retrieveChanceF * 0.3333D); else retrieveChanceLucky = df.format(retrieveChanceF + retrieveChanceF * 0.3333D);
} }

View File

@ -56,7 +56,7 @@ public class AxesCommand extends SkillCommand {
if (skillValue >= critMaxBonusLevel) critChanceF = (float) critMaxChance; if (skillValue >= critMaxBonusLevel) critChanceF = (float) critMaxChance;
else critChanceF = (float) ((critMaxChance / critMaxBonusLevel) * skillCheck); else critChanceF = (float) ((critMaxChance / critMaxBonusLevel) * skillCheck);
critChance = df.format(critChanceF); critChance = df.format(critChanceF);
if(critChanceF + critChanceF * 0.3333D >= 100D) critChanceLucky = df.format(100D); if (critChanceF + critChanceF * 0.3333D >= 100D) critChanceLucky = df.format(100D);
else critChanceLucky = df.format(critChanceF + critChanceF * 0.3333D); else critChanceLucky = df.format(critChanceF + critChanceF * 0.3333D);
//Axe Mastery //Axe Mastery
if (skillValue >= bonusDamageAxesMaxBonusLevel) bonusDamage = String.valueOf(bonusDamageAxesBonusMax); if (skillValue >= bonusDamageAxesMaxBonusLevel) bonusDamage = String.valueOf(bonusDamageAxesBonusMax);
@ -125,7 +125,7 @@ public class AxesCommand extends SkillCommand {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.4"), LocaleLoader.getString("Axes.Ability.Bonus.5", new Object[] {greaterImpactDamage}) })); player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.4"), LocaleLoader.getString("Axes.Ability.Bonus.5", new Object[] {greaterImpactDamage}) }));
} }
if (canCritical){ if (canCritical) {
if (player.hasPermission("mcmmo.perks.lucky.axes")) if (player.hasPermission("mcmmo.perks.lucky.axes"))
player.sendMessage(LocaleLoader.getString("Axes.Combat.CritChance", new Object[] { critChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { critChanceLucky })); player.sendMessage(LocaleLoader.getString("Axes.Combat.CritChance", new Object[] { critChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { critChanceLucky }));
else else

View File

@ -45,12 +45,12 @@ public class FishingCommand extends SkillCommand {
int dropChance = Fishing.getShakeChance(lootTier); int dropChance = Fishing.getShakeChance(lootTier);
shakeChance = df.format(dropChance); shakeChance = df.format(dropChance);
if(dropChance + (dropChance * 0.3333D) >= 100D) shakeChanceLucky = df.format(100D); if (dropChance + (dropChance * 0.3333D) >= 100D) shakeChanceLucky = df.format(100D);
else shakeChanceLucky = df.format(dropChance + (dropChance * 0.3333D)); else shakeChanceLucky = df.format(dropChance + (dropChance * 0.3333D));
shakeUnlockLevel = advancedConfig.getShakeUnlockLevel(); shakeUnlockLevel = advancedConfig.getShakeUnlockLevel();
//Fishermans Diet //Fishermans Diet
if(skillValue >= fishermansDietRankMaxLevel) fishermansDietRank = "5"; if (skillValue >= fishermansDietRankMaxLevel) fishermansDietRank = "5";
else fishermansDietRank = String.valueOf((int) ((double) skillValue / (double) fishermansDietRankChange)); else fishermansDietRank = String.valueOf((int) ((double) skillValue / (double) fishermansDietRankChange));
} }

View File

@ -51,22 +51,22 @@ public class HerbalismCommand extends SkillCommand {
float doubleDropChanceF; float doubleDropChanceF;
greenTerraLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel)); greenTerraLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
//FARMERS DIET //FARMERS DIET
if(skillValue >= farmersDietMaxLevel) farmersDietRank = "5"; if (skillValue >= farmersDietMaxLevel) farmersDietRank = "5";
else farmersDietRank = String.valueOf((int) ((double) skillValue / (double) farmersDietRankChange)); else farmersDietRank = String.valueOf((int) ((double) skillValue / (double) farmersDietRankChange));
//GREEN THUMB //GREEN THUMB
if(skillValue >= greenThumbStageMaxLevel) greenThumbStage = "4"; if (skillValue >= greenThumbStageMaxLevel) greenThumbStage = "4";
else greenThumbStage = String.valueOf((int) ((double) skillValue / (double) greenThumbStageChange)); else greenThumbStage = String.valueOf((int) ((double) skillValue / (double) greenThumbStageChange));
if(skillValue >= greenThumbMaxLevel) greenThumbChanceF = (float) (greenThumbMaxBonus); if (skillValue >= greenThumbMaxLevel) greenThumbChanceF = (float) (greenThumbMaxBonus);
else greenThumbChanceF = (float) ((greenThumbMaxBonus / greenThumbMaxLevel) * skillValue); else greenThumbChanceF = (float) ((greenThumbMaxBonus / greenThumbMaxLevel) * skillValue);
greenThumbChance = df.format(greenThumbChanceF); greenThumbChance = df.format(greenThumbChanceF);
if(greenThumbChanceF + greenThumbChanceF * 0.3333D >= 100D) greenThumbChanceLucky = df.format(100D); if (greenThumbChanceF + greenThumbChanceF * 0.3333D >= 100D) greenThumbChanceLucky = df.format(100D);
else greenThumbChanceLucky = df.format(greenThumbChanceF + greenThumbChanceF * 0.3333D); else greenThumbChanceLucky = df.format(greenThumbChanceF + greenThumbChanceF * 0.3333D);
//DOUBLE DROPS //DOUBLE DROPS
if(skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus); if (skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue); else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
doubleDropChance = df.format(doubleDropChanceF); doubleDropChance = df.format(doubleDropChanceF);
if(doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D); if (doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D);
else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D); else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D);
} }

View File

@ -53,10 +53,10 @@ public class MiningCommand extends SkillCommand {
//Super Breaker //Super Breaker
superBreakerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel)); superBreakerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
//Double Drops //Double Drops
if(skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus); if (skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue); else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
doubleDropChance = df.format(doubleDropChanceF); doubleDropChance = df.format(doubleDropChanceF);
if(doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D); if (doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D);
else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D); else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D);
//Blast Mining //Blast Mining

View File

@ -21,7 +21,7 @@ public class RepairCommand extends SkillCommand {
private String superRepairChance; private String superRepairChance;
private String superRepairChanceLucky; private String superRepairChanceLucky;
private float repairMasteryChanceMax = advancedConfig.getRepairMasteryChanceMax(); private float repairMasteryMaxBonus = advancedConfig.getRepairMasteryMaxBonus();
private float repairMasteryMaxBonusLevel = advancedConfig.getRepairMasteryMaxLevel(); private float repairMasteryMaxBonusLevel = advancedConfig.getRepairMasteryMaxLevel();
private float superRepairChanceMax = advancedConfig.getSuperRepairChanceMax(); private float superRepairChanceMax = advancedConfig.getSuperRepairChanceMax();
private float superRepairMaxBonusLevel = advancedConfig.getSuperRepairMaxLevel(); private float superRepairMaxBonusLevel = advancedConfig.getSuperRepairMaxLevel();
@ -67,13 +67,13 @@ public class RepairCommand extends SkillCommand {
salvageLevel = Config.getInstance().getSalvageUnlockLevel(); salvageLevel = Config.getInstance().getSalvageUnlockLevel();
if(skillValue >= repairMasteryMaxBonusLevel) repairMasteryBonus = df.format(repairMasteryChanceMax); if (skillValue >= repairMasteryMaxBonusLevel) repairMasteryBonus = df.format(repairMasteryMaxBonus);
else repairMasteryBonus = df.format(((double) repairMasteryChanceMax / (double) repairMasteryMaxBonusLevel) * skillValue); else repairMasteryBonus = df.format(((double) repairMasteryMaxBonus / (double) repairMasteryMaxBonusLevel) * skillValue);
if(skillValue >= superRepairMaxBonusLevel) superRepairChanceF = superRepairChanceMax; if (skillValue >= superRepairMaxBonusLevel) superRepairChanceF = superRepairChanceMax;
else superRepairChanceF = (float) (((double) superRepairChanceMax / (double) superRepairMaxBonusLevel) * skillValue); else superRepairChanceF = (float) (((double) superRepairChanceMax / (double) superRepairMaxBonusLevel) * skillValue);
superRepairChance = df.format(superRepairChanceF); superRepairChance = df.format(superRepairChanceF);
if(superRepairChanceF + superRepairChanceF * 0.3333D >= 100D) superRepairChanceLucky = df.format(100D); if (superRepairChanceF + superRepairChanceF * 0.3333D >= 100D) superRepairChanceLucky = df.format(100D);
else superRepairChanceLucky = df.format(superRepairChanceF + superRepairChanceF * 0.3333D); else superRepairChanceLucky = df.format(superRepairChanceF + superRepairChanceF * 0.3333D);
arcaneForgingRank = Repair.getArcaneForgingRank(profile); arcaneForgingRank = Repair.getArcaneForgingRank(profile);

View File

@ -48,19 +48,17 @@ public class SwordsCommand extends SkillCommand {
if (skillValue >= bleedMaxLevel) bleedLength = String.valueOf(bleedMaxTicks); if (skillValue >= bleedMaxLevel) bleedLength = String.valueOf(bleedMaxTicks);
else bleedLength = String.valueOf(bleedBaseTicks); else bleedLength = String.valueOf(bleedBaseTicks);
if(skillValue >= bleedMaxLevel) bleedChanceF = bleedChanceMax; if (skillValue >= bleedMaxLevel) bleedChanceF = bleedChanceMax;
else bleedChanceF = (float) (((double) bleedChanceMax / (double) bleedMaxLevel) * skillValue); else bleedChanceF = (float) (((double) bleedChanceMax / (double) bleedMaxLevel) * skillValue);
bleedChance = df.format(bleedChanceF); bleedChance = df.format(bleedChanceF);
if(bleedChanceF + bleedChanceF * 0.3333D >= 100D) bleedChanceLucky = df.format(100D); if (bleedChanceF + bleedChanceF * 0.3333D >= 100D) bleedChanceLucky = df.format(100D);
else bleedChanceLucky = df.format(bleedChanceF + bleedChanceF * 0.3333D); else bleedChanceLucky = df.format(bleedChanceF + bleedChanceF * 0.3333D);
if(skillValue >= counterMaxLevel) counterAttackChanceF = counterChanceMax; if (skillValue >= counterMaxLevel) counterAttackChanceF = counterChanceMax;
else counterAttackChanceF = (float) (((double) counterChanceMax / (double) counterMaxLevel) * skillValue); else counterAttackChanceF = (float) (((double) counterChanceMax / (double) counterMaxLevel) * skillValue);
counterAttackChance = df.format(counterAttackChanceF); counterAttackChance = df.format(counterAttackChanceF);
if(counterAttackChanceF + counterAttackChanceF * 0.3333D >= 100D) counterAttackChanceLucky = df.format(100D); if (counterAttackChanceF + counterAttackChanceF * 0.3333D >= 100D) counterAttackChanceLucky = df.format(100D);
else counterAttackChanceLucky = df.format(counterAttackChanceF + counterAttackChanceF * 0.3333D); else counterAttackChanceLucky = df.format(counterAttackChanceF + counterAttackChanceF * 0.3333D);
serratedStrikesLength = String.valueOf(serratedBleedTicks);
} }
@Override @Override

View File

@ -43,10 +43,10 @@ public class TamingCommand extends SkillCommand {
protected void dataCalculations() { protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("0.0"); DecimalFormat df = new DecimalFormat("0.0");
float goreChanceF; float goreChanceF;
if(skillValue >= goreMaxLevel) goreChanceF = (goreChanceMax); if (skillValue >= goreMaxLevel) goreChanceF = (goreChanceMax);
else goreChanceF = (float) (((double) goreChanceMax / (double) goreMaxLevel) * skillValue); else goreChanceF = (float) (((double) goreChanceMax / (double) goreMaxLevel) * skillValue);
goreChance = df.format(goreChanceF); goreChance = df.format(goreChanceF);
if(goreChanceF + goreChanceF * 0.3333D >= 100D) goreChanceLucky = df.format(100D); if (goreChanceF + goreChanceF * 0.3333D >= 100D) goreChanceLucky = df.format(100D);
else goreChanceLucky = df.format(goreChanceF + goreChanceF * 0.3333D); else goreChanceLucky = df.format(goreChanceF + goreChanceF * 0.3333D);
} }

View File

@ -44,16 +44,16 @@ public class UnarmedCommand extends SkillCommand {
float deflectChanceF; float deflectChanceF;
berserkLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel)); berserkLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
if(skillValue >= disarmMaxLevel) disarmChanceF = disarmChanceMax; if (skillValue >= disarmMaxLevel) disarmChanceF = disarmChanceMax;
else disarmChanceF = (float) (((double) disarmChanceMax / (double) disarmMaxLevel) * skillValue); else disarmChanceF = (float) (((double) disarmChanceMax / (double) disarmMaxLevel) * skillValue);
disarmChance = df.format(disarmChanceF); disarmChance = df.format(disarmChanceF);
if(disarmChanceF + disarmChanceF * 0.3333D >= 100D) disarmChanceLucky = df.format(100D); if (disarmChanceF + disarmChanceF * 0.3333D >= 100D) disarmChanceLucky = df.format(100D);
else disarmChanceLucky = df.format(disarmChanceF + disarmChanceF * 0.3333D); else disarmChanceLucky = df.format(disarmChanceF + disarmChanceF * 0.3333D);
if(skillValue >= deflectMaxLevel) deflectChanceF = deflectChanceMax; if (skillValue >= deflectMaxLevel) deflectChanceF = deflectChanceMax;
else deflectChanceF = (float) (((double) deflectChanceMax / (double) deflectMaxLevel) * skillValue); else deflectChanceF = (float) (((double) deflectChanceMax / (double) deflectMaxLevel) * skillValue);
deflectChance = df.format(deflectChanceF); deflectChance = df.format(deflectChanceF);
if(deflectChanceF + deflectChanceF * 0.3333D >= 100D) deflectChanceLucky = df.format(100D); if (deflectChanceF + deflectChanceF * 0.3333D >= 100D) deflectChanceLucky = df.format(100D);
else deflectChanceLucky = df.format(deflectChanceF + deflectChanceF * 0.3333D); else deflectChanceLucky = df.format(deflectChanceF + deflectChanceF * 0.3333D);
if (skillValue >= 250) ironArmBonus = String.valueOf(ironArmMaxBonus); if (skillValue >= 250) ironArmBonus = String.valueOf(ironArmMaxBonus);

View File

@ -38,10 +38,10 @@ public class WoodcuttingCommand extends SkillCommand {
float doubleDropChanceF; float doubleDropChanceF;
treeFellerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel)); treeFellerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
if(skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus); if (skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue); else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
doubleDropChance = df.format(doubleDropChanceF); doubleDropChance = df.format(doubleDropChanceF);
if(doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D); if (doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D);
else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D); else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D);
} }

View File

@ -93,7 +93,7 @@ public class AdvancedConfig extends ConfigLoader {
public int getBlastMiningRank7() { return config.getInt("Skills.Mining.BlastMining_Rank7", 875); } public int getBlastMiningRank7() { return config.getInt("Skills.Mining.BlastMining_Rank7", 875); }
public int getBlastMiningRank8() { return config.getInt("Skills.Mining.BlastMining_Rank8", 1000); } public int getBlastMiningRank8() { return config.getInt("Skills.Mining.BlastMining_Rank8", 1000); }
/* REPAIR */ /* REPAIR */
public int getRepairMasteryChanceMax() { return config.getInt("Skills.Repair.RepairMastery_ChanceMax", 200); } public int getRepairMasteryMaxBonus() { return config.getInt("Skills.Repair.RepairMastery_MaxBonusPercentage", 200); }
public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery_MaxBonusLevel", 1000); } public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery_MaxBonusLevel", 1000); }
public int getSuperRepairChanceMax() { return config.getInt("Skills.Repair.SuperRepair_ChanceMax", 100); } public int getSuperRepairChanceMax() { return config.getInt("Skills.Repair.SuperRepair_ChanceMax", 100); }
public int getSuperRepairMaxLevel() { return config.getInt("Skills.Repair.SuperRepair_MaxBonusLevel", 1000); } public int getSuperRepairMaxLevel() { return config.getInt("Skills.Repair.SuperRepair_MaxBonusLevel", 1000); }
@ -136,7 +136,7 @@ public class AdvancedConfig extends ConfigLoader {
public int getDeflectMaxBonusLevel() { return config.getInt("Skills.Unarmed.Deflect_MaxBonusLevel", 1000); } public int getDeflectMaxBonusLevel() { return config.getInt("Skills.Unarmed.Deflect_MaxBonusLevel", 1000); }
public int getIronGripChanceMax() { return config.getInt("Skills.Unarmed.IronGrip_ChanceMax", 100); } public int getIronGripChanceMax() { return config.getInt("Skills.Unarmed.IronGrip_ChanceMax", 100); }
public int getIronGripMaxBonusLevel() { return config.getInt("Skills.Unarmed.IronGrip_MaxBonusLevel", 1000); } public int getIronGripMaxBonusLevel() { return config.getInt("Skills.Unarmed.IronGrip_MaxBonusLevel", 1000); }
public int getIronArmBonus() { return config.getInt("Skills.Unarmed.IronArm_Bonus", 8); } public int getIronArmBonus() { return config.getInt("Skills.Unarmed.IronArm_BonusMax", 8); }
public int getIronArmIncreaseLevel() { return config.getInt("Skills.Unarmed.IronArm_IncreaseLevel", 50); } public int getIronArmIncreaseLevel() { return config.getInt("Skills.Unarmed.IronArm_IncreaseLevel", 50); }
/* WOODCUTTING */ /* WOODCUTTING */
public int getLeafBlowUnlockLevel() { return config.getInt("Skills.Woodcutting.LeafBlower_UnlockLevel", 100); } public int getLeafBlowUnlockLevel() { return config.getInt("Skills.Woodcutting.LeafBlower_UnlockLevel", 100); }

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.config; package com.gmail.nossr50.config;
import java.util.Iterator;
import java.util.Set; import java.util.Set;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
@ -49,9 +48,8 @@ public class Config extends ConfigLoader {
if (getStringIncludingInts(config, "MySQL.Database.User_Password") != null) { if (getStringIncludingInts(config, "MySQL.Database.User_Password") != null) {
return getStringIncludingInts(config, "MySQL.Database.User_Password"); return getStringIncludingInts(config, "MySQL.Database.User_Password");
} }
else {
return ""; return "";
}
} }
private static String getStringIncludingInts(ConfigurationSection cfg, String key) { private static String getStringIncludingInts(ConfigurationSection cfg, String key) {
@ -206,22 +204,7 @@ public class Config extends ConfigLoader {
public boolean getPotatoDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Potato", true); } public boolean getPotatoDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Potato", true); }
public boolean herbalismDoubleDropsDisabled() { public boolean herbalismDoubleDropsDisabled() {
ConfigurationSection section = config.getConfigurationSection("Double_Drops.Herbalism"); return doubleDropsDisabled("Herbalism");
Set<String> keys = section.getKeys(false);
Iterator<String> iterator = keys.iterator();
boolean disabled = true;
while (iterator.hasNext()) {
String key = iterator.next();
if (config.getBoolean("Double_Drops.Herbalism." + key)) {
disabled = false;
break;
}
}
return disabled;
} }
/* Mining */ /* Mining */
@ -256,22 +239,7 @@ public class Config extends ConfigLoader {
public boolean getEmeraldDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Emerald", true); } public boolean getEmeraldDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Emerald", true); }
public boolean miningDoubleDropsDisabled() { public boolean miningDoubleDropsDisabled() {
ConfigurationSection section = config.getConfigurationSection("Double_Drops.Mining"); return doubleDropsDisabled("Mining");
Set<String> keys = section.getKeys(false);
Iterator<String> iterator = keys.iterator();
boolean disabled = true;
while (iterator.hasNext()) {
String key = iterator.next();
if (config.getBoolean("Double_Drops.Mining." + key)) {
disabled = false;
break;
}
}
return disabled;
} }
public int getDetonatorItemID() { return config.getInt("Skills.Mining.Detonator_ID", 259); } public int getDetonatorItemID() { return config.getInt("Skills.Mining.Detonator_ID", 259); }
@ -303,22 +271,7 @@ public class Config extends ConfigLoader {
public boolean getJungleDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Jungle", true); } public boolean getJungleDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Jungle", true); }
public boolean woodcuttingDoubleDropsDisabled() { public boolean woodcuttingDoubleDropsDisabled() {
ConfigurationSection section = config.getConfigurationSection("Double_Drops.Woodcutting"); return doubleDropsDisabled("Woodcutting");
Set<String> keys = section.getKeys(false);
Iterator<String> iterator = keys.iterator();
boolean disabled = true;
while (iterator.hasNext()) {
String key = iterator.next();
if (config.getBoolean("Double_Drops.Woodcutting." + key)) {
disabled = false;
break;
}
}
return disabled;
} }
/* AFK Leveling */ /* AFK Leveling */
@ -343,68 +296,55 @@ public class Config extends ConfigLoader {
/* Level Caps */ /* Level Caps */
public int getLevelCapAcrobatics() { public int getLevelCapAcrobatics() {
int cap = config.getInt("Skills.Acrobatics.Level_Cap", 0); return getLevelCap("Skills.Acrobatics.Level_Cap");
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
} }
public int getLevelCapArchery() { public int getLevelCapArchery() {
int cap = config.getInt("Skills.Archery.Level_Cap", 0); return getLevelCap("Skills.Archery.Level_Cap");
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
} }
public int getLevelCapAxes() { public int getLevelCapAxes() {
int cap = config.getInt("Skills.Axes.Level_Cap", 0); return getLevelCap("Skills.Axes.Level_Cap");
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
} }
public int getLevelCapExcavation() { public int getLevelCapExcavation() {
int cap = config.getInt("Skills.Excavation.Level_Cap", 0); return getLevelCap("Skills.Excavation.Level_Cap");
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
} }
public int getLevelCapFishing() { public int getLevelCapFishing() {
int cap = config.getInt("Skills.Fishing.Level_Cap", 0); return getLevelCap("Skills.Fishing.Level_Cap");
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
} }
public int getLevelCapHerbalism() { public int getLevelCapHerbalism() {
int cap = config.getInt("Skills.Herbalism.Level_Cap", 0); return getLevelCap("Skills.Herbalism.Level_Cap");
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
} }
public int getLevelCapMining() { public int getLevelCapMining() {
int cap = config.getInt("Skills.Mining.Level_Cap", 0); return getLevelCap("Skills.Mining.Level_Cap");
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
} }
public int getLevelCapRepair() { public int getLevelCapRepair() {
int cap = config.getInt("Skills.Repair.Level_Cap", 0); return getLevelCap("Skills.Repair.Level_Cap");
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
} }
public int getLevelCapSwords() { public int getLevelCapSwords() {
int cap = config.getInt("Skills.Swords.Level_Cap", 0); return getLevelCap("Skills.Swords.Level_Cap");
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
} }
public int getLevelCapTaming() { public int getLevelCapTaming() {
int cap = config.getInt("Skills.Taming.Level_Cap", 0); return getLevelCap("Skills.Taming.Level_Cap");
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
} }
public int getLevelCapUnarmed() { public int getLevelCapUnarmed() {
int cap = config.getInt("Skills.Unarmed.Level_Cap", 0); return getLevelCap("Skills.Unarmed.Level_Cap");
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
} }
public int getLevelCapWoodcutting() { public int getLevelCapWoodcutting() {
int cap = config.getInt("Skills.Woodcutting.Level_Cap", 0); return getLevelCap("Skills.Woodcutting.Level_Cap");
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
} }
public int getPowerLevelCap() { public int getPowerLevelCap() {
int cap = config.getInt("General.Power_Level_Cap", 0); return getLevelCap("General.Power_Level_Cap");
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
} }
/* PVP & PVE Settings */ /* PVP & PVE Settings */
@ -466,4 +406,25 @@ public class Config extends ConfigLoader {
public double getFormulaMultiplierAxes() { return config.getDouble("Experience.Formula.Multiplier.Axes", 1.0); } public double getFormulaMultiplierAxes() { return config.getDouble("Experience.Formula.Multiplier.Axes", 1.0); }
public double getFormulaMultiplierAcrobatics() { return config.getDouble("Experience.Formula.Multiplier.Acrobatics", 1.0); } public double getFormulaMultiplierAcrobatics() { return config.getDouble("Experience.Formula.Multiplier.Acrobatics", 1.0); }
public double getFormulaMultiplierFishing() { return config.getDouble("Experience.Formula.Multiplier.Fishing", 1.0); } public double getFormulaMultiplierFishing() { return config.getDouble("Experience.Formula.Multiplier.Fishing", 1.0); }
private boolean doubleDropsDisabled(String skillName) {
ConfigurationSection section = config.getConfigurationSection("Double_Drops." + skillName);
Set<String> keys = section.getKeys(false);
boolean disabled = true;
for (String key : keys) {
if (config.getBoolean("Double_Drops." + skillName + "." + key)) {
disabled = false;
break;
}
}
return disabled;
}
private int getLevelCap(String configString) {
int cap = config.getInt(configString, 0);
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
}
} }

View File

@ -16,13 +16,13 @@ public abstract class ConfigLoader {
protected File configFile; protected File configFile;
protected FileConfiguration config; protected FileConfiguration config;
public ConfigLoader(String relativePath, String fileName){ public ConfigLoader(String relativePath, String fileName) {
this.fileName = fileName; this.fileName = fileName;
configFile = new File(plugin.getDataFolder(), relativePath + File.separator + fileName); configFile = new File(plugin.getDataFolder(), relativePath + File.separator + fileName);
loadFile(); loadFile();
} }
public ConfigLoader(String fileName){ public ConfigLoader(String fileName) {
this.fileName = fileName; this.fileName = fileName;
configFile = new File(plugin.getDataFolder(), fileName); configFile = new File(plugin.getDataFolder(), fileName);
loadFile(); loadFile();

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.config;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -50,10 +49,8 @@ public class TreasuresConfig extends ConfigLoader{
Map<String, Treasure> treasures = new HashMap<String, Treasure>(); Map<String, Treasure> treasures = new HashMap<String, Treasure>();
ConfigurationSection treasureSection = config.getConfigurationSection("Treasures"); ConfigurationSection treasureSection = config.getConfigurationSection("Treasures");
Set<String> treasureConfigSet = treasureSection.getKeys(false); Set<String> treasureConfigSet = treasureSection.getKeys(false);
Iterator<String> iterator = treasureConfigSet.iterator();
while (iterator.hasNext()) { for (String treasureName : treasureConfigSet) {
String treasureName = iterator.next();
// Validate all the things! // Validate all the things!
List<String> reason = new ArrayList<String>(); List<String> reason = new ArrayList<String>();
@ -191,11 +188,8 @@ public class TreasuresConfig extends ConfigLoader{
List<String> excavationTreasures = config.getStringList("Excavation.Treasure"); List<String> excavationTreasures = config.getStringList("Excavation.Treasure");
List<String> fishingTreasures = config.getStringList("Fishing.Treasure"); List<String> fishingTreasures = config.getStringList("Fishing.Treasure");
// Iterator<String> treasureIterator = treasures.keySet().iterator();
Iterator<Entry<String,Treasure>> treasureIterator = treasures.entrySet().iterator();
while (treasureIterator.hasNext()) { for (Entry<String,Treasure> nextEntry : treasures.entrySet()) {
Entry<String,Treasure> nextEntry = treasureIterator.next();
String treasureKey = nextEntry.getKey(); String treasureKey = nextEntry.getKey();
Treasure treasure = nextEntry.getValue(); Treasure treasure = nextEntry.getValue();
@ -208,11 +202,11 @@ public class TreasuresConfig extends ConfigLoader{
int dropLevel = fTreasure.getDropLevel(); int dropLevel = fTreasure.getDropLevel();
int maxLevel = fTreasure.getMaxLevel(); int maxLevel = fTreasure.getMaxLevel();
if(dropLevel <= Config.getInstance().getFishingTierLevelsTier1() && maxLevel >= Config.getInstance().getFishingTierLevelsTier1()) { if (dropLevel <= Config.getInstance().getFishingTierLevelsTier1() && maxLevel >= Config.getInstance().getFishingTierLevelsTier1()) {
fishingRewardsTier1.add(fTreasure); fishingRewardsTier1.add(fTreasure);
} }
if(dropLevel <= Config.getInstance().getFishingTierLevelsTier2() && maxLevel >= Config.getInstance().getFishingTierLevelsTier2()) { if (dropLevel <= Config.getInstance().getFishingTierLevelsTier2() && maxLevel >= Config.getInstance().getFishingTierLevelsTier2()) {
fishingRewardsTier2.add(fTreasure); fishingRewardsTier2.add(fTreasure);
} }
@ -271,11 +265,10 @@ public class TreasuresConfig extends ConfigLoader{
if (issues.isEmpty()) { if (issues.isEmpty()) {
return true; return true;
} }
else {
for (String issue : issues) { for (String issue : issues) {
plugin.getLogger().warning(issue); plugin.getLogger().warning(issue);
}
return false;
} }
return false;
} }
} }

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.config.mods;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -50,15 +49,12 @@ public class CustomArmorConfig extends ConfigLoader{
private void loadArmor(String armorType, List<Integer> idList) { private void loadArmor(String armorType, List<Integer> idList) {
ConfigurationSection armorSection = config.getConfigurationSection(armorType); ConfigurationSection armorSection = config.getConfigurationSection(armorType);
if(armorSection == null) if (armorSection == null)
return; return;
Set<String> armorConfigSet = armorSection.getKeys(false); Set<String> armorConfigSet = armorSection.getKeys(false);
Iterator<String> iterator = armorConfigSet.iterator();
while (iterator.hasNext()) {
String armorName = iterator.next();
for (String armorName : armorConfigSet) {
int id = config.getInt(armorType + "." + armorName + ".ID", 0); int id = config.getInt(armorType + "." + armorName + ".ID", 0);
boolean repairable = config.getBoolean(armorType + "." + armorName + ".Repairable"); boolean repairable = config.getBoolean(armorType + "." + armorName + ".Repairable");
int repairID = config.getInt(armorType + "." + armorName + ".Repair_Material_ID", 0); int repairID = config.getInt(armorType + "." + armorName + ".Repair_Material_ID", 0);
@ -92,7 +88,7 @@ public class CustomArmorConfig extends ConfigLoader{
} }
public List<Repairable> getLoadedRepairables() { public List<Repairable> getLoadedRepairables() {
if(repairables == null) return new ArrayList<Repairable>(); if (repairables == null) return new ArrayList<Repairable>();
return repairables; return repairables;
} }
} }

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.config.mods; package com.gmail.nossr50.config.mods;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -50,15 +49,12 @@ public class CustomBlocksConfig extends ConfigLoader {
private void loadBlocks(String skillType, List<ItemStack> blockList) { private void loadBlocks(String skillType, List<ItemStack> blockList) {
ConfigurationSection skillSection = config.getConfigurationSection(skillType); ConfigurationSection skillSection = config.getConfigurationSection(skillType);
if(skillSection == null) if (skillSection == null)
return; return;
Set<String> skillConfigSet = skillSection.getKeys(false); Set<String> skillConfigSet = skillSection.getKeys(false);
Iterator<String> iterator = skillConfigSet.iterator();
while (iterator.hasNext()) {
String blockName = iterator.next();
for (String blockName : skillConfigSet) {
int id = config.getInt(skillType + "." + blockName + ".ID", 0); int id = config.getInt(skillType + "." + blockName + ".ID", 0);
byte data = (byte) config.getInt(skillType + "." + blockName + ".Data_Value", 0); byte data = (byte) config.getInt(skillType + "." + blockName + ".Data_Value", 0);
int xp = config.getInt(skillType + "." + blockName + ".XP_Gain", 0); int xp = config.getInt(skillType + "." + blockName + ".XP_Gain", 0);

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.config.mods;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -54,15 +53,12 @@ public class CustomToolsConfig extends ConfigLoader {
private void loadTool(String toolType, List<Integer> idList) { private void loadTool(String toolType, List<Integer> idList) {
ConfigurationSection toolSection = config.getConfigurationSection(toolType); ConfigurationSection toolSection = config.getConfigurationSection(toolType);
if(toolSection == null) if (toolSection == null)
return; return;
Set<String> toolConfigSet = toolSection.getKeys(false); Set<String> toolConfigSet = toolSection.getKeys(false);
Iterator<String> iterator = toolConfigSet.iterator();
while (iterator.hasNext()) {
String toolName = iterator.next();
for (String toolName : toolConfigSet) {
int id = config.getInt(toolType + "." + toolName + ".ID", 0); int id = config.getInt(toolType + "." + toolName + ".ID", 0);
double multiplier = config.getDouble(toolType + "." + toolName + ".XP_Modifier", 1.0); double multiplier = config.getDouble(toolType + "." + toolName + ".XP_Modifier", 1.0);
boolean abilityEnabled = config.getBoolean(toolType + "." + toolName + ".Ability_Enabled", true); boolean abilityEnabled = config.getBoolean(toolType + "." + toolName + ".Ability_Enabled", true);
@ -99,7 +95,7 @@ public class CustomToolsConfig extends ConfigLoader {
} }
public List<Repairable> getLoadedRepairables() { public List<Repairable> getLoadedRepairables() {
if(repairables == null) return new ArrayList<Repairable>(); if (repairables == null) return new ArrayList<Repairable>();
return repairables; return repairables;
} }
} }

View File

@ -99,11 +99,10 @@ public class RepairConfig extends ConfigLoader {
if (issues.isEmpty()) { if (issues.isEmpty()) {
return true; return true;
} }
else {
for (String issue : issues) { for (String issue : issues) {
plugin.getLogger().warning(issue); plugin.getLogger().warning(issue);
}
return false;
} }
return false;
} }
} }

View File

@ -120,9 +120,9 @@ public class McMMOPlayer {
* @param newvalue The amount of XP to add * @param newvalue The amount of XP to add
*/ */
public void addXP(SkillType skillType, int newValue) { public void addXP(SkillType skillType, int newValue) {
if(player == null) if (player == null)
return; return;
else if(player.getGameMode() == null) else if (player.getGameMode() == null)
return; return;
if (player.getGameMode().equals(GameMode.CREATIVE)) { if (player.getGameMode().equals(GameMode.CREATIVE)) {
@ -209,9 +209,8 @@ public class McMMOPlayer {
if (invite != null) { if (invite != null) {
return true; return true;
} }
else {
return false; return false;
}
} }
public void setParty(Party party) { public void setParty(Party party) {
@ -226,9 +225,8 @@ public class McMMOPlayer {
if (party != null) { if (party != null) {
return true; return true;
} }
else {
return false; return false;
}
} }
public void removeParty() { public void removeParty() {

View File

@ -96,89 +96,88 @@ public class PlayerProfile {
if (userId == 0) { if (userId == 0) {
return false; return false;
} }
else {
HashMap<Integer, ArrayList<String>> huds = database.read("SELECT hudtype FROM " + tablePrefix + "huds WHERE user_id = " + userId);
if (huds.get(1) == null) { HashMap<Integer, ArrayList<String>> huds = database.read("SELECT hudtype FROM " + tablePrefix + "huds WHERE user_id = " + userId);
database.write("INSERT INTO " + tablePrefix + "huds (user_id) VALUES (" + userId + ")");
} if (huds.get(1) == null) {
else { database.write("INSERT INTO " + tablePrefix + "huds (user_id) VALUES (" + userId + ")");
for (HudType type : HudType.values()) { }
if (type.toString().equals(huds.get(1).get(0))) { else {
hudType = type; for (HudType type : HudType.values()) {
} if (type.toString().equals(huds.get(1).get(0))) {
hudType = type;
} }
} }
/*
* I'm still learning MySQL, this is a fix for adding a new table
* its not pretty but it works
*/
HashMap<Integer, ArrayList<String>> cooldowns = database.read("SELECT mining, woodcutting, unarmed, herbalism, excavation, swords, axes, blast_mining FROM " + tablePrefix + "cooldowns WHERE user_id = " + userId);
ArrayList<String> cooldownValues = cooldowns.get(1);
if (cooldownValues == null) {
database.write("INSERT INTO " + tablePrefix + "cooldowns (user_id) VALUES (" + userId + ")");
mcMMO.p.getLogger().warning(playerName + "does not exist in the cooldown table. Their cooldowns will be reset.");
}
else {
skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(cooldownValues.get(0)));
skillsDATS.put(AbilityType.TREE_FELLER, Integer.valueOf(cooldownValues.get(1)));
skillsDATS.put(AbilityType.BERSERK, Integer.valueOf(cooldownValues.get(2)));
skillsDATS.put(AbilityType.GREEN_TERRA, Integer.valueOf(cooldownValues.get(3)));
skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(cooldownValues.get(4)));
skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(cooldownValues.get(5)));
skillsDATS.put(AbilityType.SKULL_SPLIITER, Integer.valueOf(cooldownValues.get(6)));
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(cooldownValues.get(7)));
}
HashMap<Integer, ArrayList<String>> stats = database.read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM " + tablePrefix + "skills WHERE user_id = " + userId);
ArrayList<String> statValues = stats.get(1);
if (statValues == null) {
database.write("INSERT INTO " + tablePrefix + "skills (user_id) VALUES (" + userId + ")");
mcMMO.p.getLogger().warning(playerName + "does not exist in the skills table. Their stats will be reset.");
}
else {
skills.put(SkillType.TAMING, Integer.valueOf(statValues.get(0)));
skills.put(SkillType.MINING, Integer.valueOf(statValues.get(1)));
skills.put(SkillType.REPAIR, Integer.valueOf(statValues.get(2)));
skills.put(SkillType.WOODCUTTING, Integer.valueOf(statValues.get(3)));
skills.put(SkillType.UNARMED, Integer.valueOf(statValues.get(4)));
skills.put(SkillType.HERBALISM, Integer.valueOf(statValues.get(5)));
skills.put(SkillType.EXCAVATION, Integer.valueOf(statValues.get(6)));
skills.put(SkillType.ARCHERY, Integer.valueOf(statValues.get(7)));
skills.put(SkillType.SWORDS, Integer.valueOf(statValues.get(8)));
skills.put(SkillType.AXES, Integer.valueOf(statValues.get(9)));
skills.put(SkillType.ACROBATICS, Integer.valueOf(statValues.get(10)));
skills.put(SkillType.FISHING, Integer.valueOf(statValues.get(11)));
}
HashMap<Integer, ArrayList<String>> experience = database.read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM " + tablePrefix + "experience WHERE user_id = " + userId);
ArrayList<String> experienceValues = experience.get(1);
if (experienceValues == null) {
database.write("INSERT INTO " + tablePrefix + "experience (user_id) VALUES (" + userId + ")");
mcMMO.p.getLogger().warning(playerName + "does not exist in the experience table. Their experience will be reset.");
}
else {
skillsXp.put(SkillType.TAMING, Integer.valueOf(experienceValues.get(0)));
skillsXp.put(SkillType.MINING, Integer.valueOf(experienceValues.get(1)));
skillsXp.put(SkillType.REPAIR, Integer.valueOf(experienceValues.get(2)));
skillsXp.put(SkillType.WOODCUTTING, Integer.valueOf(experienceValues.get(3)));
skillsXp.put(SkillType.UNARMED, Integer.valueOf(experienceValues.get(4)));
skillsXp.put(SkillType.HERBALISM, Integer.valueOf(experienceValues.get(5)));
skillsXp.put(SkillType.EXCAVATION, Integer.valueOf(experienceValues.get(6)));
skillsXp.put(SkillType.ARCHERY, Integer.valueOf(experienceValues.get(7)));
skillsXp.put(SkillType.SWORDS, Integer.valueOf(experienceValues.get(8)));
skillsXp.put(SkillType.AXES, Integer.valueOf(experienceValues.get(9)));
skillsXp.put(SkillType.ACROBATICS, Integer.valueOf(experienceValues.get(10)));
skillsXp.put(SkillType.FISHING, Integer.valueOf(experienceValues.get(11)));
}
loaded = true;
return true;
} }
/*
* I'm still learning MySQL, this is a fix for adding a new table
* its not pretty but it works
*/
HashMap<Integer, ArrayList<String>> cooldowns = database.read("SELECT mining, woodcutting, unarmed, herbalism, excavation, swords, axes, blast_mining FROM " + tablePrefix + "cooldowns WHERE user_id = " + userId);
ArrayList<String> cooldownValues = cooldowns.get(1);
if (cooldownValues == null) {
database.write("INSERT INTO " + tablePrefix + "cooldowns (user_id) VALUES (" + userId + ")");
mcMMO.p.getLogger().warning(playerName + "does not exist in the cooldown table. Their cooldowns will be reset.");
}
else {
skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(cooldownValues.get(0)));
skillsDATS.put(AbilityType.TREE_FELLER, Integer.valueOf(cooldownValues.get(1)));
skillsDATS.put(AbilityType.BERSERK, Integer.valueOf(cooldownValues.get(2)));
skillsDATS.put(AbilityType.GREEN_TERRA, Integer.valueOf(cooldownValues.get(3)));
skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(cooldownValues.get(4)));
skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(cooldownValues.get(5)));
skillsDATS.put(AbilityType.SKULL_SPLIITER, Integer.valueOf(cooldownValues.get(6)));
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(cooldownValues.get(7)));
}
HashMap<Integer, ArrayList<String>> stats = database.read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM " + tablePrefix + "skills WHERE user_id = " + userId);
ArrayList<String> statValues = stats.get(1);
if (statValues == null) {
database.write("INSERT INTO " + tablePrefix + "skills (user_id) VALUES (" + userId + ")");
mcMMO.p.getLogger().warning(playerName + "does not exist in the skills table. Their stats will be reset.");
}
else {
skills.put(SkillType.TAMING, Integer.valueOf(statValues.get(0)));
skills.put(SkillType.MINING, Integer.valueOf(statValues.get(1)));
skills.put(SkillType.REPAIR, Integer.valueOf(statValues.get(2)));
skills.put(SkillType.WOODCUTTING, Integer.valueOf(statValues.get(3)));
skills.put(SkillType.UNARMED, Integer.valueOf(statValues.get(4)));
skills.put(SkillType.HERBALISM, Integer.valueOf(statValues.get(5)));
skills.put(SkillType.EXCAVATION, Integer.valueOf(statValues.get(6)));
skills.put(SkillType.ARCHERY, Integer.valueOf(statValues.get(7)));
skills.put(SkillType.SWORDS, Integer.valueOf(statValues.get(8)));
skills.put(SkillType.AXES, Integer.valueOf(statValues.get(9)));
skills.put(SkillType.ACROBATICS, Integer.valueOf(statValues.get(10)));
skills.put(SkillType.FISHING, Integer.valueOf(statValues.get(11)));
}
HashMap<Integer, ArrayList<String>> experience = database.read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM " + tablePrefix + "experience WHERE user_id = " + userId);
ArrayList<String> experienceValues = experience.get(1);
if (experienceValues == null) {
database.write("INSERT INTO " + tablePrefix + "experience (user_id) VALUES (" + userId + ")");
mcMMO.p.getLogger().warning(playerName + "does not exist in the experience table. Their experience will be reset.");
}
else {
skillsXp.put(SkillType.TAMING, Integer.valueOf(experienceValues.get(0)));
skillsXp.put(SkillType.MINING, Integer.valueOf(experienceValues.get(1)));
skillsXp.put(SkillType.REPAIR, Integer.valueOf(experienceValues.get(2)));
skillsXp.put(SkillType.WOODCUTTING, Integer.valueOf(experienceValues.get(3)));
skillsXp.put(SkillType.UNARMED, Integer.valueOf(experienceValues.get(4)));
skillsXp.put(SkillType.HERBALISM, Integer.valueOf(experienceValues.get(5)));
skillsXp.put(SkillType.EXCAVATION, Integer.valueOf(experienceValues.get(6)));
skillsXp.put(SkillType.ARCHERY, Integer.valueOf(experienceValues.get(7)));
skillsXp.put(SkillType.SWORDS, Integer.valueOf(experienceValues.get(8)));
skillsXp.put(SkillType.AXES, Integer.valueOf(experienceValues.get(9)));
skillsXp.put(SkillType.ACROBATICS, Integer.valueOf(experienceValues.get(10)));
skillsXp.put(SkillType.FISHING, Integer.valueOf(experienceValues.get(11)));
}
loaded = true;
return true;
} }
public void addMySQLPlayer() { public void addMySQLPlayer() {
@ -298,7 +297,7 @@ public class PlayerProfile {
public void save(boolean override) { public void save(boolean override) {
Long timestamp = System.currentTimeMillis(); Long timestamp = System.currentTimeMillis();
if(timestamp < (lastSave + ((long) Config.getInstance().getSaveInterval() * 60000)) && !override) if (timestamp < (lastSave + ((long) Config.getInstance().getSaveInterval() * 60000)) && !override)
return; return;
// if we are using mysql save to database // if we are using mysql save to database
@ -932,7 +931,7 @@ public class PlayerProfile {
skills.put(skillType, 0); skills.put(skillType, 0);
else //do them all else //do them all
{ {
for(SkillType skill : SkillType.values()) //iterate over all items in the enumeration for (SkillType skill : SkillType.values()) //iterate over all items in the enumeration
{ {
if (skill != SkillType.ALL) // skip the "all" value if (skill != SkillType.ALL) // skip the "all" value
skills.put(skill, 0); skills.put(skill, 0);
@ -1175,9 +1174,8 @@ public class PlayerProfile {
if (invite != null) { if (invite != null) {
return true; return true;
} }
else {
return false; return false;
}
} }
public void setParty(Party party) { public void setParty(Party party) {
@ -1193,9 +1191,8 @@ public class PlayerProfile {
if (party != null) { if (party != null) {
return true; return true;
} }
else {
return false; return false;
}
} }
public void removeParty() { public void removeParty() {

View File

@ -57,9 +57,8 @@ public enum SkillType {
if (maxLevel > 0) { if (maxLevel > 0) {
return maxLevel; return maxLevel;
} }
else {
return Integer.MAX_VALUE; return Integer.MAX_VALUE;
}
} }
public ToolType getTool() { public ToolType getTool() {

View File

@ -128,7 +128,7 @@ public class BlockListener implements Listener {
int id = block.getTypeId(); int id = block.getTypeId();
Material type = block.getType(); Material type = block.getType();
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
/* Code to prevent issues with placed falling Sand/Gravel not being tracked */ /* Code to prevent issues with placed falling Sand/Gravel not being tracked */
if (type.equals(Material.SAND) || type.equals(Material.GRAVEL)) { if (type.equals(Material.SAND) || type.equals(Material.GRAVEL)) {
@ -136,11 +136,10 @@ public class BlockListener implements Listener {
if (block.getRelative(0, y, 0).getType().equals(Material.AIR)) { if (block.getRelative(0, y, 0).getType().equals(Material.AIR)) {
continue; continue;
} }
else {
Block newLocation = block.getRelative(0, y + 1, 0); Block newLocation = block.getRelative(0, y + 1, 0);
mcMMO.placeStore.setTrue(newLocation); mcMMO.placeStore.setTrue(newLocation);
break; break;
}
} }
} }
@ -172,7 +171,7 @@ public class BlockListener implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
PlayerProfile profile = Users.getProfile(player); PlayerProfile profile = Users.getProfile(player);
@ -204,14 +203,14 @@ public class BlockListener implements Listener {
/* MINING */ /* MINING */
else if (BlockChecks.canBeSuperBroken(block) && Permissions.mining(player)) { else if (BlockChecks.canBeSuperBroken(block) && Permissions.mining(player)) {
MiningManager manager = new MiningManager(player); MiningManager miningManager = new MiningManager(player);
if (configInstance.getMiningRequiresTool()) { if (configInstance.getMiningRequiresTool()) {
if (ItemChecks.isPickaxe(inHand)) { if (ItemChecks.isPickaxe(inHand)) {
manager.miningBlockCheck(block); miningManager.miningBlockCheck(block);
} }
} }
else { else {
manager.miningBlockCheck(block); miningManager.miningBlockCheck(block);
} }
} }
@ -259,7 +258,7 @@ public class BlockListener implements Listener {
if ((relativeType == Material.SAND || relativeType == Material.GRAVEL) && mcMMO.placeStore.isTrue(relative)) { if ((relativeType == Material.SAND || relativeType == Material.GRAVEL) && mcMMO.placeStore.isTrue(relative)) {
mcMMO.placeStore.setFalse(relative); mcMMO.placeStore.setFalse(relative);
} }
else if (!BlockChecks.shouldBeWatched(relative) && mcMMO.placeStore.isTrue(relative)){ else if (!BlockChecks.shouldBeWatched(relative) && mcMMO.placeStore.isTrue(relative)) {
mcMMO.placeStore.setFalse(relative); mcMMO.placeStore.setFalse(relative);
} }
else { else {
@ -285,7 +284,7 @@ public class BlockListener implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
PlayerProfile profile = Users.getProfile(player); PlayerProfile profile = Users.getProfile(player);
@ -356,17 +355,17 @@ public class BlockListener implements Listener {
} }
} }
else if (profile.getAbilityMode(AbilityType.SUPER_BREAKER) && Skills.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) { else if (profile.getAbilityMode(AbilityType.SUPER_BREAKER) && Skills.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) {
MiningManager manager = new MiningManager(player); MiningManager miningManager = new MiningManager(player);
if (configInstance.getMiningRequiresTool()) { if (configInstance.getMiningRequiresTool()) {
if (ItemChecks.isPickaxe(inHand)) { if (ItemChecks.isPickaxe(inHand)) {
event.setInstaBreak(true); event.setInstaBreak(true);
manager.superBreakerBlockCheck(block); miningManager.superBreakerBlockCheck(block);
} }
} }
else { else {
event.setInstaBreak(true); event.setInstaBreak(true);
manager.superBreakerBlockCheck(block); miningManager.superBreakerBlockCheck(block);
} }
} }
else if (profile.getSkillLevel(SkillType.WOODCUTTING) >= LEAF_BLOWER_LEVEL && (material.equals(Material.LEAVES) || (configInstance.getBlockModsEnabled() && ModChecks.isCustomLeafBlock(block)))) { else if (profile.getSkillLevel(SkillType.WOODCUTTING) >= LEAF_BLOWER_LEVEL && (material.equals(Material.LEAVES) || (configInstance.getBlockModsEnabled() && ModChecks.isCustomLeafBlock(block)))) {

View File

@ -35,7 +35,7 @@ import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.BleedTimer; import com.gmail.nossr50.runnables.BleedTimer;
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager; import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
import com.gmail.nossr50.skills.archery.Archery; import com.gmail.nossr50.skills.archery.Archery;
import com.gmail.nossr50.skills.mining.BlastMining; import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.skills.taming.TamingManager; import com.gmail.nossr50.skills.taming.TamingManager;
import com.gmail.nossr50.util.Combat; import com.gmail.nossr50.util.Combat;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
@ -60,13 +60,13 @@ public class EntityListener implements Listener {
if (event instanceof FakeEntityDamageByEntityEvent) if (event instanceof FakeEntityDamageByEntityEvent)
return; return;
if(event.getDamage() <= 0) if (event.getDamage() <= 0)
return; return;
Entity attacker = event.getDamager(); Entity attacker = event.getDamager();
Entity defender = event.getEntity(); Entity defender = event.getEntity();
if(attacker.hasMetadata("NPC") || defender.hasMetadata("NPC")) return; // Check if either players is are Citizens NPCs if (attacker.hasMetadata("NPC") || defender.hasMetadata("NPC")) return; // Check if either players is are Citizens NPCs
if (attacker instanceof Projectile) { if (attacker instanceof Projectile) {
attacker = ((Projectile) attacker).getShooter(); attacker = ((Projectile) attacker).getShooter();
@ -118,7 +118,7 @@ public class EntityListener implements Listener {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
DamageCause cause = event.getCause(); DamageCause cause = event.getCause();
if(entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
if (!(entity instanceof LivingEntity)) { if (!(entity instanceof LivingEntity)) {
return; return;
@ -151,7 +151,8 @@ public class EntityListener implements Listener {
acroManager.rollCheck(event); acroManager.rollCheck(event);
} }
else if (cause == DamageCause.BLOCK_EXPLOSION && Permissions.demolitionsExpertise(player)) { else if (cause == DamageCause.BLOCK_EXPLOSION && Permissions.demolitionsExpertise(player)) {
BlastMining.demolitionsExpertise(player, event); MiningManager miningManager = new MiningManager(player);
miningManager.demolitionsExpertise(event);
} }
if (event.getDamage() >= 1) { if (event.getDamage() >= 1) {
@ -178,7 +179,7 @@ public class EntityListener implements Listener {
public void onEntityDeath(EntityDeathEvent event) { public void onEntityDeath(EntityDeathEvent event) {
LivingEntity entity = event.getEntity(); LivingEntity entity = event.getEntity();
if(entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
entity.setFireTicks(0); entity.setFireTicks(0);
BleedTimer.remove(entity); BleedTimer.remove(entity);
@ -210,7 +211,7 @@ public class EntityListener implements Listener {
public void onExplosionPrime(ExplosionPrimeEvent event) { public void onExplosionPrime(ExplosionPrimeEvent event) {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if(entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
if (entity instanceof TNTPrimed) { if (entity instanceof TNTPrimed) {
int id = entity.getEntityId(); int id = entity.getEntityId();
@ -219,7 +220,8 @@ public class EntityListener implements Listener {
Player player = plugin.getTNTPlayer(id); Player player = plugin.getTNTPlayer(id);
if (Permissions.biggerBombs(player)) { if (Permissions.biggerBombs(player)) {
BlastMining.biggerBombs(player, event); MiningManager miningManager = new MiningManager(player);
miningManager.biggerBombs(event);
} }
} }
} }
@ -234,16 +236,17 @@ public class EntityListener implements Listener {
public void onEnitityExplode(EntityExplodeEvent event) { public void onEnitityExplode(EntityExplodeEvent event) {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if(entity == null) return; if (entity == null) return;
if(entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
if (entity instanceof TNTPrimed) { if (entity instanceof TNTPrimed) {
int id = entity.getEntityId(); int id = entity.getEntityId();
if (plugin.tntIsTracked(id)) { if (plugin.tntIsTracked(id)) {
Player player = plugin.getTNTPlayer(id); Player player = plugin.getTNTPlayer(id);
BlastMining.dropProcessing(player, event); MiningManager miningManager = new MiningManager(player);
miningManager.blastMiningDropProcessing(event);
plugin.removeFromTNTTracker(id); plugin.removeFromTNTTracker(id);
} }
} }
@ -260,7 +263,7 @@ public class EntityListener implements Listener {
if (event.getEntity() instanceof Player) { if (event.getEntity() instanceof Player) {
Player player = (Player) event.getEntity(); Player player = (Player) event.getEntity();
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
PlayerProfile profile = Users.getProfile(player); PlayerProfile profile = Users.getProfile(player);
int currentFoodLevel = player.getFoodLevel(); int currentFoodLevel = player.getFoodLevel();
@ -396,7 +399,7 @@ public class EntityListener implements Listener {
public void onEntityTame(EntityTameEvent event) { public void onEntityTame(EntityTameEvent event) {
Player player = (Player) event.getOwner(); Player player = (Player) event.getOwner();
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
if (Permissions.taming(player) && !mcMMO.placeStore.isSpawnedPet(event.getEntity())) { if (Permissions.taming(player) && !mcMMO.placeStore.isSpawnedPet(event.getEntity())) {
PlayerProfile profile = Users.getProfile(player); PlayerProfile profile = Users.getProfile(player);

View File

@ -21,7 +21,7 @@ public class HardcoreListener implements Listener {
public void onPlayerDeath(PlayerDeathEvent event) { public void onPlayerDeath(PlayerDeathEvent event) {
Player player = event.getEntity(); //Note this returns a Player object for this subevent Player player = event.getEntity(); //Note this returns a Player object for this subevent
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
if (!Permissions.hardcoremodeBypass(player)) { if (!Permissions.hardcoremodeBypass(player)) {
if (player.getKiller() != null && Config.getInstance().getHardcoreVampirismEnabled()) { if (player.getKiller() != null && Config.getInstance().getHardcoreVampirismEnabled()) {

View File

@ -37,7 +37,7 @@ import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.runnables.BleedTimer; import com.gmail.nossr50.runnables.BleedTimer;
import com.gmail.nossr50.skills.gathering.Fishing; import com.gmail.nossr50.skills.gathering.Fishing;
import com.gmail.nossr50.skills.gathering.Herbalism; import com.gmail.nossr50.skills.gathering.Herbalism;
import com.gmail.nossr50.skills.mining.BlastMining; import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.skills.repair.Salvage; import com.gmail.nossr50.skills.repair.Salvage;
import com.gmail.nossr50.skills.taming.TamingManager; import com.gmail.nossr50.skills.taming.TamingManager;
import com.gmail.nossr50.util.BlockChecks; import com.gmail.nossr50.util.BlockChecks;
@ -63,7 +63,7 @@ public class PlayerListener implements Listener {
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) { public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
PlayerProfile profile = Users.getProfile(player); PlayerProfile profile = Users.getProfile(player);
@ -97,7 +97,7 @@ public class PlayerListener implements Listener {
int shakeUnlockLevel = advancedConfig.getShakeUnlockLevel(); int shakeUnlockLevel = advancedConfig.getShakeUnlockLevel();
Player player = event.getPlayer(); Player player = event.getPlayer();
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
if (Permissions.fishing(player)) { if (Permissions.fishing(player)) {
State state = event.getState(); State state = event.getState();
@ -131,7 +131,7 @@ public class PlayerListener implements Listener {
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)
public void onPlayerPickupItem(PlayerPickupItemEvent event) { public void onPlayerPickupItem(PlayerPickupItemEvent event) {
if(event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
PlayerProfile profile = Users.getProfile(event.getPlayer()); PlayerProfile profile = Users.getProfile(event.getPlayer());
@ -151,7 +151,7 @@ public class PlayerListener implements Listener {
*/ */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerLogin(PlayerLoginEvent event) { public void onPlayerLogin(PlayerLoginEvent event) {
if(event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
Users.addUser(event.getPlayer()).getProfile().actualizeRespawnATS(); Users.addUser(event.getPlayer()).getProfile().actualizeRespawnATS();
} }
@ -164,7 +164,7 @@ public class PlayerListener implements Listener {
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
/* GARBAGE COLLECTION */ /* GARBAGE COLLECTION */
@ -181,7 +181,7 @@ public class PlayerListener implements Listener {
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
//TODO: Locale ALL the things. //TODO: Locale ALL the things.
if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) { if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) {
@ -287,7 +287,7 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerRespawn(PlayerRespawnEvent event) { public void onPlayerRespawn(PlayerRespawnEvent event) {
if(event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
PlayerProfile profile = Users.getProfile(event.getPlayer()); PlayerProfile profile = Users.getProfile(event.getPlayer());
if (profile != null) { if (profile != null) {
@ -303,7 +303,7 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
Action action = event.getAction(); Action action = event.getAction();
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
ItemStack inHand = player.getItemInHand(); ItemStack inHand = player.getItemInHand();
@ -364,7 +364,8 @@ public class PlayerListener implements Listener {
/* BLAST MINING CHECK */ /* BLAST MINING CHECK */
if (player.isSneaking() && inHand.getTypeId() == Config.getInstance().getDetonatorItemID() && Permissions.blastMining(player)) { if (player.isSneaking() && inHand.getTypeId() == Config.getInstance().getDetonatorItemID() && Permissions.blastMining(player)) {
BlastMining.detonate(event, player, plugin); MiningManager miningManager = new MiningManager(player);
miningManager.detonate(event);
} }
break; break;
@ -387,7 +388,8 @@ public class PlayerListener implements Listener {
/* BLAST MINING CHECK */ /* BLAST MINING CHECK */
if (player.isSneaking() && inHand.getTypeId() == Config.getInstance().getDetonatorItemID() && Permissions.blastMining(player)) { if (player.isSneaking() && inHand.getTypeId() == Config.getInstance().getDetonatorItemID() && Permissions.blastMining(player)) {
BlastMining.detonate(event, player, plugin); MiningManager miningManager = new MiningManager(player);
miningManager.detonate(event);
} }
break; break;
@ -425,7 +427,7 @@ public class PlayerListener implements Listener {
public void onPlayerChat(AsyncPlayerChatEvent event) { public void onPlayerChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
PlayerProfile profile = Users.getProfile(player); PlayerProfile profile = Users.getProfile(player);

View File

@ -19,7 +19,7 @@ public class SelfListener implements Listener {
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) { public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
int xp = event.getXpGained(); int xp = event.getXpGained();
if(xp < 0) { if (xp < 0) {
try { try {
throw new Exception("Gained negative XP!"); throw new Exception("Gained negative XP!");
} }

View File

@ -20,11 +20,11 @@ public class WorldListener implements Listener {
@EventHandler @EventHandler
public void onWorldInit(WorldInitEvent event) { public void onWorldInit(WorldInitEvent event) {
File dataDir = new File(event.getWorld().getWorldFolder(), "mcmmo_data"); File dataDir = new File(event.getWorld().getWorldFolder(), "mcmmo_data");
if(!dataDir.exists()) { if (!dataDir.exists()) {
return; return;
} }
if(mcMMO.p == null) if (mcMMO.p == null)
return; return;
mcMMO.p.getLogger().info("Converting block storage for " + event.getWorld().getName() + " to a new format."); mcMMO.p.getLogger().info("Converting block storage for " + event.getWorld().getName() + " to a new format.");
@ -50,7 +50,7 @@ public class WorldListener implements Listener {
@EventHandler @EventHandler
public void onChunkLoad(ChunkLoadEvent event) { public void onChunkLoad(ChunkLoadEvent event) {
if(event.getChunk().getEntities().length > 0) if (event.getChunk().getEntities().length > 0)
mcMMO.placeStore.loadChunk(event.getChunk().getX(), event.getChunk().getZ(), event.getWorld()); mcMMO.placeStore.loadChunk(event.getChunk().getX(), event.getChunk().getZ(), event.getWorld());
} }
} }

View File

@ -146,7 +146,7 @@ public class mcMMO extends JavaPlugin {
repairManager.registerRepairables(repairables); repairManager.registerRepairables(repairables);
//Check if Repair Anvil and Salvage Anvil have different itemID's //Check if Repair Anvil and Salvage Anvil have different itemID's
if (configInstance.getSalvageAnvilId() == configInstance.getRepairAnvilId()){ if (configInstance.getSalvageAnvilId() == configInstance.getRepairAnvilId()) {
getLogger().warning("Can't use the same itemID for Repair/Salvage Anvils!"); getLogger().warning("Can't use the same itemID for Repair/Salvage Anvils!");
} }

View File

@ -224,7 +224,7 @@ public class PartyManager {
parties.add(party); parties.add(party);
} }
else if (!checkJoinability(player, playerProfile, party, password)) { else if (!checkJoinability(player, party, password)) {
return; return;
} }
@ -241,7 +241,7 @@ public class PartyManager {
* @param password The password provided by the player * @param password The password provided by the player
* @return true if the player can join the party * @return true if the player can join the party
*/ */
public boolean checkJoinability(Player player, PlayerProfile playerProfile, Party party, String password) { public boolean checkJoinability(Player player, Party party, String password) {
//Don't care about passwords if it isn't locked //Don't care about passwords if it isn't locked
if (party.isLocked()) { if (party.isLocked()) {
String partyPassword = party.getPassword(); String partyPassword = party.getPassword();

View File

@ -33,8 +33,8 @@ public class ChunkletUnloader implements Runnable {
@Override @Override
public void run() { public void run() {
for (Iterator<Entry<Chunk, Integer>> it = unloadedChunks.entrySet().iterator() ; it.hasNext() ; ) { for (Iterator<Entry<Chunk, Integer>> unloadedChunkIterator = unloadedChunks.entrySet().iterator() ; unloadedChunkIterator.hasNext() ; ) {
Entry<Chunk, Integer> entry = it.next(); Entry<Chunk, Integer> entry = unloadedChunkIterator.next();
Chunk chunk = entry.getKey(); Chunk chunk = entry.getKey();
if (!chunk.isLoaded()) { if (!chunk.isLoaded()) {
@ -42,11 +42,11 @@ public class ChunkletUnloader implements Runnable {
//Chunklets are unloaded only if their chunk has been unloaded for minimumInactiveTime //Chunklets are unloaded only if their chunk has been unloaded for minimumInactiveTime
if (inactiveTime >= minimumInactiveTime) { if (inactiveTime >= minimumInactiveTime) {
if(mcMMO.placeStore == null) if (mcMMO.placeStore == null)
continue; continue;
mcMMO.placeStore.unloadChunk(chunk.getX(), chunk.getZ(), chunk.getWorld()); mcMMO.placeStore.unloadChunk(chunk.getX(), chunk.getZ(), chunk.getWorld());
it.remove(); unloadedChunkIterator.remove();
continue; continue;
} }
@ -54,7 +54,7 @@ public class ChunkletUnloader implements Runnable {
} }
else { else {
//Just remove the entry if the chunk has been reloaded. //Just remove the entry if the chunk has been reloaded.
it.remove(); unloadedChunkIterator.remove();
} }
} }
} }

View File

@ -23,7 +23,7 @@ public class GreenThumbTimer implements Runnable {
@Override @Override
public void run() { public void run() {
if(this.block.getType() != this.type) if (this.block.getType() != this.type)
this.block.setType(this.type); this.block.setType(this.type);
int skillLevel = this.profile.getSkillLevel(SkillType.HERBALISM); int skillLevel = this.profile.getSkillLevel(SkillType.HERBALISM);

View File

@ -25,7 +25,7 @@ public class BlockStoreConversionMain implements Runnable {
} }
public void start() { public void start() {
if(this.taskID >= 0) if (this.taskID >= 0)
return; return;
this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1); this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1);
@ -34,18 +34,18 @@ public class BlockStoreConversionMain implements Runnable {
@Override @Override
public void run() { public void run() {
if(!this.dataDir.exists()) { if (!this.dataDir.exists()) {
softStop(); softStop();
return; return;
} }
if(!this.dataDir.isDirectory()) { if (!this.dataDir.isDirectory()) {
this.dataDir.delete(); this.dataDir.delete();
softStop(); softStop();
return; return;
} }
if(this.dataDir.listFiles().length <= 0) { if (this.dataDir.listFiles().length <= 0) {
this.dataDir.delete(); this.dataDir.delete();
softStop(); softStop();
return; return;
@ -54,7 +54,7 @@ public class BlockStoreConversionMain implements Runnable {
this.xDirs = this.dataDir.listFiles(); this.xDirs = this.dataDir.listFiles();
for (this.i = 0; (this.i < HiddenConfig.getInstance().getConversionRate()) && (this.i < this.xDirs.length); this.i++) { for (this.i = 0; (this.i < HiddenConfig.getInstance().getConversionRate()) && (this.i < this.xDirs.length); this.i++) {
if(this.converters[this.i] == null) if (this.converters[this.i] == null)
this.converters[this.i] = new BlockStoreConversionXDirectory(); this.converters[this.i] = new BlockStoreConversionXDirectory();
this.converters[this.i].start(this.world, this.xDirs[this.i]); this.converters[this.i].start(this.world, this.xDirs[this.i]);
@ -64,7 +64,7 @@ public class BlockStoreConversionMain implements Runnable {
} }
public void stop() { public void stop() {
if(this.taskID < 0) if (this.taskID < 0)
return; return;
this.scheduler.cancelTask(this.taskID); this.scheduler.cancelTask(this.taskID);
@ -74,7 +74,7 @@ public class BlockStoreConversionMain implements Runnable {
public void softStop() { public void softStop() {
stop(); stop();
if(this.dataDir.exists() || this.dataDir.isDirectory()) { if (this.dataDir.exists() || this.dataDir.isDirectory()) {
start(); start();
return; return;
} }

View File

@ -26,7 +26,7 @@ public class BlockStoreConversionXDirectory implements Runnable {
this.converters = new BlockStoreConversionZDirectory[HiddenConfig.getInstance().getConversionRate()]; this.converters = new BlockStoreConversionZDirectory[HiddenConfig.getInstance().getConversionRate()];
this.dataDir = dataDir; this.dataDir = dataDir;
if(this.taskID >= 0) if (this.taskID >= 0)
return; return;
this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1); this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1);
@ -35,18 +35,18 @@ public class BlockStoreConversionXDirectory implements Runnable {
@Override @Override
public void run() { public void run() {
if(!this.dataDir.exists()) { if (!this.dataDir.exists()) {
stop(); stop();
return; return;
} }
if(!this.dataDir.isDirectory()) { if (!this.dataDir.isDirectory()) {
this.dataDir.delete(); this.dataDir.delete();
stop(); stop();
return; return;
} }
if(this.dataDir.listFiles().length <= 0) { if (this.dataDir.listFiles().length <= 0) {
this.dataDir.delete(); this.dataDir.delete();
stop(); stop();
return; return;
@ -55,7 +55,7 @@ public class BlockStoreConversionXDirectory implements Runnable {
this.zDirs = this.dataDir.listFiles(); this.zDirs = this.dataDir.listFiles();
for (this.i = 0; (this.i < HiddenConfig.getInstance().getConversionRate()) && (this.i < this.zDirs.length); this.i++) { for (this.i = 0; (this.i < HiddenConfig.getInstance().getConversionRate()) && (this.i < this.zDirs.length); this.i++) {
if(this.converters[this.i] == null) if (this.converters[this.i] == null)
this.converters[this.i] = new BlockStoreConversionZDirectory(); this.converters[this.i] = new BlockStoreConversionZDirectory();
this.converters[this.i].start(this.world, this.dataDir, this.zDirs[this.i]); this.converters[this.i].start(this.world, this.dataDir, this.zDirs[this.i]);
@ -65,7 +65,7 @@ public class BlockStoreConversionXDirectory implements Runnable {
} }
public void stop() { public void stop() {
if(this.taskID < 0) if (this.taskID < 0)
return; return;
this.scheduler.cancelTask(this.taskID); this.scheduler.cancelTask(this.taskID);

View File

@ -40,7 +40,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
this.dataDir = dataDir; this.dataDir = dataDir;
this.xDir = xDir; this.xDir = xDir;
if(this.taskID >= 0) if (this.taskID >= 0)
return; return;
this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1); this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1);
@ -49,18 +49,18 @@ public class BlockStoreConversionZDirectory implements Runnable {
@Override @Override
public void run() { public void run() {
if(!this.dataDir.exists()) { if (!this.dataDir.exists()) {
stop(); stop();
return; return;
} }
if(!this.dataDir.isDirectory()) { if (!this.dataDir.isDirectory()) {
this.dataDir.delete(); this.dataDir.delete();
stop(); stop();
return; return;
} }
if(this.dataDir.listFiles().length <= 0) { if (this.dataDir.listFiles().length <= 0) {
this.dataDir.delete(); this.dataDir.delete();
stop(); stop();
return; return;
@ -83,61 +83,65 @@ public class BlockStoreConversionZDirectory implements Runnable {
this.manager.loadChunk(this.cx, this.cz, this.world); this.manager.loadChunk(this.cx, this.cz, this.world);
for(this.y = 0; this.y < (this.world.getMaxHeight() / 64); this.y++) { for (this.y = 0; this.y < (this.world.getMaxHeight() / 64); this.y++) {
this.chunkletName = this.world.getName() + "," + this.cx + "," + this.cz + "," + this.y; this.chunkletName = this.world.getName() + "," + this.cx + "," + this.cz + "," + this.y;
this.tempChunklet = this.manager.store.get(this.chunkletName); this.tempChunklet = this.manager.store.get(this.chunkletName);
if(this.tempChunklet instanceof PrimitiveChunkletStore)
if (this.tempChunklet instanceof PrimitiveChunkletStore) {
this.primitiveChunklet = (PrimitiveChunkletStore) this.tempChunklet; this.primitiveChunklet = (PrimitiveChunkletStore) this.tempChunklet;
else if(this.tempChunklet instanceof PrimitiveExChunkletStore) }
else if (this.tempChunklet instanceof PrimitiveExChunkletStore) {
this.primitiveExChunklet = (PrimitiveExChunkletStore) this.tempChunklet; this.primitiveExChunklet = (PrimitiveExChunkletStore) this.tempChunklet;
if(this.tempChunklet == null) { }
if (this.tempChunklet == null) {
continue; continue;
} else { }
this.chunkName = this.world.getName() + "," + this.cx + "," + this.cz;
this.currentChunk = (PrimitiveChunkStore) this.newManager.store.get(this.chunkName);
if(this.currentChunk != null) { this.chunkName = this.world.getName() + "," + this.cx + "," + this.cz;
this.xPos = this.cx * 16; this.currentChunk = (PrimitiveChunkStore) this.newManager.store.get(this.chunkName);
this.zPos = this.cz * 16;
for(this.x = 0; this.x < 16; this.x++) { if (this.currentChunk != null) {
for(this.z = 0; this.z < 16; this.z++) { this.xPos = this.cx * 16;
this.cxPos = this.xPos + this.x; this.zPos = this.cz * 16;
this.czPos = this.zPos + this.z;
for(this.y2 = (64 * this.y); this.y2 < (64 * this.y + 64); this.y2++) { for (this.x = 0; this.x < 16; this.x++) {
try { for (this.z = 0; this.z < 16; this.z++) {
if(!this.manager.isTrue(this.cxPos, this.y2, this.czPos, this.world)) this.cxPos = this.xPos + this.x;
continue; this.czPos = this.zPos + this.z;
this.newManager.setTrue(this.cxPos, this.y2, this.czPos, this.world); for (this.y2 = (64 * this.y); this.y2 < (64 * this.y + 64); this.y2++) {
} try {
catch(Exception e) {} if (!this.manager.isTrue(this.cxPos, this.y2, this.czPos, this.world))
continue;
this.newManager.setTrue(this.cxPos, this.y2, this.czPos, this.world);
} }
catch(Exception e) {}
} }
} }
continue;
} }
continue;
}
this.newManager.setTrue(this.cx * 16, 0, this.cz * 16, this.world); this.newManager.setTrue(this.cx * 16, 0, this.cz * 16, this.world);
this.newManager.setFalse(this.cx * 16, 0, this.cz * 16, this.world); this.newManager.setFalse(this.cx * 16, 0, this.cz * 16, this.world);
this.currentChunk = (PrimitiveChunkStore) this.newManager.store.get(this.chunkName); this.currentChunk = (PrimitiveChunkStore) this.newManager.store.get(this.chunkName);
for(this.x = 0; this.x < 16; this.x++) { for (this.x = 0; this.x < 16; this.x++) {
for(this.z = 0; this.z < 16; this.z++) { for (this.z = 0; this.z < 16; this.z++) {
if(this.primitiveChunklet != null) if (this.primitiveChunklet != null)
this.oldArray = this.primitiveChunklet.store[x][z]; this.oldArray = this.primitiveChunklet.store[x][z];
if(this.primitiveExChunklet != null) if (this.primitiveExChunklet != null)
this.oldArray = this.primitiveExChunklet.store[x][z]; this.oldArray = this.primitiveExChunklet.store[x][z];
else else
return; return;
this.newArray = this.currentChunk.store[x][z]; this.newArray = this.currentChunk.store[x][z];
if(this.oldArray.length < 64) if (this.oldArray.length < 64)
return; return;
else if(this.newArray.length < ((this.y * 64) + 64)) else if (this.newArray.length < ((this.y * 64) + 64))
return; return;
System.arraycopy(this.oldArray, 0, this.newArray, (this.y * 64), 64); System.arraycopy(this.oldArray, 0, this.newArray, (this.y * 64), 64);
}
} }
} }
} }
@ -145,8 +149,8 @@ public class BlockStoreConversionZDirectory implements Runnable {
this.manager.unloadChunk(this.cx, this.cz, this.world); this.manager.unloadChunk(this.cx, this.cz, this.world);
this.newManager.unloadChunk(this.cx, this.cz, this.world); this.newManager.unloadChunk(this.cx, this.cz, this.world);
for(File yFile : dataDir.listFiles()) { for (File yFile : dataDir.listFiles()) {
if(!yFile.exists()) if (!yFile.exists())
continue; continue;
yFile.delete(); yFile.delete();
@ -156,7 +160,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
} }
public void stop() { public void stop() {
if(this.taskID < 0) if (this.taskID < 0)
return; return;
this.scheduler.cancelTask(taskID); this.scheduler.cancelTask(taskID);

View File

@ -0,0 +1,31 @@
package com.gmail.nossr50.skills;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.util.Users;
public abstract class SkillManager {
protected Player player;
protected PlayerProfile profile;
protected int skillLevel;
public SkillManager(Player player, SkillType skill) {
this.player = player;
this.profile = Users.getProfile(player);
this.skillLevel = profile.getSkillLevel(skill);
}
public Player getPlayer() {
return player;
}
public PlayerProfile getProfile() {
return profile;
}
public int getSkillLevel() {
return skillLevel;
}
}

View File

@ -1,12 +1,9 @@
package com.gmail.nossr50.skills.acrobatics; package com.gmail.nossr50.skills.acrobatics;
import java.util.Random;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
public class Acrobatics { public class Acrobatics {
private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private static Random random = new Random();
public static final int DODGE_MAX_CHANCE = advancedConfig.getDodgeChanceMax(); public static final int DODGE_MAX_CHANCE = advancedConfig.getDodgeChanceMax();
public static final int DODGE_MAX_BONUS_LEVEL = advancedConfig.getDodgeMaxBonusLevel(); public static final int DODGE_MAX_BONUS_LEVEL = advancedConfig.getDodgeMaxBonusLevel();
@ -19,8 +16,4 @@ public class Acrobatics {
public static final int ROLL_XP_MODIFIER = advancedConfig.getRollXPModifier(); public static final int ROLL_XP_MODIFIER = advancedConfig.getRollXPModifier();
public static final int FALL_XP_MODIFIER = advancedConfig.getFallXPModifier(); public static final int FALL_XP_MODIFIER = advancedConfig.getFallXPModifier();
protected static Random getRandom() {
return random;
}
} }

View File

@ -53,7 +53,7 @@ public abstract class AcrobaticsEventHandler {
* @return true if the damage is fatal, false otherwise * @return true if the damage is fatal, false otherwise
*/ */
protected boolean isFatal(int damage) { protected boolean isFatal(int damage) {
if (Misc.isCitizensNPC(player) || player.getHealth() - damage < 1) { if (Misc.isNPC(player) || player.getHealth() - damage < 1) {
return true; return true;
} }

View File

@ -4,23 +4,16 @@ import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class AcrobaticsManager { public class AcrobaticsManager extends SkillManager {
private static Config config = Config.getInstance(); private static Config config = Config.getInstance();
private Player player;
private PlayerProfile profile;
private int skillLevel;
public AcrobaticsManager (Player player) { public AcrobaticsManager (Player player) {
this.player = player; super(player, SkillType.ACROBATICS);
this.profile = Users.getProfile(player);
this.skillLevel = profile.getSkillLevel(SkillType.ACROBATICS);
} }
/** /**
@ -29,7 +22,7 @@ public class AcrobaticsManager {
* @param event The event to check * @param event The event to check
*/ */
public void rollCheck(EntityDamageEvent event) { public void rollCheck(EntityDamageEvent event) {
if (Misc.isCitizensNPC(player) || !Permissions.roll(player)) { if (Misc.isNPC(player) || !Permissions.roll(player)) {
return; return;
} }
@ -53,7 +46,7 @@ public class AcrobaticsManager {
chance = ((float) Acrobatics.ROLL_MAX_CHANCE / Acrobatics.ROLL_MAX_BONUS_LEVEL) * eventHandler.skillModifier; chance = ((float) Acrobatics.ROLL_MAX_CHANCE / Acrobatics.ROLL_MAX_BONUS_LEVEL) * eventHandler.skillModifier;
} }
if (chance > Acrobatics.getRandom().nextInt(randomChance) && !eventHandler.isFatal(eventHandler.modifiedDamage)) { if (chance > Misc.getRandom().nextInt(randomChance) && !eventHandler.isFatal(eventHandler.modifiedDamage)) {
eventHandler.modifyEventDamage(); eventHandler.modifyEventDamage();
eventHandler.sendAbilityMessage(); eventHandler.sendAbilityMessage();
eventHandler.processXPGain(eventHandler.damage * Acrobatics.ROLL_XP_MODIFIER); eventHandler.processXPGain(eventHandler.damage * Acrobatics.ROLL_XP_MODIFIER);
@ -69,7 +62,7 @@ public class AcrobaticsManager {
* @param event The event to check * @param event The event to check
*/ */
public void dodgeCheck(EntityDamageEvent event) { public void dodgeCheck(EntityDamageEvent event) {
if (Misc.isCitizensNPC(player) || !Permissions.dodge(player)) { if (Misc.isNPC(player) || !Permissions.dodge(player)) {
return; return;
} }
@ -82,22 +75,10 @@ public class AcrobaticsManager {
float chance = ((float) Acrobatics.DODGE_MAX_CHANCE / Acrobatics.DODGE_MAX_BONUS_LEVEL) * eventHandler.skillModifier; float chance = ((float) Acrobatics.DODGE_MAX_CHANCE / Acrobatics.DODGE_MAX_BONUS_LEVEL) * eventHandler.skillModifier;
if (chance > Acrobatics.getRandom().nextInt(randomChance) && !eventHandler.isFatal(eventHandler.modifiedDamage)) { if (chance > Misc.getRandom().nextInt(randomChance) && !eventHandler.isFatal(eventHandler.modifiedDamage)) {
eventHandler.modifyEventDamage(); eventHandler.modifyEventDamage();
eventHandler.sendAbilityMessage(); eventHandler.sendAbilityMessage();
eventHandler.processXPGain(eventHandler.damage * Acrobatics.DODGE_XP_MODIFIER); eventHandler.processXPGain(eventHandler.damage * Acrobatics.DODGE_XP_MODIFIER);
} }
} }
protected Player getPlayer() {
return player;
}
protected PlayerProfile getProfile() {
return profile;
}
protected int getSkillLevel() {
return skillLevel;
}
} }

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.skills.archery;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Random;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -14,7 +13,6 @@ import com.gmail.nossr50.util.Misc;
public class Archery { public class Archery {
private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private static Random random = new Random();
private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>(); private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
public static final int ARROW_TRACKING_MAX_BONUS_LEVEL = advancedConfig.getRetrieveMaxBonusLevel(); public static final int ARROW_TRACKING_MAX_BONUS_LEVEL = advancedConfig.getRetrieveMaxBonusLevel();
@ -66,8 +64,4 @@ public class Archery {
} }
} }
} }
protected static Random getRandom() {
return random;
}
} }

View File

@ -4,21 +4,14 @@ import org.bukkit.entity.LivingEntity;
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.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class ArcheryManager {
private Player player;
private PlayerProfile profile;
private int skillLevel;
public class ArcheryManager extends SkillManager {
public ArcheryManager (Player player) { public ArcheryManager (Player player) {
this.player = player; super(player, SkillType.ARCHERY);
this.profile = Users.getProfile(player);
this.skillLevel = profile.getSkillLevel(SkillType.ARCHERY);
} }
/** /**
@ -27,7 +20,7 @@ public class ArcheryManager {
* @param livingEntity Entity damaged by the arrow * @param livingEntity Entity damaged by the arrow
*/ */
public void trackArrows(LivingEntity livingEntity) { public void trackArrows(LivingEntity livingEntity) {
if (Misc.isCitizensNPC(player) || !Permissions.trackArrows(player)) { if (Misc.isNPC(player) || !Permissions.trackArrows(player)) {
return; return;
} }
@ -40,7 +33,7 @@ public class ArcheryManager {
float chance = ((float) Archery.ARROW_TRACKING_MAX_BONUS / Archery.ARROW_TRACKING_MAX_BONUS_LEVEL) * eventHandler.skillModifier; float chance = ((float) Archery.ARROW_TRACKING_MAX_BONUS / Archery.ARROW_TRACKING_MAX_BONUS_LEVEL) * eventHandler.skillModifier;
if (chance > Archery.getRandom().nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
eventHandler.addToTracker(); eventHandler.addToTracker();
} }
} }
@ -52,7 +45,7 @@ public class ArcheryManager {
* @param event The event to modify * @param event The event to modify
*/ */
public void dazeCheck(Player defender, EntityDamageEvent event) { public void dazeCheck(Player defender, EntityDamageEvent event) {
if (Misc.isCitizensNPC(player) || !Permissions.daze(player)) { if (Misc.isNPC(player) || !Permissions.daze(player)) {
return; return;
} }
@ -65,7 +58,7 @@ public class ArcheryManager {
float chance = ((float) Archery.DAZE_MAX_BONUS / Archery.DAZE_MAX_BONUS_LEVEL) * eventHandler.skillModifier; float chance = ((float) Archery.DAZE_MAX_BONUS / Archery.DAZE_MAX_BONUS_LEVEL) * eventHandler.skillModifier;
if (chance > Archery.getRandom().nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
eventHandler.handleDazeEffect(); eventHandler.handleDazeEffect();
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();
} }
@ -77,7 +70,7 @@ public class ArcheryManager {
* @param event The event to modify. * @param event The event to modify.
*/ */
public void bonusDamage(EntityDamageEvent event) { public void bonusDamage(EntityDamageEvent event) {
if (Misc.isCitizensNPC(player) || !Permissions.archeryBonus(player)) { if (Misc.isNPC(player) || !Permissions.archeryBonus(player)) {
return; return;
} }
@ -88,12 +81,4 @@ public class ArcheryManager {
eventHandler.modifyEventDamage(); eventHandler.modifyEventDamage();
} }
} }
protected int getSkillLevel() {
return skillLevel;
}
protected Player getPlayer() {
return player;
}
} }

View File

@ -31,7 +31,7 @@ public class DazeEventHandler {
protected void handleDazeEffect() { protected void handleDazeEffect() {
Location location = defender.getLocation(); Location location = defender.getLocation();
if (Archery.getRandom().nextInt(100) > DAZE_CHANCE) { if (Misc.getRandom().nextInt(100) > DAZE_CHANCE) {
location.setPitch(90); location.setPitch(90);
} }
else { else {

View File

@ -0,0 +1,5 @@
package com.gmail.nossr50.skills.axes;
public class AxeManager {
}

View File

@ -1,6 +1,4 @@
package com.gmail.nossr50.skills.combat; package com.gmail.nossr50.skills.axes;
import java.util.Random;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.AnimalTamer; import org.bukkit.entity.AnimalTamer;
@ -24,8 +22,6 @@ import com.gmail.nossr50.util.Users;
public class Axes { public class Axes {
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private static Random random = new Random();
/** /**
* Apply bonus to damage done by axes. * Apply bonus to damage done by axes.
* *
@ -33,7 +29,7 @@ public class Axes {
* @param event The event to modify * @param event The event to modify
*/ */
public static void axesBonus(Player attacker, EntityDamageByEntityEvent event) { public static void axesBonus(Player attacker, EntityDamageByEntityEvent event) {
if(attacker == null) if (attacker == null)
return; return;
final int MAX_BONUS = advancedConfig.getBonusDamageAxesBonusMax(); final int MAX_BONUS = advancedConfig.getBonusDamageAxesBonusMax();
@ -57,7 +53,7 @@ public class Axes {
* @param event The event to modify * @param event The event to modify
*/ */
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event) { public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event) {
if(attacker == null) if (attacker == null)
return; return;
Entity entity = event.getEntity(); Entity entity = event.getEntity();
@ -95,10 +91,10 @@ public class Axes {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
if (chance > random.nextInt(randomChance) && !entity.isDead()){ if (chance > Misc.getRandom().nextInt(randomChance) && !entity.isDead()) {
int damage = event.getDamage(); int damage = event.getDamage();
if (entity instanceof Player){ if (entity instanceof Player) {
event.setDamage((int) (damage * PVP_MODIFIER)); event.setDamage((int) (damage * PVP_MODIFIER));
((Player) entity).sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck")); ((Player) entity).sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck"));
} }
@ -118,7 +114,7 @@ public class Axes {
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void impact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) { public static void impact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
if(attacker == null) if (attacker == null)
return; return;
/* /*
@ -140,12 +136,12 @@ public class Axes {
} }
else { else {
for (ItemStack armor : targetPlayer.getInventory().getArmorContents()) { for (ItemStack armor : targetPlayer.getInventory().getArmorContents()) {
if(Math.random() * 100 > 75) { if (Math.random() * 100 > 75) {
int lowerdamage = 0; int lowerdamage = 0;
for (int i = 0; i <= durabilityDamage; i ++) { for (int i = 0; i <= durabilityDamage; i ++) {
if (armor.containsEnchantment(Enchantment.DURABILITY)) { if (armor.containsEnchantment(Enchantment.DURABILITY)) {
int level = armor.getEnchantmentLevel(Enchantment.DURABILITY); int level = armor.getEnchantmentLevel(Enchantment.DURABILITY);
if (random.nextInt(level + 1) > 0) { if (Misc.getRandom().nextInt(level + 1) > 0) {
lowerdamage++; lowerdamage++;
} }
} }
@ -172,7 +168,7 @@ public class Axes {
* @param event The event to modify * @param event The event to modify
*/ */
private static void applyGreaterImpact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) { private static void applyGreaterImpact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
if(attacker == null) if (attacker == null)
return; return;
final int GREATER_IMPACT_CHANCE = advancedConfig.getGreaterImpactChance(); final int GREATER_IMPACT_CHANCE = advancedConfig.getGreaterImpactChance();
@ -189,7 +185,7 @@ public class Axes {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
if (random.nextInt(randomChance) <= GREATER_IMPACT_CHANCE) { if (Misc.getRandom().nextInt(randomChance) <= GREATER_IMPACT_CHANCE) {
event.setDamage(event.getDamage() + GREATER_IMPACT_DAMAGE); event.setDamage(event.getDamage() + GREATER_IMPACT_DAMAGE);
target.setVelocity(attacker.getLocation().getDirection().normalize().multiply(GREATER_IMPACT_MULTIPLIER)); target.setVelocity(attacker.getLocation().getDirection().normalize().multiply(GREATER_IMPACT_MULTIPLIER));
attacker.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc")); attacker.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc"));
@ -203,7 +199,7 @@ public class Axes {
* @return true if the player has armor, false otherwise * @return true if the player has armor, false otherwise
*/ */
private static boolean hasArmor(Player player) { private static boolean hasArmor(Player player) {
if(player == null) if (player == null)
return false; return false;
PlayerInventory inventory = player.getInventory(); PlayerInventory inventory = player.getInventory();
@ -211,8 +207,7 @@ public class Axes {
if (inventory.getBoots() != null || inventory.getChestplate() != null || inventory.getHelmet() != null || inventory.getLeggings() != null) { if (inventory.getBoots() != null || inventory.getChestplate() != null || inventory.getHelmet() != null || inventory.getLeggings() != null) {
return true; return true;
} }
else {
return false; return false;
}
} }
} }

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.skills.gathering;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -29,8 +28,6 @@ import com.gmail.nossr50.util.Users;
public class Excavation { public class Excavation {
private static Random random = new Random();
/** /**
* Check to see if treasures were found. * Check to see if treasures were found.
* *
@ -38,7 +35,7 @@ public class Excavation {
* @param player The player who broke the block * @param player The player who broke the block
*/ */
public static void excavationProcCheck(Block block, Player player) { public static void excavationProcCheck(Block block, Player player) {
if(player == null) if (player == null)
return; return;
Material type = block.getType(); Material type = block.getType();
@ -103,7 +100,7 @@ public class Excavation {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
if (random.nextDouble() * randomChance <= treasure.getDropChance()) { if (Misc.getRandom().nextDouble() * randomChance <= treasure.getDropChance()) {
xp += treasure.getXp(); xp += treasure.getXp();
is.add(treasure.getDrop()); is.add(treasure.getDrop());
} }
@ -128,7 +125,7 @@ public class Excavation {
* @param block The block to check * @param block The block to check
*/ */
public static void gigaDrillBreaker(Player player, Block block) { public static void gigaDrillBreaker(Player player, Block block) {
if(player == null) if (player == null)
return; return;
Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage()); Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage());

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.skills.gathering;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -38,8 +37,6 @@ import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
public class Fishing { public class Fishing {
private static Random random = new Random();
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
/** /**
@ -112,7 +109,7 @@ public class Fishing {
if (Config.getInstance().getFishingDropsEnabled() && rewards.size() > 0 if (Config.getInstance().getFishingDropsEnabled() && rewards.size() > 0
&& Permissions.fishingTreasures(player)) { && Permissions.fishingTreasures(player)) {
FishingTreasure treasure; FishingTreasure treasure;
treasure = rewards.get(random.nextInt(rewards.size())); treasure = rewards.get(Misc.getRandom().nextInt(rewards.size()));
int randomChance = 100; int randomChance = 100;
@ -120,7 +117,7 @@ public class Fishing {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
if (random.nextDouble() * randomChance <= treasure.getDropChance()) { if (Misc.getRandom().nextDouble() * randomChance <= treasure.getDropChance()) {
Users.getPlayer(player).addXP(SkillType.FISHING,treasure.getXp()); Users.getPlayer(player).addXP(SkillType.FISHING,treasure.getXp());
theCatch.setItemStack(treasure.getDrop()); theCatch.setItemStack(treasure.getDrop());
} }
@ -131,7 +128,7 @@ public class Fishing {
short maxDurability = theCatch.getItemStack().getType().getMaxDurability(); short maxDurability = theCatch.getItemStack().getType().getMaxDurability();
if (maxDurability > 0) { if (maxDurability > 0) {
theCatch.getItemStack().setDurability((short) (random.nextInt(maxDurability))); // Change durability to random value theCatch.getItemStack().setDurability((short) (Misc.getRandom().nextInt(maxDurability))); // Change durability to random value
} }
Skills.xpProcessing(player, profile, SkillType.FISHING, Config.getInstance().getFishingBaseXP()); Skills.xpProcessing(player, profile, SkillType.FISHING, Config.getInstance().getFishingBaseXP());
@ -167,7 +164,7 @@ public class Fishing {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
if (random.nextInt(randomChance) <= ENCHANTMENT_CHANCE if (Misc.getRandom().nextInt(randomChance) <= ENCHANTMENT_CHANCE
&& Permissions.fishingMagic(player)) { && Permissions.fishingMagic(player)) {
for (Enchantment newEnchant : Enchantment.values()) { for (Enchantment newEnchant : Enchantment.values()) {
if (newEnchant.canEnchantItem(fishingResults)) { if (newEnchant.canEnchantItem(fishingResults)) {
@ -182,9 +179,9 @@ public class Fishing {
* Actual chance to have an enchantment is related * Actual chance to have an enchantment is related
* to your fishing skill * to your fishing skill
*/ */
if (random.nextInt(15) < Fishing.getFishingLootTier(profile)) { if (Misc.getRandom().nextInt(15) < Fishing.getFishingLootTier(profile)) {
enchanted = true; enchanted = true;
int randomEnchantLevel = random.nextInt(newEnchant.getMaxLevel()) + 1; int randomEnchantLevel = Misc.getRandom().nextInt(newEnchant.getMaxLevel()) + 1;
if (randomEnchantLevel < newEnchant.getStartLevel()) { if (randomEnchantLevel < newEnchant.getStartLevel()) {
randomEnchantLevel = newEnchant.getStartLevel(); randomEnchantLevel = newEnchant.getStartLevel();
@ -230,8 +227,8 @@ public class Fishing {
dropChance = (int) (dropChance * 1.25); dropChance = (int) (dropChance * 1.25);
} }
final int DROP_CHANCE = random.nextInt(100); final int DROP_CHANCE = Misc.getRandom().nextInt(100);
final int DROP_NUMBER = random.nextInt(randomChance) + 1; final int DROP_NUMBER = Misc.getRandom().nextInt(randomChance) + 1;
LivingEntity le = (LivingEntity) event.getCaught(); LivingEntity le = (LivingEntity) event.getCaught();
EntityType type = le.getType(); EntityType type = le.getType();
@ -341,7 +338,7 @@ public class Fishing {
wool.setColor(sheep.getColor()); wool.setColor(sheep.getColor());
final ItemStack theWool = wool.toItemStack(); final ItemStack theWool = wool.toItemStack();
theWool.setAmount(1 + random.nextInt(6)); theWool.setAmount(1 + Misc.getRandom().nextInt(6));
Misc.dropItem(location, theWool); Misc.dropItem(location, theWool);
sheep.setSheared(true); sheep.setSheared(true);
@ -404,7 +401,7 @@ public class Fishing {
break; break;
case WITCH: case WITCH:
final int DROP_NUMBER_2 = random.nextInt(randomChance) + 1; final int DROP_NUMBER_2 = Misc.getRandom().nextInt(randomChance) + 1;
if (DROP_NUMBER > 95) { if (DROP_NUMBER > 95) {
if (DROP_NUMBER_2 > 66) { if (DROP_NUMBER_2 > 66) {
Misc.dropItem(location, new Potion(PotionType.INSTANT_HEAL).toItemStack(1)); Misc.dropItem(location, new Potion(PotionType.INSTANT_HEAL).toItemStack(1));

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.skills.gathering; package com.gmail.nossr50.skills.gathering;
import java.util.Random;
import org.bukkit.CropState; import org.bukkit.CropState;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -30,8 +28,6 @@ import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
public class Herbalism { public class Herbalism {
private static Random random = new Random();
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
/** /**
@ -84,7 +80,7 @@ public class Herbalism {
* @param plugin mcMMO plugin instance * @param plugin mcMMO plugin instance
*/ */
public static void herbalismProcCheck(final Block block, Player player, BlockBreakEvent event, mcMMO plugin) { public static void herbalismProcCheck(final Block block, Player player, BlockBreakEvent event, mcMMO plugin) {
if(player == null) if (player == null)
return; return;
final PlayerProfile profile = Users.getProfile(player); final PlayerProfile profile = Users.getProfile(player);
@ -129,7 +125,7 @@ public class Herbalism {
if (b.getType().equals(Material.CACTUS)) { if (b.getType().equals(Material.CACTUS)) {
mat = Material.CACTUS; mat = Material.CACTUS;
if (!mcMMO.placeStore.isTrue(b)) { if (!mcMMO.placeStore.isTrue(b)) {
if (chance > random.nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
catciDrops++; catciDrops++;
} }
xp += Config.getInstance().getHerbalismXPCactus(); xp += Config.getInstance().getHerbalismXPCactus();
@ -189,7 +185,7 @@ public class Herbalism {
if (b.getType().equals(Material.SUGAR_CANE_BLOCK)) { if (b.getType().equals(Material.SUGAR_CANE_BLOCK)) {
mat = Material.SUGAR_CANE; mat = Material.SUGAR_CANE;
if (!mcMMO.placeStore.isTrue(b)) { if (!mcMMO.placeStore.isTrue(b)) {
if (chance > random.nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
caneDrops++; caneDrops++;
} }
xp += Config.getInstance().getHerbalismXPSugarCane(); xp += Config.getInstance().getHerbalismXPSugarCane();
@ -287,7 +283,7 @@ public class Herbalism {
} }
} }
if (chance > random.nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
Config configInstance = Config.getInstance(); Config configInstance = Config.getInstance();
switch (type) { switch (type) {
@ -396,7 +392,7 @@ public class Herbalism {
} }
} }
if(Config.getInstance().getHerbalismAFKDisabled() && player.isInsideVehicle()) if (Config.getInstance().getHerbalismAFKDisabled() && player.isInsideVehicle())
return; return;
Skills.xpProcessing(player, profile, SkillType.HERBALISM, xp); Skills.xpProcessing(player, profile, SkillType.HERBALISM, xp);
@ -456,7 +452,7 @@ public class Herbalism {
float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * herbLevel); float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * herbLevel);
if (chance > MAX_CHANCE) chance = (float) MAX_CHANCE; if (chance > MAX_CHANCE) chance = (float) MAX_CHANCE;
if (hasSeeds && profile.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (chance > random.nextInt(randomChance))) { if (hasSeeds && profile.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (chance > Misc.getRandom().nextInt(randomChance))) {
event.setCancelled(true); event.setCancelled(true);
switch(type) { switch(type) {
@ -526,7 +522,7 @@ public class Herbalism {
float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * skillLevel); float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * skillLevel);
if (chance > MAX_CHANCE) chance = (float) MAX_CHANCE; if (chance > MAX_CHANCE) chance = (float) MAX_CHANCE;
if (chance > random.nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
greenTerraConvert(player, block); greenTerraConvert(player, block);
} }
else { else {

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.skills.gathering; package com.gmail.nossr50.skills.gathering;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -35,7 +34,6 @@ import com.gmail.nossr50.util.Users;
public class WoodCutting { public class WoodCutting {
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private static Random random = new Random();
/** /**
* Handle the Tree Feller ability. * Handle the Tree Feller ability.
@ -82,7 +80,7 @@ public class WoodCutting {
int health = player.getHealth(); int health = player.getHealth();
if (health >= 2) { if (health >= 2) {
Combat.dealDamage(player, random.nextInt(health - 1)); Combat.dealDamage(player, Misc.getRandom().nextInt(health - 1));
} }
inHand.setDurability(inHand.getType().getMaxDurability()); inHand.setDurability(inHand.getType().getMaxDurability());
return; return;
@ -94,7 +92,7 @@ public class WoodCutting {
int health = player.getHealth(); int health = player.getHealth();
if (health >= 2) { if (health >= 2) {
Combat.dealDamage(player, random.nextInt(health - 1)); Combat.dealDamage(player, Misc.getRandom().nextInt(health - 1));
} }
inHand.setDurability(inHand.getType().getMaxDurability()); inHand.setDurability(inHand.getType().getMaxDurability());
return; return;
@ -275,13 +273,13 @@ public class WoodCutting {
byte data = currentBlock.getData(); byte data = currentBlock.getData();
if((data & 0x4) == 0x4) if ((data & 0x4) == 0x4)
data ^= 0x4; data ^= 0x4;
if((data & 0x8) == 0x8) if ((data & 0x8) == 0x8)
data ^= 0x8; data ^= 0x8;
if(TreeSpecies.getByData(data) == TreeSpecies.JUNGLE) { if (TreeSpecies.getByData(data) == TreeSpecies.JUNGLE) {
Block corner1 = currentBlock.getRelative(1, 0, 1); Block corner1 = currentBlock.getRelative(1, 0, 1);
Block corner2 = currentBlock.getRelative(1, 0, -1); Block corner2 = currentBlock.getRelative(1, 0, -1);
Block corner3 = currentBlock.getRelative(-1, 0, 1); Block corner3 = currentBlock.getRelative(-1, 0, 1);
@ -307,7 +305,7 @@ public class WoodCutting {
} }
if (BlockChecks.treeFellerCompatible(yPositive)) { if (BlockChecks.treeFellerCompatible(yPositive)) {
if(!mcMMO.placeStore.isTrue(currentBlock) && !toBeFelled.contains(yPositive)) { if (!mcMMO.placeStore.isTrue(currentBlock) && !toBeFelled.contains(yPositive)) {
processTreeFelling(yPositive, toBeFelled); processTreeFelling(yPositive, toBeFelled);
} }
} }
@ -327,9 +325,8 @@ public class WoodCutting {
if ((currentType.equals(Material.LEAVES) || currentType.equals(Material.AIR) || (Config.getInstance().getBlockModsEnabled() && ModChecks.isCustomLeafBlock(currentBlock))) && (newType.equals(Material.LEAVES) || newType.equals(Material.AIR) || (Config.getInstance().getBlockModsEnabled() && ModChecks.isCustomLeafBlock(currentBlock)))) { if ((currentType.equals(Material.LEAVES) || currentType.equals(Material.AIR) || (Config.getInstance().getBlockModsEnabled() && ModChecks.isCustomLeafBlock(currentBlock))) && (newType.equals(Material.LEAVES) || newType.equals(Material.AIR) || (Config.getInstance().getBlockModsEnabled() && ModChecks.isCustomLeafBlock(currentBlock)))) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -346,10 +343,10 @@ public class WoodCutting {
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.WOODCUTTING); int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.WOODCUTTING);
byte type = block.getData(); byte type = block.getData();
if((type & 0x4) == 0x4) if ((type & 0x4) == 0x4)
type ^= 0x4; type ^= 0x4;
if((type & 0x8) == 0x8) if ((type & 0x8) == 0x8)
type ^= 0x8; type ^= 0x8;
Material mat = Material.getMaterial(block.getTypeId()); Material mat = Material.getMaterial(block.getTypeId());
@ -362,7 +359,7 @@ public class WoodCutting {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
if (chance > random.nextInt(randomChance) && Permissions.woodcuttingDoubleDrops(player)) { if (chance > Misc.getRandom().nextInt(randomChance) && Permissions.woodcuttingDoubleDrops(player)) {
Config configInstance = Config.getInstance(); Config configInstance = Config.getInstance();
ItemStack item; ItemStack item;
Location location; Location location;
@ -443,17 +440,17 @@ public class WoodCutting {
else { else {
byte type = block.getData(); byte type = block.getData();
if((type & 0x4) == 0x4) if ((type & 0x4) == 0x4)
type ^= 0x4; type ^= 0x4;
if((type & 0x8) == 0x8) if ((type & 0x8) == 0x8)
type ^= 0x8; type ^= 0x8;
TreeSpecies species = TreeSpecies.getByData(type); TreeSpecies species = TreeSpecies.getByData(type);
//Apparently species can be null in certain cases (custom server mods?) //Apparently species can be null in certain cases (custom server mods?)
//https://github.com/mcMMO-Dev/mcMMO/issues/229 //https://github.com/mcMMO-Dev/mcMMO/issues/229
if(species == null) if (species == null)
return; return;
switch (species) { switch (species) {
@ -504,7 +501,7 @@ public class WoodCutting {
private static int durabilityLossCalulate(ArrayList<Block> toBeFelled, int level) { private static int durabilityLossCalulate(ArrayList<Block> toBeFelled, int level) {
int durabilityLoss = 0; int durabilityLoss = 0;
for (Block x : toBeFelled) { for (Block x : toBeFelled) {
if (random.nextInt(level + 1) > 0) {}//Don't add durabilityLoss, because Unbreaking enchantment does it's work. if (Misc.getRandom().nextInt(level + 1) > 0) {}//Don't add durabilityLoss, because Unbreaking enchantment does it's work.
else if (x.getType().equals(Material.LOG) || (Config.getInstance().getBlockModsEnabled() && ModChecks.isCustomLogBlock(x))) { else if (x.getType().equals(Material.LOG) || (Config.getInstance().getBlockModsEnabled() && ModChecks.isCustomLogBlock(x))) {
durabilityLoss = durabilityLoss + Config.getInstance().getAbilityToolDamage(); durabilityLoss = durabilityLoss + Config.getInstance().getAbilityToolDamage();
} }

View File

@ -0,0 +1,42 @@
package com.gmail.nossr50.skills.mining;
import org.bukkit.event.entity.ExplosionPrimeEvent;
public class BiggerBombsEventHandler {
private int skillLevel;
private ExplosionPrimeEvent event;
private float radius;
private float radiusModifier;
protected BiggerBombsEventHandler(MiningManager manager, ExplosionPrimeEvent event) {
this.skillLevel = manager.getSkillLevel();
this.event = event;
this.radius = event.getRadius();
}
protected void calculateRadiusIncrease() {
if (skillLevel < BlastMining.BLAST_MINING_RANK_2) {
return;
}
if (skillLevel >= BlastMining.BLAST_MINING_RANK_8) {
radiusModifier = 4.0f;
}
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_6) {
radiusModifier = 3.0f;
}
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_4) {
radiusModifier = 2.0f;
}
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_2) {
radiusModifier = 1.0f;
}
}
protected void modifyBlastRadius() {
radius = radius + radiusModifier;
event.setRadius(radius);
}
}

View File

@ -1,336 +1,18 @@
package com.gmail.nossr50.skills.mining; package com.gmail.nossr50.skills.mining;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
public class BlastMining { public class BlastMining {
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private static Random random = new Random(); public final static int BLAST_MINING_RANK_1 = advancedConfig.getBlastMiningRank1();
public final static int BLAST_MINING_RANK_2 = advancedConfig.getBlastMiningRank2();
public final static int BLAST_MINING_RANK_3 = advancedConfig.getBlastMiningRank3();
public final static int BLAST_MINING_RANK_4 = advancedConfig.getBlastMiningRank4();
public final static int BLAST_MINING_RANK_5 = advancedConfig.getBlastMiningRank5();
public final static int BLAST_MINING_RANK_6 = advancedConfig.getBlastMiningRank6();
public final static int BLAST_MINING_RANK_7 = advancedConfig.getBlastMiningRank7();
public final static int BLAST_MINING_RANK_8 = advancedConfig.getBlastMiningRank8();
private static int blastMiningRank1 = advancedConfig.getBlastMiningRank1(); public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100;
private static int blastMiningRank2 = advancedConfig.getBlastMiningRank2();
private static int blastMiningRank3 = advancedConfig.getBlastMiningRank3();
private static int blastMiningRank4 = advancedConfig.getBlastMiningRank4();
private static int blastMiningRank5 = advancedConfig.getBlastMiningRank5();
private static int blastMiningRank6 = advancedConfig.getBlastMiningRank6();
private static int blastMiningRank7 = advancedConfig.getBlastMiningRank7();
private static int blastMiningRank8 = advancedConfig.getBlastMiningRank8();
/**
* Handler for what blocks drop from the explosion.
*
* @param ores List of ore blocks destroyed by the explosion
* @param debris List of non-ore blocks destroyed by the explosion
* @param yield Percentage of blocks to drop
* @param oreBonus Percentage bonus for ore drops
* @param debrisReduction Percentage reduction for non-ore drops
* @param extraDrops Number of times to drop each block
* @return A list of blocks dropped from the explosion
*/
private static List<Block> explosionYields(List<Block> ores, List<Block> debris, float yield, float oreBonus, float debrisReduction, int extraDrops) {
Iterator<Block> oresIterator = ores.iterator();
List<Block> blocksDropped = new ArrayList<Block>();
while (oresIterator.hasNext()) {
Block temp = oresIterator.next();
Location tempLocation = temp.getLocation();
Material tempType = temp.getType();
if (random.nextFloat() < (yield + oreBonus)) {
blocksDropped.add(temp);
Mining.miningDrops(temp, tempLocation, tempType);
if (!mcMMO.placeStore.isTrue(temp)) {
for (int i = 1 ; i < extraDrops ; i++) {
blocksDropped.add(temp);
Mining.miningDrops(temp, tempLocation, tempType);
}
}
}
}
if (yield - debrisReduction > 0) {
Iterator<Block> debrisIterator = debris.iterator();
while (debrisIterator.hasNext()) {
Block temp = debrisIterator.next();
Location tempLocation = temp.getLocation();
Material tempType = temp.getType();
if (random.nextFloat() < (yield - debrisReduction))
Mining.miningDrops(temp, tempLocation, tempType);
}
}
return blocksDropped;
}
/**
* Handler for explosion drops and XP gain.
*
* @param player Player triggering the explosion
* @param event Event whose explosion is being processed
*/
public static void dropProcessing(Player player, EntityExplodeEvent event) {
if(player == null)
return;
final int RANK_1_LEVEL = blastMiningRank1;
final int RANK_2_LEVEL = blastMiningRank2;
final int RANK_3_LEVEL = blastMiningRank3;
final int RANK_4_LEVEL = blastMiningRank4;
final int RANK_5_LEVEL = blastMiningRank5;
final int RANK_6_LEVEL = blastMiningRank6;
final int RANK_7_LEVEL = blastMiningRank7;
final int RANK_8_LEVEL = blastMiningRank8;
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);
float yield = event.getYield();
List<Block> blocks = event.blockList();
Iterator<Block> iterator = blocks.iterator();
List<Block> ores = new ArrayList<Block>();
List<Block> debris = new ArrayList<Block>();
List<Block> xp = new ArrayList<Block>();
while (iterator.hasNext()) {
Block temp = iterator.next();
if (BlockChecks.isOre(temp)) {
ores.add(temp);
}
else {
debris.add(temp);
}
}
//Normal explosion
if (skillLevel < RANK_1_LEVEL) {
return;
}
event.setYield(0);
//Triple Drops, No debris, +70% ores
if (skillLevel >= RANK_8_LEVEL) {
xp = explosionYields(ores, debris, yield, .70f, .30f, 3);
}
//Triple Drops, No debris, +65% ores
else if (skillLevel >= RANK_7_LEVEL) {
xp = explosionYields(ores, debris, yield, .65f, .30f, 3);
}
//Double Drops, No Debris, +60% ores
else if (skillLevel >= RANK_6_LEVEL) {
xp = explosionYields(ores, debris, yield, .60f, .30f, 2);
}
//Double Drops, No Debris, +55% ores
else if (skillLevel >= RANK_5_LEVEL) {
xp = explosionYields(ores, debris, yield, .55f, .30f, 2);
}
//No debris, +50% ores
else if (skillLevel >= RANK_4_LEVEL) {
xp = explosionYields(ores, debris, yield, .50f, .30f, 1);
}
//No debris, +45% ores
else if (skillLevel >= RANK_3_LEVEL) {
xp = explosionYields(ores, debris, yield, .45f, .30f, 1);
}
//+40% ores, -20% debris
else if (skillLevel >= RANK_2_LEVEL) {
xp = explosionYields(ores, debris, yield, .40f, .20f, 1);
}
//+35% ores, -10% debris
else if (skillLevel >= RANK_1_LEVEL) {
xp = explosionYields(ores, debris, yield, .35f, .10f, 1);
}
for (Block block : xp) {
if (!mcMMO.placeStore.isTrue(block)) {
Mining.miningXP(player, Users.getProfile(player), block, block.getType());
}
}
}
/**
* Increases the blast radius of the explosion.
*
* @param player Player triggering the explosion
* @param event Event whose explosion radius is being changed
*/
public static void biggerBombs(Player player, ExplosionPrimeEvent event) {
if(player == null)
return;
final int RANK_1_LEVEL = blastMiningRank2;
final int RANK_2_LEVEL = blastMiningRank4;
final int RANK_3_LEVEL = blastMiningRank6;
final int RANK_4_LEVEL = blastMiningRank8;
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);
float radius = event.getRadius();
if (skillLevel < RANK_1_LEVEL) {
return;
}
if (skillLevel >= RANK_1_LEVEL) {
radius++;
}
if (skillLevel >= RANK_2_LEVEL) {
radius++;
}
if (skillLevel >= RANK_3_LEVEL) {
radius++;
}
if (skillLevel >= RANK_4_LEVEL) {
radius++;
}
event.setRadius(radius);
}
/**
* Decreases damage dealt by the explosion.
*
* @param player Player triggering the explosion
* @param event Event whose explosion damage is being reduced
*/
public static void demolitionsExpertise(Player player, EntityDamageEvent event) {
if(player == null)
return;
final int RANK_1_LEVEL = blastMiningRank4;
final int RANK_2_LEVEL = blastMiningRank6;
final int RANK_3_LEVEL = blastMiningRank8;
int skill = Users.getProfile(player).getSkillLevel(SkillType.MINING);
int damage = event.getDamage();
if (skill < RANK_1_LEVEL) {
return;
}
if (skill >= RANK_3_LEVEL) {
damage = 0;
}
else if (skill >= RANK_2_LEVEL) {
damage = damage / 2;
}
else if (skill >= RANK_1_LEVEL) {
damage = damage/4;
}
event.setDamage(damage);
}
/**
* Detonate TNT for Blast Mining
*
* @param event The PlayerInteractEvent
* @param player Player detonating the TNT
* @param plugin mcMMO plugin instance
*/
public static void detonate(PlayerInteractEvent event, Player player, mcMMO plugin) {
if(player == null)
return;
PlayerProfile profile = Users.getProfile(player);
if (profile.getSkillLevel(SkillType.MINING) < 125)
return;
Block block = event.getClickedBlock();
if (block == null || block.getType() != Material.TNT) {
final byte SNOW = 78;
final byte AIR = 0;
final int BLOCKS_AWAY = 100;
HashSet<Byte> transparent = new HashSet<Byte>();
transparent.add(SNOW);
transparent.add(AIR);
block = player.getTargetBlock(transparent, BLOCKS_AWAY);
if (block.getType() != Material.TNT) {
return;
}
}
else if (block.getType() == Material.TNT) {
event.setCancelled(true); // This is the only way I know to avoid the original TNT to be triggered (in case the player is close to it)
}
if (!Misc.blockBreakSimulate(block, player, true)) {
return;
}
final double MAX_DISTANCE_AWAY = 10.0;
final int TIME_CONVERSION_FACTOR = 1000;
AbilityType ability = AbilityType.BLAST_MINING;
/* Check Cooldown */
if (!Skills.cooldownOver(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + Skills.calculateTimeLeft(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player) + "s)");
return;
}
/* Send message to nearby players */
for (Player y : player.getWorld().getPlayers()) {
if (y != player && Misc.isNear(player.getLocation(), y.getLocation(), MAX_DISTANCE_AWAY)) {
y.sendMessage(ability.getAbilityPlayer(player));
}
}
player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));
/* Create the TNT entity */
// TNTPrimed tnt = (TNTPrimed) player.getWorld().spawnEntity(block.getLocation(), EntityType.PRIMED_TNT);
TNTPrimed tnt = player.getWorld().spawn(block.getLocation(), TNTPrimed.class);
plugin.addToTNTTracker(tnt.getEntityId(), player.getName());
tnt.setFuseTicks(0);
/* Disable the original one */
block.setType(Material.AIR);
profile.setSkillDATS(ability, System.currentTimeMillis()); //Save DATS for Blast Mining
profile.setAbilityInformed(ability, false);
}
} }

View File

@ -0,0 +1,152 @@
package com.gmail.nossr50.skills.mining;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.Misc;
public class BlastMiningDropEventHandler {
private MiningManager manager;
private int skillLevel;
private EntityExplodeEvent event;
private float yield;
private List<Block> blocks;
private List<Block> ores;
private List<Block> debris;
private List<Block> droppedOres;
private float oreBonus;
private float debrisReduction;
private int dropMultiplier;
public BlastMiningDropEventHandler(MiningManager manager, EntityExplodeEvent event) {
this.manager = manager;
this.skillLevel = manager.getSkillLevel();
this.event = event;
this.yield = event.getYield();
this.blocks = event.blockList();
}
protected void sortExplosionBlocks() {
for (Block block : blocks) {
if (BlockChecks.isOre(block)) {
ores.add(block);
}
else {
debris.add(block);
}
}
}
protected void processXPGain() {
for (Block block : droppedOres) {
if (!mcMMO.placeStore.isTrue(block)) {
Mining.miningXP(manager.getPlayer(), manager.getProfile(), block, block.getType());
}
}
}
protected void processDroppedBlocks() {
for (Block block : ores) {
Location location = block.getLocation();
Material type = block.getType();
if (Misc.getRandom().nextFloat() < (yield + oreBonus)) {
droppedOres.add(block);
Mining.miningDrops(block, location, type);
if (!mcMMO.placeStore.isTrue(block)) {
for (int i = 1 ; i < dropMultiplier ; i++) {
droppedOres.add(block);
Mining.miningDrops(block, location, type);
}
}
}
}
float debrisYield = yield - debrisReduction;
if (debrisYield > 0) {
for (Block block : debris) {
Location location = block.getLocation();
Material type = block.getType();
if (Misc.getRandom().nextFloat() < debrisYield) {
Misc.dropItem(location, new ItemStack(type));
}
}
}
}
protected void modifyEventYield() {
event.setYield(0);
}
protected void calcuateDropModifiers() {
calculateOreBonus();
calculateDebrisReduction();
calculateDropMultiplier();
}
private void calculateOreBonus() {
if (skillLevel >= BlastMining.BLAST_MINING_RANK_8) {
oreBonus = .70f;
}
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_7) {
oreBonus = .65f;
}
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_6) {
oreBonus = .60f;
}
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_5) {
oreBonus = .55f;
}
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_4) {
oreBonus = .50f;
}
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_3) {
oreBonus = .45f;
}
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_2) {
oreBonus = .40f;
}
else {
debrisReduction = .35f;
}
}
private void calculateDebrisReduction() {
if (skillLevel >= BlastMining.BLAST_MINING_RANK_3) {
debrisReduction = .30f;
}
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_2) {
debrisReduction = .20f;
}
else {
debrisReduction = .10f;
}
}
private void calculateDropMultiplier() {
if (skillLevel >= BlastMining.BLAST_MINING_RANK_7) {
dropMultiplier = 3;
}
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_5) {
dropMultiplier = 2;
}
else {
dropMultiplier = 1;
}
}
}

View File

@ -0,0 +1,39 @@
package com.gmail.nossr50.skills.mining;
import org.bukkit.event.entity.EntityDamageEvent;
public class DemoltionsExpertiseEventHandler {
private int skillLevel;
private EntityDamageEvent event;
private int damage;
private double damageModifier;
public DemoltionsExpertiseEventHandler(MiningManager manager, EntityDamageEvent event) {
this.skillLevel = manager.getSkillLevel();
this.event = event;
this.damage = event.getDamage();
}
protected void calculateDamageModifier() {
if (skillLevel < BlastMining.BLAST_MINING_RANK_4) {
return;
}
if (skillLevel >= BlastMining.BLAST_MINING_RANK_8) {
damageModifier = 0;
}
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_6) {
damageModifier = 0.5;
}
else if (skillLevel >= BlastMining.BLAST_MINING_RANK_4) {
damageModifier = 0.25;
}
}
protected void modifyEventDamage() {
damage = (int) (damage * damageModifier);
event.setDamage(damage);
}
}

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.skills.mining; package com.gmail.nossr50.skills.mining;
import java.util.Random;
import org.bukkit.CoalType; import org.bukkit.CoalType;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -23,7 +21,6 @@ import com.gmail.nossr50.util.Skills;
public class Mining { public class Mining {
private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private static Config config = Config.getInstance(); private static Config config = Config.getInstance();
private static Random random = new Random();
public static final int DOUBLE_DROPS_MAX_BONUS_LEVEL = advancedConfig.getMiningDoubleDropMaxLevel(); public static final int DOUBLE_DROPS_MAX_BONUS_LEVEL = advancedConfig.getMiningDoubleDropMaxLevel();
public static final int DOUBLE_DROPS_MAX_CHANCE = advancedConfig.getMiningDoubleDropChance(); public static final int DOUBLE_DROPS_MAX_CHANCE = advancedConfig.getMiningDoubleDropChance();
@ -315,8 +312,4 @@ public class Mining {
break; break;
} }
} }
protected static Random getRandom() {
return random;
}
} }

View File

@ -29,7 +29,7 @@ public class MiningBlockEventHandler {
calculateSkillModifier(); calculateSkillModifier();
} }
protected void calculateSkillModifier() { private void calculateSkillModifier() {
this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Mining.DOUBLE_DROPS_MAX_BONUS_LEVEL); this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Mining.DOUBLE_DROPS_MAX_BONUS_LEVEL);
} }
@ -48,7 +48,7 @@ public class MiningBlockEventHandler {
} }
} }
protected void processXP() { protected void processXPGain() {
Mining.miningXP(player, manager.getProfile(), block, blockType); Mining.miningXP(player, manager.getProfile(), block, blockType);
} }
} }

View File

@ -1,25 +1,117 @@
package com.gmail.nossr50.skills.mining; package com.gmail.nossr50.skills.mining;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class MiningManager {
private Player player;
private PlayerProfile profile;
private int skillLevel;
public class MiningManager extends SkillManager{
public MiningManager (Player player) { public MiningManager (Player player) {
this.player = player; super(player, SkillType.MINING);
this.profile = Users.getProfile(player); }
this.skillLevel = profile.getSkillLevel(SkillType.MINING); /**
* Detonate TNT for Blast Mining
*
* @param event The PlayerInteractEvent
* @param player Player detonating the TNT
* @param plugin mcMMO plugin instance
*/
public void detonate(PlayerInteractEvent event) {
if (Misc.isNPC(player)) {
return;
}
if (skillLevel < BlastMining.BLAST_MINING_RANK_1) {
return;
}
RemoteDetonationEventHandler eventHandler = new RemoteDetonationEventHandler(this, event);
eventHandler.targetTNT();
if (eventHandler.block.getType() != Material.TNT) {
return;
}
if (!Misc.blockBreakSimulate(eventHandler.block, player, true)) {
return;
}
if (!eventHandler.cooldownOver()) {
return;
}
eventHandler.sendMessages();
eventHandler.handleDetonation();
eventHandler.setProfileData();
}
/**
* Handler for explosion drops and XP gain.
*
* @param event Event whose explosion is being processed
*/
public void blastMiningDropProcessing(EntityExplodeEvent event) {
if (Misc.isNPC(player)) {
return;
}
if (skillLevel < BlastMining.BLAST_MINING_RANK_1) {
return;
}
BlastMiningDropEventHandler eventHandler = new BlastMiningDropEventHandler(this, event);
eventHandler.sortExplosionBlocks();
eventHandler.modifyEventYield();
eventHandler.calcuateDropModifiers();
eventHandler.processDroppedBlocks();
eventHandler.processXPGain();
}
/**
* Decreases damage dealt by the explosion from TNT activated by Blast Mining.
*
* @param event Event whose explosion damage is being reduced
*/
public void demolitionsExpertise(EntityDamageEvent event) {
if (Misc.isNPC(player)) {
return;
}
DemoltionsExpertiseEventHandler eventHandler = new DemoltionsExpertiseEventHandler(this, event);
eventHandler.calculateDamageModifier();
eventHandler.modifyEventDamage();
}
/**
* Increases the blast radius of the explosion.
*
* @param player Player triggering the explosion
* @param event Event whose explosion radius is being changed
*/
public void biggerBombs(ExplosionPrimeEvent event) {
if (Misc.isNPC(player)) {
return;
}
BiggerBombsEventHandler eventHandler = new BiggerBombsEventHandler(this, event);
eventHandler.calculateRadiusIncrease();
eventHandler.modifyBlastRadius();
} }
/** /**
@ -34,7 +126,7 @@ public class MiningManager {
MiningBlockEventHandler eventHandler = new MiningBlockEventHandler(this, block); MiningBlockEventHandler eventHandler = new MiningBlockEventHandler(this, block);
eventHandler.processXP(); eventHandler.processXPGain();
if (!Permissions.miningDoubleDrops(player)) { if (!Permissions.miningDoubleDrops(player)) {
return; return;
@ -47,7 +139,7 @@ public class MiningManager {
float chance = ((float) Mining.DOUBLE_DROPS_MAX_CHANCE / Mining.DOUBLE_DROPS_MAX_BONUS_LEVEL) * eventHandler.skillModifier; float chance = ((float) Mining.DOUBLE_DROPS_MAX_CHANCE / Mining.DOUBLE_DROPS_MAX_BONUS_LEVEL) * eventHandler.skillModifier;
if (chance > Mining.getRandom().nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
eventHandler.processDrops(); eventHandler.processDrops();
} }
} }
@ -74,16 +166,4 @@ public class MiningManager {
eventHandler.processDropsAndXP(); eventHandler.processDropsAndXP();
eventHandler.playSpoutSound(); eventHandler.playSpoutSound();
} }
protected int getSkillLevel() {
return skillLevel;
}
protected Player getPlayer() {
return player;
}
protected PlayerProfile getProfile() {
return profile;
}
} }

View File

@ -0,0 +1,115 @@
package com.gmail.nossr50.skills.mining;
import java.util.HashSet;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.player.PlayerInteractEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Skills;
public class RemoteDetonationEventHandler {
private Player player;
private PlayerProfile profile;
private PlayerInteractEvent event;
protected Block block;
private HashSet<Byte> transparentBlocks = new HashSet<Byte>();
public RemoteDetonationEventHandler(MiningManager manager, PlayerInteractEvent event) {
this.player = manager.getPlayer();
this.profile = manager.getProfile();
this.event = event;
this.block = event.getClickedBlock();
}
protected void targetTNT() {
if (block == null || block.getType() != Material.TNT) {
generateTransparentBlockList();
block = player.getTargetBlock(transparentBlocks, BlastMining.MAXIMUM_REMOTE_DETONATION_DISTANCE);
}
else {
event.setCancelled(true); // This is the only way I know to avoid the original TNT to be triggered (in case the player is close to it)
}
}
protected boolean cooldownOver() {
if (!Skills.cooldownOver(profile.getSkillDATS(AbilityType.BLAST_MINING) * Misc.TIME_CONVERSION_FACTOR, AbilityType.BLAST_MINING.getCooldown(), player)) {
player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + Skills.calculateTimeLeft(profile.getSkillDATS(AbilityType.BLAST_MINING) * Misc.TIME_CONVERSION_FACTOR, AbilityType.BLAST_MINING.getCooldown(), player) + "s)");
return false;
}
return true;
}
protected void sendMessages() {
Misc.sendSkillMessage(player, AbilityType.BLAST_MINING.getAbilityPlayer(player));
player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));
}
protected void handleDetonation() {
TNTPrimed tnt = player.getWorld().spawn(block.getLocation(), TNTPrimed.class);
mcMMO.p.addToTNTTracker(tnt.getEntityId(), player.getName());
tnt.setFuseTicks(0);
block.setType(Material.AIR);
}
protected void setProfileData() {
profile.setSkillDATS(AbilityType.BLAST_MINING, System.currentTimeMillis());
profile.setAbilityInformed(AbilityType.BLAST_MINING, false);
}
private void generateTransparentBlockList() {
transparentBlocks.add((byte) Material.AIR.getId());
transparentBlocks.add((byte) Material.SAPLING.getId());
transparentBlocks.add((byte) Material.POWERED_RAIL.getId());
transparentBlocks.add((byte) Material.DETECTOR_RAIL.getId());
transparentBlocks.add((byte) Material.LONG_GRASS.getId());
transparentBlocks.add((byte) Material.DEAD_BUSH.getId());
transparentBlocks.add((byte) Material.YELLOW_FLOWER.getId());
transparentBlocks.add((byte) Material.RED_ROSE.getId());
transparentBlocks.add((byte) Material.BROWN_MUSHROOM.getId());
transparentBlocks.add((byte) Material.RED_MUSHROOM.getId());
transparentBlocks.add((byte) Material.TORCH.getId());
transparentBlocks.add((byte) Material.FIRE.getId());
transparentBlocks.add((byte) Material.REDSTONE_WIRE.getId());
transparentBlocks.add((byte) Material.CROPS.getId());
transparentBlocks.add((byte) Material.LADDER.getId());
transparentBlocks.add((byte) Material.RAILS.getId());
transparentBlocks.add((byte) Material.LEVER.getId());
transparentBlocks.add((byte) Material.REDSTONE_TORCH_OFF.getId());
transparentBlocks.add((byte) Material.REDSTONE_TORCH_ON.getId());
transparentBlocks.add((byte) Material.STONE_BUTTON.getId());
transparentBlocks.add((byte) Material.SNOW.getId());
transparentBlocks.add((byte) Material.SUGAR_CANE_BLOCK.getId());
transparentBlocks.add((byte) Material.PORTAL.getId());
transparentBlocks.add((byte) Material.DIODE_BLOCK_OFF.getId());
transparentBlocks.add((byte) Material.DIODE_BLOCK_ON.getId());
transparentBlocks.add((byte) Material.PUMPKIN_STEM.getId());
transparentBlocks.add((byte) Material.MELON_STEM.getId());
transparentBlocks.add((byte) Material.VINE.getId());
transparentBlocks.add((byte) Material.WATER_LILY.getId());
transparentBlocks.add((byte) Material.NETHER_WARTS.getId());
transparentBlocks.add((byte) Material.ENDER_PORTAL.getId());
transparentBlocks.add((byte) Material.COCOA.getId());
transparentBlocks.add((byte) Material.TRIPWIRE_HOOK.getId());
transparentBlocks.add((byte) Material.TRIPWIRE.getId());
transparentBlocks.add((byte) Material.FLOWER_POT.getId());
transparentBlocks.add((byte) Material.CARROT.getId());
transparentBlocks.add((byte) Material.POTATO.getId());
transparentBlocks.add((byte) Material.WOOD_BUTTON.getId());
transparentBlocks.add((byte) Material.SKULL.getId());
}
}

View File

@ -69,47 +69,45 @@ public class SuperBreakerEventHandler {
if (ModChecks.getCustomBlock(block).getTier() < tier) { if (ModChecks.getCustomBlock(block).getTier() < tier) {
return false; return false;
} }
else {
return true; return true;
}
} }
else {
switch (blockType) {
case OBSIDIAN:
if (tier < Mining.DIAMOND_TOOL_TIER) {
return false;
}
/* FALL THROUGH */
case DIAMOND_ORE: switch (blockType) {
case GLOWING_REDSTONE_ORE: case OBSIDIAN:
case GOLD_ORE: if (tier < Mining.DIAMOND_TOOL_TIER) {
case LAPIS_ORE:
case REDSTONE_ORE:
case EMERALD_ORE:
if (tier < Mining.IRON_TOOL_TIER) {
return false;
}
/* FALL THROUGH */
case IRON_ORE:
if (tier < Mining.STONE_TOOL_TIER) {
return false;
}
/* FALL THROUGH */
case COAL_ORE:
case ENDER_STONE:
case GLOWSTONE:
case MOSSY_COBBLESTONE:
case NETHERRACK:
case SANDSTONE:
case STONE:
return true;
default:
return false; return false;
} }
/* FALL THROUGH */
case DIAMOND_ORE:
case GLOWING_REDSTONE_ORE:
case GOLD_ORE:
case LAPIS_ORE:
case REDSTONE_ORE:
case EMERALD_ORE:
if (tier < Mining.IRON_TOOL_TIER) {
return false;
}
/* FALL THROUGH */
case IRON_ORE:
if (tier < Mining.STONE_TOOL_TIER) {
return false;
}
/* FALL THROUGH */
case COAL_ORE:
case ENDER_STONE:
case GLOWSTONE:
case MOSSY_COBBLESTONE:
case NETHERRACK:
case SANDSTONE:
case STONE:
return true;
default:
return false;
} }
} }

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.skills.repair;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Random;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@ -18,18 +17,17 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.spout.SpoutSounds; import com.gmail.nossr50.spout.SpoutSounds;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Skills; import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
public class Repair { public class Repair {
private static Random random = new Random();
private static Config configInstance = Config.getInstance(); private static Config configInstance = Config.getInstance();
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
public static final int REPAIR_MASTERY_CHANCE_MAX = advancedConfig.getRepairMasteryChanceMax(); public static final int REPAIR_MASTERY_CHANCE_MAX = advancedConfig.getRepairMasteryMaxBonus();
public static final int REPAIR_MASTERY_MAX_BONUS_LEVEL = advancedConfig.getRepairMasteryMaxLevel(); public static final int REPAIR_MASTERY_MAX_BONUS_LEVEL = advancedConfig.getRepairMasteryMaxLevel();
public static final int SUPER_REPAIR_CHANCE_MAX = advancedConfig.getSuperRepairChanceMax(); public static final int SUPER_REPAIR_CHANCE_MAX = advancedConfig.getSuperRepairChanceMax();
public static final int SUPER_REPAIR_MAX_BONUS_LEVEL = advancedConfig.getSuperRepairMaxLevel(); public static final int SUPER_REPAIR_MAX_BONUS_LEVEL = advancedConfig.getSuperRepairMaxLevel();
@ -90,7 +88,7 @@ public class Repair {
* @param is Item being repaired * @param is Item being repaired
*/ */
protected static void addEnchants(Player player, ItemStack is) { protected static void addEnchants(Player player, ItemStack is) {
if(Permissions.arcaneBypass(player)) { if (Permissions.arcaneBypass(player)) {
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Perfect")); player.sendMessage(LocaleLoader.getString("Repair.Arcane.Perfect"));
return; return;
} }
@ -121,11 +119,11 @@ public class Repair {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
if (random.nextInt(randomChance) <= getEnchantChance(rank)) { if (Misc.getRandom().nextInt(randomChance) <= getEnchantChance(rank)) {
int enchantLevel = enchant.getValue(); int enchantLevel = enchant.getValue();
if (configInstance.getArcaneForgingDowngradeEnabled() && enchantLevel > 1) { if (configInstance.getArcaneForgingDowngradeEnabled() && enchantLevel > 1) {
if (random.nextInt(randomChance) < getDowngradeChance(rank)) { if (Misc.getRandom().nextInt(randomChance) < getDowngradeChance(rank)) {
is.addEnchantment(enchantment, --enchantLevel); is.addEnchantment(enchantment, --enchantLevel);
downgraded = true; downgraded = true;
} }
@ -210,7 +208,7 @@ public class Repair {
*/ */
protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) { protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) {
float bonus; float bonus;
if(skillLevel >= REPAIR_MASTERY_MAX_BONUS_LEVEL) bonus = ((float) REPAIR_MASTERY_CHANCE_MAX / 100F); if (skillLevel >= REPAIR_MASTERY_MAX_BONUS_LEVEL) bonus = ((float) REPAIR_MASTERY_CHANCE_MAX / 100F);
else bonus = (((float) skillLevel) / ((float) REPAIR_MASTERY_MAX_BONUS_LEVEL)) * (((float) REPAIR_MASTERY_CHANCE_MAX) / 100F); else bonus = (((float) skillLevel) / ((float) REPAIR_MASTERY_MAX_BONUS_LEVEL)) * (((float) REPAIR_MASTERY_CHANCE_MAX) / 100F);
if (Permissions.repairMastery(player)) { if (Permissions.repairMastery(player)) {
@ -222,7 +220,7 @@ public class Repair {
repairAmount = (int) (repairAmount * 2D); repairAmount = (int) (repairAmount * 2D);
} }
if(repairAmount <= 0 || repairAmount > 32767) if (repairAmount <= 0 || repairAmount > 32767)
repairAmount = 32767; repairAmount = 32767;
durability -= repairAmount; durability -= repairAmount;
@ -249,7 +247,7 @@ public class Repair {
if (Permissions.luckyRepair(player)) randomChance = (int) (randomChance * 0.75); if (Permissions.luckyRepair(player)) randomChance = (int) (randomChance * 0.75);
if (chance > random.nextInt(randomChance) && Permissions.repairBonus(player)){ if (chance > Misc.getRandom().nextInt(randomChance) && Permissions.repairBonus(player)) {
player.sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy")); player.sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
return true; return true;
} }

View File

@ -27,7 +27,7 @@ public class Salvage {
return; return;
} }
if(player.getGameMode() == GameMode.SURVIVAL) { if (player.getGameMode() == GameMode.SURVIVAL) {
final PlayerProfile profile = Users.getProfile(player); final PlayerProfile profile = Users.getProfile(player);
final int skillLevel = profile.getSkillLevel(SkillType.REPAIR); final int skillLevel = profile.getSkillLevel(SkillType.REPAIR);
final int unlockLevel = configInstance.getSalvageUnlockLevel(); final int unlockLevel = configInstance.getSalvageUnlockLevel();

View File

@ -187,9 +187,8 @@ public class SimpleRepairManager implements RepairManager {
if (inventory.getItem(location).getTypeId() == itemId) { if (inventory.getItem(location).getTypeId() == itemId) {
return location; return location;
} }
else {
return -1; return -1;
}
} }
/** /**

View File

@ -24,7 +24,7 @@ public class CounterAttackEventHandler {
} }
protected boolean isHoldingSword() { protected boolean isHoldingSword() {
if(player == null) if (player == null)
return false; return false;
return ItemChecks.isSword(player.getItemInHand()); return ItemChecks.isSword(player.getItemInHand());
@ -39,7 +39,7 @@ public class CounterAttackEventHandler {
} }
protected void sendAbilityMessages() { protected void sendAbilityMessages() {
if(player == null) if (player == null)
return; return;
player.sendMessage(LocaleLoader.getString("Swords.Combat.Countered")); player.sendMessage(LocaleLoader.getString("Swords.Combat.Countered"));

View File

@ -19,7 +19,7 @@ public class SerratedStrikesEventHandler {
} }
protected void applyAbilityEffects() { protected void applyAbilityEffects() {
if(player == null) if (player == null)
return; return;
Combat.applyAbilityAoE(player, target, damage / Swords.SERRATED_STRIKES_MODIFIER, SkillType.SWORDS); Combat.applyAbilityAoE(player, target, damage / Swords.SERRATED_STRIKES_MODIFIER, SkillType.SWORDS);

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.skills.swords; package com.gmail.nossr50.skills.swords;
import java.util.Random;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
public class Swords { public class Swords {
@ -18,10 +16,4 @@ public class Swords {
public static final int SERRATED_STRIKES_MODIFIER = advancedConfig.getSerratedStrikesModifier(); public static final int SERRATED_STRIKES_MODIFIER = advancedConfig.getSerratedStrikesModifier();
public static final int SERRATED_STRIKES_BLEED_TICKS = advancedConfig.getSerratedStrikesTicks(); public static final int SERRATED_STRIKES_BLEED_TICKS = advancedConfig.getSerratedStrikesTicks();
private static Random random = new Random();
protected static Random getRandom() {
return random;
}
} }

View File

@ -3,21 +3,15 @@ package com.gmail.nossr50.skills.swords;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Combat; import com.gmail.nossr50.util.Combat;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class SwordsManager {
private Player player;
private PlayerProfile profile;
private int skillLevel;
public class SwordsManager extends SkillManager {
public SwordsManager (Player player) { public SwordsManager (Player player) {
this.player = player; super(player, SkillType.SWORDS);
this.profile = Users.getProfile(player);
this.skillLevel = profile.getSkillLevel(SkillType.SWORDS);
} }
/** /**
@ -26,7 +20,7 @@ public class SwordsManager {
* @param defender The defending entity * @param defender The defending entity
*/ */
public void bleedCheck(LivingEntity defender) { public void bleedCheck(LivingEntity defender) {
if(player == null) if (player == null)
return; return;
if (!Permissions.swordsBleed(player)) { if (!Permissions.swordsBleed(player)) {
@ -45,7 +39,7 @@ public class SwordsManager {
float chance = (float) (((double) Swords.BLEED_CHANCE_MAX / (double) Swords.BLEED_MAX_BONUS_LEVEL) * skillLevel); float chance = (float) (((double) Swords.BLEED_CHANCE_MAX / (double) Swords.BLEED_MAX_BONUS_LEVEL) * skillLevel);
if (chance > Swords.BLEED_CHANCE_MAX) chance = Swords.BLEED_CHANCE_MAX; if (chance > Swords.BLEED_CHANCE_MAX) chance = Swords.BLEED_CHANCE_MAX;
if (chance > Swords.getRandom().nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
eventHandler.addBleedTicks(); eventHandler.addBleedTicks();
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();
} }
@ -53,7 +47,7 @@ public class SwordsManager {
} }
public void counterAttackChecks(LivingEntity attacker, int damage) { public void counterAttackChecks(LivingEntity attacker, int damage) {
if(player == null) if (player == null)
return; return;
if (!Permissions.counterAttack(player)) { if (!Permissions.counterAttack(player)) {
@ -74,7 +68,7 @@ public class SwordsManager {
float chance = (float) (((double) Swords.COUNTER_ATTACK_CHANCE_MAX / (double) Swords.COUNTER_ATTACK_MAX_BONUS_LEVEL) * skillLevel); float chance = (float) (((double) Swords.COUNTER_ATTACK_CHANCE_MAX / (double) Swords.COUNTER_ATTACK_MAX_BONUS_LEVEL) * skillLevel);
if (chance > Swords.COUNTER_ATTACK_CHANCE_MAX) chance = Swords.COUNTER_ATTACK_CHANCE_MAX; if (chance > Swords.COUNTER_ATTACK_CHANCE_MAX) chance = Swords.COUNTER_ATTACK_CHANCE_MAX;
if (chance > Swords.getRandom().nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
eventHandler.dealDamage(); eventHandler.dealDamage();
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();
} }
@ -82,7 +76,7 @@ public class SwordsManager {
} }
public void serratedStrikes(LivingEntity target, int damage) { public void serratedStrikes(LivingEntity target, int damage) {
if(player == null) if (player == null)
return; return;
if (!Permissions.serratedStrikes(player)) { if (!Permissions.serratedStrikes(player)) {
@ -93,12 +87,4 @@ public class SwordsManager {
eventHandler.applyAbilityEffects(); eventHandler.applyAbilityEffects();
} }
protected int getSkillLevel() {
return skillLevel;
}
protected Player getPlayer() {
return player;
}
} }

View File

@ -19,7 +19,7 @@ public class BeastLoreEventHandler {
} }
protected void sendInspectMessage() { protected void sendInspectMessage() {
if(player == null) if (player == null)
return; return;
String message = LocaleLoader.getString("Combat.BeastLore") + " "; String message = LocaleLoader.getString("Combat.BeastLore") + " ";
@ -44,8 +44,7 @@ public class BeastLoreEventHandler {
if (tamer instanceof Player) { if (tamer instanceof Player) {
return ((Player) tamer).getName(); return ((Player) tamer).getName();
} }
else {
return "Offline Master"; return "Offline Master";
}
} }
} }

View File

@ -28,14 +28,14 @@ public class CallOfTheWildEventHandler {
} }
protected void sendInsufficientAmountMessage() { protected void sendInsufficientAmountMessage() {
if(player == null) if (player == null)
return; return;
player.sendMessage(LocaleLoader.getString("Skills.NeedMore") + " " + ChatColor.GRAY + Misc.prettyItemString(inHand.getTypeId())); player.sendMessage(LocaleLoader.getString("Skills.NeedMore") + " " + ChatColor.GRAY + Misc.prettyItemString(inHand.getTypeId()));
} }
protected boolean nearbyEntityExists() { protected boolean nearbyEntityExists() {
if(player == null) if (player == null)
return false; return false;
boolean entityExists = false; boolean entityExists = false;
@ -51,7 +51,7 @@ public class CallOfTheWildEventHandler {
} }
protected void sendFailureMessage() { protected void sendFailureMessage() {
if(player == null) if (player == null)
return; return;
if (type == EntityType.OCELOT) { if (type == EntityType.OCELOT) {
@ -63,7 +63,7 @@ public class CallOfTheWildEventHandler {
} }
protected void spawnCreature() { protected void spawnCreature() {
if(player == null) if (player == null)
return; return;
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type); LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);
@ -72,7 +72,7 @@ public class CallOfTheWildEventHandler {
((Tameable) entity).setOwner(player); ((Tameable) entity).setOwner(player);
if (type == EntityType.OCELOT) { if (type == EntityType.OCELOT) {
((Ocelot) entity).setCatType(Ocelot.Type.getType(1 + Taming.getRandom().nextInt(3))); ((Ocelot) entity).setCatType(Ocelot.Type.getType(1 + Misc.getRandom().nextInt(3)));
} }
else { else {
entity.setHealth(entity.getMaxHealth()); entity.setHealth(entity.getMaxHealth());
@ -80,7 +80,7 @@ public class CallOfTheWildEventHandler {
} }
protected void processResourceCost() { protected void processResourceCost() {
if(player == null) if (player == null)
return; return;
int newAmount = inHand.getAmount() - summonAmount; int newAmount = inHand.getAmount() - summonAmount;
@ -94,7 +94,7 @@ public class CallOfTheWildEventHandler {
} }
protected void sendSuccessMessage() { protected void sendSuccessMessage() {
if(player == null) if (player == null)
return; return;
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete")); player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));

View File

@ -18,7 +18,7 @@ public class EnvironmentallyAwareEventHandler {
} }
protected void teleportWolf() { protected void teleportWolf() {
if(player == null) if (player == null)
return; return;
if (event.getDamage() > wolf.getHealth()) { if (event.getDamage() > wolf.getHealth()) {
@ -29,7 +29,7 @@ public class EnvironmentallyAwareEventHandler {
} }
protected void sendAbilityMessage() { protected void sendAbilityMessage() {
if(player == null) if (player == null)
return; return;
player.sendMessage(LocaleLoader.getString("Taming.Listener.Wolf")); player.sendMessage(LocaleLoader.getString("Taming.Listener.Wolf"));

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.skills.taming; package com.gmail.nossr50.skills.taming;
import java.util.Random;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
public class Taming { public class Taming {
@ -25,10 +23,4 @@ public class Taming {
public static final int THICK_FUR_ACTIVATION_LEVEL = advancedConfig.getThickFurUnlock(); public static final int THICK_FUR_ACTIVATION_LEVEL = advancedConfig.getThickFurUnlock();
public static final int THICK_FUR_MODIFIER = advancedConfig.getThickFurModifier(); public static final int THICK_FUR_MODIFIER = advancedConfig.getThickFurModifier();
private static Random random = new Random();
public static Random getRandom() {
return random;
}
} }

View File

@ -9,21 +9,16 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class TamingManager { public class TamingManager extends SkillManager {
private Player player;
private PlayerProfile profile;
private int skillLevel;
private Config configInstance; private Config configInstance;
public TamingManager (Player player) { public TamingManager (Player player) {
this.player = player; super(player, SkillType.TAMING);
this.profile = Users.getProfile(player);
this.skillLevel = profile.getSkillLevel(SkillType.TAMING);
this.configInstance = Config.getInstance(); this.configInstance = Config.getInstance();
} }
@ -34,7 +29,7 @@ public class TamingManager {
* @param damage The damage being absorbed by the wolf * @param damage The damage being absorbed by the wolf
*/ */
public void fastFoodService(Wolf wolf, int damage) { public void fastFoodService(Wolf wolf, int damage) {
if(player == null) if (player == null)
return; return;
if (!Permissions.fastFoodService(player)) { if (!Permissions.fastFoodService(player)) {
@ -48,7 +43,7 @@ public class TamingManager {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
if (Taming.getRandom().nextInt(randomChance) < Taming.FAST_FOOD_SERVICE_ACTIVATION_CHANCE) { if (Misc.getRandom().nextInt(randomChance) < Taming.FAST_FOOD_SERVICE_ACTIVATION_CHANCE) {
FastFoodServiceEventHandler eventHandler = new FastFoodServiceEventHandler(wolf); FastFoodServiceEventHandler eventHandler = new FastFoodServiceEventHandler(wolf);
eventHandler.modifyHealth(damage); eventHandler.modifyHealth(damage);
@ -62,7 +57,7 @@ public class TamingManager {
* @param event The event to modify * @param event The event to modify
*/ */
public void sharpenedClaws(EntityDamageEvent event) { public void sharpenedClaws(EntityDamageEvent event) {
if(player == null) if (player == null)
return; return;
if (!Permissions.sharpenedClaws(player)) { if (!Permissions.sharpenedClaws(player)) {
@ -82,7 +77,7 @@ public class TamingManager {
* @param event The event to modify * @param event The event to modify
*/ */
public void gore(EntityDamageEvent event) { public void gore(EntityDamageEvent event) {
if(player == null) if (player == null)
return; return;
if (!Permissions.gore(player)) { if (!Permissions.gore(player)) {
@ -100,7 +95,7 @@ public class TamingManager {
float chance = (float) (((double) Taming.GORE_CHANCE_MAX / (double) Taming.GORE_MAX_BONUS_LEVEL) * skillLevel); float chance = (float) (((double) Taming.GORE_CHANCE_MAX / (double) Taming.GORE_MAX_BONUS_LEVEL) * skillLevel);
if (chance > Taming.GORE_CHANCE_MAX) chance = Taming.GORE_CHANCE_MAX; if (chance > Taming.GORE_CHANCE_MAX) chance = Taming.GORE_CHANCE_MAX;
if (chance > Taming.getRandom().nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
eventHandler.modifyEventDamage(); eventHandler.modifyEventDamage();
eventHandler.applyBleed(); eventHandler.applyBleed();
eventHandler.sendAbilityMessage(); eventHandler.sendAbilityMessage();
@ -160,7 +155,7 @@ public class TamingManager {
* @param livingEntity The entity to examine * @param livingEntity The entity to examine
*/ */
public void beastLore(LivingEntity livingEntity) { public void beastLore(LivingEntity livingEntity) {
if(player == null) if (player == null)
return; return;
if (!Permissions.beastLore(player)) { if (!Permissions.beastLore(player)) {
@ -179,7 +174,7 @@ public class TamingManager {
* @param summonAmount The amount of material needed to summon the entity * @param summonAmount The amount of material needed to summon the entity
*/ */
private void callOfTheWild(EntityType type, int summonAmount) { private void callOfTheWild(EntityType type, int summonAmount) {
if(player == null) if (player == null)
return; return;
if (!Permissions.callOfTheWild(player)) { if (!Permissions.callOfTheWild(player)) {
@ -195,15 +190,14 @@ public class TamingManager {
eventHandler.sendInsufficientAmountMessage(); eventHandler.sendInsufficientAmountMessage();
return; return;
} }
if (eventHandler.nearbyEntityExists()) {
eventHandler.sendFailureMessage();
}
else { else {
if (eventHandler.nearbyEntityExists()) { eventHandler.spawnCreature();
eventHandler.sendFailureMessage(); eventHandler.processResourceCost();
} eventHandler.sendSuccessMessage();
else {
eventHandler.spawnCreature();
eventHandler.processResourceCost();
eventHandler.sendSuccessMessage();
}
} }
} }
@ -214,7 +208,7 @@ public class TamingManager {
* @param cause The damage cause of the event * @param cause The damage cause of the event
*/ */
private void environmentallyAware(EntityDamageEvent event, DamageCause cause) { private void environmentallyAware(EntityDamageEvent event, DamageCause cause) {
if(player == null) if (player == null)
return; return;
if (!Permissions.environmentallyAware(player)) { if (!Permissions.environmentallyAware(player)) {
@ -249,7 +243,7 @@ public class TamingManager {
* @param cause The damage cause of the event * @param cause The damage cause of the event
*/ */
private void thickFur(EntityDamageEvent event, DamageCause cause) { private void thickFur(EntityDamageEvent event, DamageCause cause) {
if(player == null) if (player == null)
return; return;
if (!Permissions.thickFur(player)) { if (!Permissions.thickFur(player)) {
@ -269,7 +263,7 @@ public class TamingManager {
* @param event The event to modify * @param event The event to modify
*/ */
private void shockProof(EntityDamageEvent event) { private void shockProof(EntityDamageEvent event) {
if(player == null) if (player == null)
return; return;
if (!Permissions.shockProof(player)) { if (!Permissions.shockProof(player)) {
@ -282,12 +276,4 @@ public class TamingManager {
eventHandler.modifyEventDamage(); eventHandler.modifyEventDamage();
} }
} }
protected int getSkillLevel() {
return skillLevel;
}
protected Player getPlayer() {
return player;
}
} }

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.skills.unarmed; package com.gmail.nossr50.skills.unarmed;
import java.util.Random;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
public class Unarmed { public class Unarmed {
@ -18,10 +16,4 @@ public class Unarmed {
public static final int IRON_GRIP_MAX_CHANCE = advancedConfig.getIronGripChanceMax(); public static final int IRON_GRIP_MAX_CHANCE = advancedConfig.getIronGripChanceMax();
public static final int IRON_GRIP_MAX_BONUS_LEVEL = advancedConfig.getIronGripMaxBonusLevel(); public static final int IRON_GRIP_MAX_BONUS_LEVEL = advancedConfig.getIronGripMaxBonusLevel();
private static Random random = new Random();
protected static Random getRandom() {
return random;
}
} }

View File

@ -3,20 +3,14 @@ package com.gmail.nossr50.skills.unarmed;
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.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class UnarmedManager {
private Player player;
private PlayerProfile profile;
private int skillLevel;
public class UnarmedManager extends SkillManager {
public UnarmedManager (Player player) { public UnarmedManager (Player player) {
this.player = player; super(player, SkillType.UNARMED);
this.profile = Users.getProfile(player);
this.skillLevel = profile.getSkillLevel(SkillType.UNARMED);
} }
/** /**
@ -25,7 +19,7 @@ public class UnarmedManager {
* @param defender The defending player * @param defender The defending player
*/ */
public void disarmCheck(Player defender) { public void disarmCheck(Player defender) {
if(player == null) if (player == null)
return; return;
if (!Permissions.disarm(player)) { if (!Permissions.disarm(player)) {
@ -46,7 +40,7 @@ public class UnarmedManager {
float chance = (float) (((double) Unarmed.DISARM_MAX_CHANCE / (double) Unarmed.DISARM_MAX_BONUS_LEVEL) * skillLevel); float chance = (float) (((double) Unarmed.DISARM_MAX_CHANCE / (double) Unarmed.DISARM_MAX_BONUS_LEVEL) * skillLevel);
if (chance > Unarmed.DISARM_MAX_CHANCE) chance = Unarmed.DISARM_MAX_CHANCE; if (chance > Unarmed.DISARM_MAX_CHANCE) chance = Unarmed.DISARM_MAX_CHANCE;
if (chance > Unarmed.getRandom().nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
if (!hasIronGrip(defender)) { if (!hasIronGrip(defender)) {
eventHandler.sendAbilityMessage(); eventHandler.sendAbilityMessage();
eventHandler.handleDisarm(); eventHandler.handleDisarm();
@ -62,7 +56,7 @@ public class UnarmedManager {
* @param event The event to modify * @param event The event to modify
*/ */
public void deflectCheck(EntityDamageEvent event) { public void deflectCheck(EntityDamageEvent event) {
if(player == null) if (player == null)
return; return;
if (!Permissions.deflect(player)) { if (!Permissions.deflect(player)) {
@ -80,7 +74,7 @@ public class UnarmedManager {
float chance = (float) (((double) Unarmed.DEFLECT_MAX_CHANCE / (double) Unarmed.DEFLECT_MAX_BONUS_LEVEL) * skillLevel); float chance = (float) (((double) Unarmed.DEFLECT_MAX_CHANCE / (double) Unarmed.DEFLECT_MAX_BONUS_LEVEL) * skillLevel);
if (chance > Unarmed.DEFLECT_MAX_CHANCE) chance = Unarmed.DEFLECT_MAX_CHANCE; if (chance > Unarmed.DEFLECT_MAX_CHANCE) chance = Unarmed.DEFLECT_MAX_CHANCE;
if (chance > Unarmed.getRandom().nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
eventHandler.cancelEvent(); eventHandler.cancelEvent();
eventHandler.sendAbilityMessage(); eventHandler.sendAbilityMessage();
} }
@ -92,7 +86,7 @@ public class UnarmedManager {
* @param event The event to modify. * @param event The event to modify.
*/ */
public void bonusDamage(EntityDamageEvent event) { public void bonusDamage(EntityDamageEvent event) {
if(player == null) if (player == null)
return; return;
if (!Permissions.unarmedBonus(player)) { if (!Permissions.unarmedBonus(player)) {
@ -112,7 +106,7 @@ public class UnarmedManager {
* @return true if the defender was not disarmed, false otherwise * @return true if the defender was not disarmed, false otherwise
*/ */
private boolean hasIronGrip(Player defender) { private boolean hasIronGrip(Player defender) {
if(defender == null) if (defender == null)
return false; return false;
if (!Permissions.ironGrip(defender)) { if (!Permissions.ironGrip(defender)) {
@ -130,20 +124,11 @@ public class UnarmedManager {
float chance = (float) (((double) Unarmed.IRON_GRIP_MAX_CHANCE / (double) Unarmed.IRON_GRIP_MAX_BONUS_LEVEL) * skillLevel); float chance = (float) (((double) Unarmed.IRON_GRIP_MAX_CHANCE / (double) Unarmed.IRON_GRIP_MAX_BONUS_LEVEL) * skillLevel);
if (chance > Unarmed.IRON_GRIP_MAX_CHANCE) chance = Unarmed.IRON_GRIP_MAX_CHANCE; if (chance > Unarmed.IRON_GRIP_MAX_CHANCE) chance = Unarmed.IRON_GRIP_MAX_CHANCE;
if (chance > Unarmed.getRandom().nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();
return true; return true;
} }
else {
return false;
}
}
protected int getSkillLevel() { return false;
return skillLevel;
}
protected Player getPlayer() {
return player;
} }
} }

View File

@ -48,6 +48,7 @@ public class SpoutStuff {
* @param theFilePath The name of the file path * @param theFilePath The name of the file path
*/ */
private static void writeFile(String theFileName, String theFilePath) { private static void writeFile(String theFileName, String theFilePath) {
InputStream is = null;
OutputStream os = null; OutputStream os = null;
JarFile jar = null; JarFile jar = null;
@ -56,7 +57,7 @@ public class SpoutStuff {
jar = new JarFile(mcMMO.mcmmo); jar = new JarFile(mcMMO.mcmmo);
JarEntry entry = jar.getJarEntry("resources/" + theFileName); JarEntry entry = jar.getJarEntry("resources/" + theFileName);
InputStream is = jar.getInputStream(entry); is = jar.getInputStream(entry);
byte[] buf = new byte[2048]; byte[] buf = new byte[2048];
int nbRead; int nbRead;
@ -66,6 +67,8 @@ public class SpoutStuff {
while ((nbRead = is.read(buf)) != -1) { while ((nbRead = is.read(buf)) != -1) {
os.write(buf, 0, nbRead); os.write(buf, 0, nbRead);
} }
os.flush();
} }
catch (FileNotFoundException e) { catch (FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
@ -74,9 +77,16 @@ public class SpoutStuff {
e.printStackTrace(); e.printStackTrace();
} }
finally { finally {
if (is != null) {
try {
is.close();
}
catch (IOException ex) {
ex.printStackTrace();
}
}
if (os != null) { if (os != null) {
try { try {
os.flush();
os.close(); os.close();
} }
catch (IOException ex) { catch (IOException ex) {

View File

@ -65,9 +65,8 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customItems.contains(item)) { if (customBlocksEnabled && CustomBlocksConfig.getInstance().customItems.contains(item)) {
return true; return true;
} }
else {
return false; return false;
}
} }
} }
@ -114,9 +113,8 @@ public class BlockChecks {
if (block.getTypeId() == Config.getInstance().getRepairAnvilId() || block.getTypeId() == Config.getInstance().getSalvageAnvilId()) { if (block.getTypeId() == Config.getInstance().getRepairAnvilId() || block.getTypeId() == Config.getInstance().getSalvageAnvilId()) {
return false; return false;
} }
else {
return true; return true;
}
} }
} }
@ -142,9 +140,8 @@ public class BlockChecks {
if (customBlocksEnabled && ModChecks.isCustomOreBlock(block)) { if (customBlocksEnabled && ModChecks.isCustomOreBlock(block)) {
return true; return true;
} }
else {
return false; return false;
}
} }
} }
@ -176,7 +173,7 @@ public class BlockChecks {
* @param block Block to check * @param block Block to check
* @return true if the block is affected, false otherwise * @return true if the block is affected, false otherwise
*/ */
public static boolean canBeGreenTerra(Block block){ public static boolean canBeGreenTerra(Block block) {
switch (block.getType()) { switch (block.getType()) {
case BROWN_MUSHROOM: case BROWN_MUSHROOM:
case CACTUS: case CACTUS:
@ -198,9 +195,8 @@ public class BlockChecks {
if (block.getData() == CropState.RIPE.getData()) { if (block.getData() == CropState.RIPE.getData()) {
return true; return true;
} }
else {
return false; return false;
}
default: default:
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1); ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
@ -208,9 +204,8 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) { if (customBlocksEnabled && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) {
return true; return true;
} }
else {
return false; return false;
}
} }
} }
@ -245,9 +240,8 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customMiningBlocks.contains(item)) { if (customBlocksEnabled && CustomBlocksConfig.getInstance().customMiningBlocks.contains(item)) {
return true; return true;
} }
else {
return false; return false;
}
} }
} }
@ -274,9 +268,8 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) { if (customBlocksEnabled && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) {
return true; return true;
} }
else {
return false; return false;
}
} }
} }
@ -299,18 +292,16 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customWoodcuttingBlocks.contains(item)) { if (customBlocksEnabled && CustomBlocksConfig.getInstance().customWoodcuttingBlocks.contains(item)) {
return true; return true;
} }
else {
return false;
}
}
}
public static boolean isLog (Block block){
if (block.getType().equals(Material.LOG) || (customBlocksEnabled && ModChecks.isCustomLogBlock(block))) {
return true;
}
else {
return false; return false;
} }
} }
public static boolean isLog (Block block) {
if (block.getType().equals(Material.LOG) || (customBlocksEnabled && ModChecks.isCustomLogBlock(block))) {
return true;
}
return false;
}
} }

View File

@ -32,7 +32,7 @@ import com.gmail.nossr50.runnables.BleedTimer;
import com.gmail.nossr50.runnables.GainXp; import com.gmail.nossr50.runnables.GainXp;
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager; import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
import com.gmail.nossr50.skills.archery.ArcheryManager; import com.gmail.nossr50.skills.archery.ArcheryManager;
import com.gmail.nossr50.skills.combat.Axes; import com.gmail.nossr50.skills.axes.Axes;
import com.gmail.nossr50.skills.swords.Swords; import com.gmail.nossr50.skills.swords.Swords;
import com.gmail.nossr50.skills.swords.SwordsManager; import com.gmail.nossr50.skills.swords.SwordsManager;
import com.gmail.nossr50.skills.taming.TamingManager; import com.gmail.nossr50.skills.taming.TamingManager;
@ -335,6 +335,12 @@ public class Combat {
} }
for (Entity entity : target.getNearbyEntities(2.5, 2.5, 2.5)) { for (Entity entity : target.getNearbyEntities(2.5, 2.5, 2.5)) {
if (entity instanceof Player) {
if (Misc.isNPC((Player) entity)) {
continue;
}
}
if (!(entity instanceof LivingEntity)) { if (!(entity instanceof LivingEntity)) {
continue; continue;
} }

View File

@ -66,10 +66,10 @@ public class Database {
mcMMO.p.getLogger().info("Connection to MySQL was a success!"); mcMMO.p.getLogger().info("Connection to MySQL was a success!");
} catch (SQLException ex) { } catch (SQLException ex) {
connection = null; connection = null;
if(reconnectAttempt == 0 || reconnectAttempt >= 11) mcMMO.p.getLogger().info("Connection to MySQL failed!"); if (reconnectAttempt == 0 || reconnectAttempt >= 11) mcMMO.p.getLogger().info("Connection to MySQL failed!");
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {
connection = null; connection = null;
if(reconnectAttempt == 0 || reconnectAttempt >= 11) mcMMO.p.getLogger().info("MySQL database driver not found!"); if (reconnectAttempt == 0 || reconnectAttempt >= 11) mcMMO.p.getLogger().info("MySQL database driver not found!");
} }
} }
@ -155,7 +155,7 @@ public class Database {
PreparedStatement statement = null; PreparedStatement statement = null;
try { try {
if(!checkConnected()) return; if (!checkConnected()) return;
statement = connection.prepareStatement(sql); statement = connection.prepareStatement(sql);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();

View File

@ -172,9 +172,8 @@ public class ItemChecks {
if (customArmorEnabled && CustomArmorConfig.getInstance().customHelmetIDs.contains(is.getTypeId())) { if (customArmorEnabled && CustomArmorConfig.getInstance().customHelmetIDs.contains(is.getTypeId())) {
return true; return true;
} }
else {
return false; return false;
}
} }
} }
@ -196,9 +195,8 @@ public class ItemChecks {
if (customArmorEnabled && CustomArmorConfig.getInstance().customChestplateIDs.contains(is.getTypeId())) { if (customArmorEnabled && CustomArmorConfig.getInstance().customChestplateIDs.contains(is.getTypeId())) {
return true; return true;
} }
else {
return false; return false;
}
} }
} }
@ -220,9 +218,8 @@ public class ItemChecks {
if (customArmorEnabled && CustomArmorConfig.getInstance().customLeggingIDs.contains(is.getTypeId())) { if (customArmorEnabled && CustomArmorConfig.getInstance().customLeggingIDs.contains(is.getTypeId())) {
return true; return true;
} }
else {
return false; return false;
}
} }
} }
@ -244,9 +241,8 @@ public class ItemChecks {
if (customArmorEnabled && CustomArmorConfig.getInstance().customBootIDs.contains(is.getTypeId())) { if (customArmorEnabled && CustomArmorConfig.getInstance().customBootIDs.contains(is.getTypeId())) {
return true; return true;
} }
else {
return false; return false;
}
} }
} }

View File

@ -55,9 +55,8 @@ public class Leaderboard {
if (players.contains(p)) { if (players.contains(p)) {
continue; continue;
} }
else {
players.add(p); players.add(p);
}
if (character.length > 1 && Misc.isInt(character[1])) { if (character.length > 1 && Misc.isInt(character[1])) {
Mining.add(new PlayerStat(p, Integer.valueOf(character[1]))); Mining.add(new PlayerStat(p, Integer.valueOf(character[1])));
@ -302,7 +301,7 @@ public class Leaderboard {
} }
} }
if(!inserted) { if (!inserted) {
writer.append(ps.name + ":" + ps.statVal).append("\r\n"); writer.append(ps.name + ":" + ps.statVal).append("\r\n");
} }

View File

@ -398,23 +398,22 @@ public class Metrics {
if (response == null || response.startsWith("ERR")) { if (response == null || response.startsWith("ERR")) {
throw new IOException(response); //Throw the exception throw new IOException(response); //Throw the exception
} else { }
// Is this the first update this hour?
if (response.contains("OK This is your first update this hour")) {
synchronized (graphs) {
final Iterator<Graph> iter = graphs.iterator();
while (iter.hasNext()) { // Is this the first update this hour?
final Graph graph = iter.next(); if (response.contains("OK This is your first update this hour")) {
synchronized (graphs) {
final Iterator<Graph> iter = graphs.iterator();
for (Plotter plotter : graph.getPlotters()) { while (iter.hasNext()) {
plotter.reset(); final Graph graph = iter.next();
}
for (Plotter plotter : graph.getPlotters()) {
plotter.reset();
} }
} }
} }
} }
//if (response.startsWith("OK")) - We should get "OK" followed by an optional description if everything goes right
} }
/** /**

View File

@ -24,8 +24,10 @@ public class Misc {
public static final int TOOL_DURABILITY_LOSS = Config.getInstance().getAbilityToolDamage(); public static final int TOOL_DURABILITY_LOSS = Config.getInstance().getAbilityToolDamage();
public static final int PLAYER_RESPAWN_COOLDOWN_SECONDS = 5; public static final int PLAYER_RESPAWN_COOLDOWN_SECONDS = 5;
public static final int TIME_CONVERSION_FACTOR = 1000;
public static final double SKILL_MESSAGE_MAX_SENDING_DISTANCE = 10.0;
public static boolean isCitizensNPC(Player player) { public static boolean isNPC(Player player) {
if (player == null || Users.getProfile(player) == null || player.hasMetadata("NPC")) { if (player == null || Users.getProfile(player) == null || player.hasMetadata("NPC")) {
return true; return true;
} }
@ -33,6 +35,14 @@ public class Misc {
return false; return false;
} }
public static void sendSkillMessage(Player player, String message) {
for (Player otherPlayer : player.getWorld().getPlayers()) {
if (otherPlayer != player && Misc.isNear(player.getLocation(), otherPlayer.getLocation(), Misc.SKILL_MESSAGE_MAX_SENDING_DISTANCE)) {
otherPlayer.sendMessage(message);
}
}
}
/** /**
* Gets a capitalized version of the target string. * Gets a capitalized version of the target string.
* *
@ -82,9 +92,8 @@ public class Misc {
if (isInt(string)) { if (isInt(string)) {
return Integer.parseInt(string); return Integer.parseInt(string);
} }
else {
return 0; return 0;
}
} }
/** /**
@ -103,9 +112,8 @@ public class Misc {
if (le.getNoDamageTicks() > le.getMaximumNoDamageTicks() / 2.0F && event.getDamage() <= le.getLastDamage()) { if (le.getNoDamageTicks() > le.getMaximumNoDamageTicks() / 2.0F && event.getDamage() <= le.getLastDamage()) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -135,9 +143,8 @@ public class Misc {
if (!damageEvent.isCancelled() && !breakEvent.isCancelled()) { if (!damageEvent.isCancelled() && !breakEvent.isCancelled()) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -187,9 +194,8 @@ public class Misc {
if (first.distanceSquared(second) < (maxDistance * maxDistance)) { if (first.distanceSquared(second) < (maxDistance * maxDistance)) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -243,7 +249,7 @@ public class Misc {
* @param quantity The amount of items to drop * @param quantity The amount of items to drop
*/ */
public static void randomDropItems(Location location, ItemStack is, int chance, int quantity) { public static void randomDropItems(Location location, ItemStack is, int chance, int quantity) {
for(int i = 0; i < quantity; i++) { for (int i = 0; i < quantity; i++) {
randomDropItem(location, is, chance); randomDropItem(location, is, chance);
} }
} }
@ -284,9 +290,8 @@ public class Misc {
if (skillLevel > maxLevel) { if (skillLevel > maxLevel) {
return maxLevel; return maxLevel;
} }
else {
return skillLevel; return skillLevel;
}
} }
/** /**
@ -300,8 +305,11 @@ public class Misc {
if (levelCap > 0) { if (levelCap > 0) {
return levelCap; return levelCap;
} }
else {
return Integer.MAX_VALUE; return Integer.MAX_VALUE;
} }
public static Random getRandom() {
return random;
} }
} }

View File

@ -154,9 +154,8 @@ public class ModChecks {
if (customToolsEnabled && toolInstance.customTools.containsKey(item.getTypeId())) { if (customToolsEnabled && toolInstance.customTools.containsKey(item.getTypeId())) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -169,8 +168,7 @@ public class ModChecks {
if (customArmorEnabled && armorInstance.customArmor.containsKey(item.getTypeId())) { if (customArmorEnabled && armorInstance.customArmor.containsKey(item.getTypeId())) {
return true; return true;
} }
else {
return false; return false;
}
} }
} }

View File

@ -13,10 +13,10 @@ public class Page {
public static int getTotalPageNumber(String address) public static int getTotalPageNumber(String address)
{ {
String[] addressSplit = LocaleLoader.getString(address).split("\n"); String[] addressSplit = LocaleLoader.getString(address).split("\n");
if(addressSplit.length <= 8) if (addressSplit.length <= 8)
return 1; return 1;
else
return (addressSplit.length/8)+1; return (addressSplit.length/8)+1;
} }
public static ArrayList<String> grabPageContents(String header, String address, int pagenum) public static ArrayList<String> grabPageContents(String header, String address, int pagenum)
@ -24,7 +24,7 @@ public class Page {
int pageIndexStart = 0; int pageIndexStart = 0;
//Determine what string to start at //Determine what string to start at
if(pagenum > 1) if (pagenum > 1)
{ {
pageIndexStart = 8*(pagenum-1); pageIndexStart = 8*(pagenum-1);
} }
@ -36,9 +36,9 @@ public class Page {
//Add targeted strings //Add targeted strings
while(allStrings.size() < 9) while (allStrings.size() < 9)
{ {
if(pageIndexStart+allStrings.size() > split.length) if (pageIndexStart+allStrings.size() > split.length)
allStrings.add(""); allStrings.add("");
else else
allStrings.add(split[pageIndexStart+allStrings.size()-1]); allStrings.add(split[pageIndexStart+allStrings.size()-1]);
@ -50,7 +50,7 @@ public class Page {
public static void clearChat(Player player) public static void clearChat(Player player)
{ {
for(int x = 0; x < 20; x++) for (int x = 0; x < 20; x++)
{ {
player.sendMessage(""); player.sendMessage("");
} }
@ -62,31 +62,31 @@ public class Page {
player.sendMessage(ChatColor.DARK_AQUA+"Guide for "+capitalized+" available type /"+skilltype.toString().toLowerCase()+" ? [Page#]"); //TODO: Needs more locale. player.sendMessage(ChatColor.DARK_AQUA+"Guide for "+capitalized+" available type /"+skilltype.toString().toLowerCase()+" ? [Page#]"); //TODO: Needs more locale.
if (args.length >= 1) if (args.length >= 1)
{ {
if(args[0].equals("?")) if (args[0].equals("?"))
{ {
String address = "Guides."+capitalized; String address = "Guides."+capitalized;
if(args.length > 1 && Misc.isInt(args[1]) && Misc.getInt(args[1]) <= Page.getTotalPageNumber(address)) if (args.length > 1 && Misc.isInt(args[1]) && Misc.getInt(args[1]) <= Page.getTotalPageNumber(address))
{ {
Page.clearChat(player); Page.clearChat(player);
for(String target : Page.grabPageContents(capitalized+" Guide", address, Misc.getInt(args[1]))) for (String target : Page.grabPageContents(capitalized+" Guide", address, Misc.getInt(args[1])))
{ {
player.sendMessage(target); player.sendMessage(target);
} }
} else if(args.length == 1) } else if (args.length == 1)
{ {
Page.clearChat(player); Page.clearChat(player);
for(String target : Page.grabPageContents(capitalized+" Guide", address, 1)) for (String target : Page.grabPageContents(capitalized+" Guide", address, 1))
{ {
player.sendMessage(target); player.sendMessage(target);
} }
} }
else if(args.length > 1 && Misc.getInt(args[1]) > Page.getTotalPageNumber(address)) else if (args.length > 1 && Misc.getInt(args[1]) > Page.getTotalPageNumber(address))
{ {
player.sendMessage("That page doesn't exist, there are only "+Page.getTotalPageNumber(address)+" total pages"); //TODO: Needs more locale. player.sendMessage("That page doesn't exist, there are only "+Page.getTotalPageNumber(address)+" total pages"); //TODO: Needs more locale.
} }
else if(args.length > 1 && !Misc.isInt(args[1])) else if (args.length > 1 && !Misc.isInt(args[1]))
{ {
player.sendMessage("Not a valid page number!"); //TODO: Needs more locale. player.sendMessage("Not a valid page number!"); //TODO: Needs more locale.
} }

View File

@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
public class Permissions { public class Permissions {
public static boolean hasPermission(CommandSender sender, String perm) public static boolean hasPermission(CommandSender sender, String perm)
{ {
if(sender.hasPermission(perm)) if (sender.hasPermission(perm))
return true; return true;
return false; return false;
@ -14,7 +14,7 @@ public class Permissions {
public static boolean hasPermission(Player sender, String perm) public static boolean hasPermission(Player sender, String perm)
{ {
if(sender.hasPermission(perm)) if (sender.hasPermission(perm))
return true; return true;
return false; return false;

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.util; package com.gmail.nossr50.util;
import java.util.Random;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@ -28,11 +26,6 @@ public class Skills {
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
public static int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength(); public static int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength();
private final static int TIME_CONVERSION_FACTOR = 1000;
private final static double MAX_DISTANCE_AWAY = 10.0;
private final static Random random = new Random();
/** /**
* Checks to see if the cooldown for an item or ability is expired. * Checks to see if the cooldown for an item or ability is expired.
* *
@ -41,7 +34,7 @@ public class Skills {
* @param player The player whose cooldown is being checked * @param player The player whose cooldown is being checked
* @return true if the cooldown is over, false otherwise * @return true if the cooldown is over, false otherwise
*/ */
public static boolean cooldownOver(long oldTime, int cooldown, Player player){ public static boolean cooldownOver(long oldTime, int cooldown, Player player) {
long currentTime = System.currentTimeMillis(); long currentTime = System.currentTimeMillis();
int adjustedCooldown = cooldown; int adjustedCooldown = cooldown;
@ -56,12 +49,11 @@ public class Skills {
adjustedCooldown = (int) (adjustedCooldown * 0.75); adjustedCooldown = (int) (adjustedCooldown * 0.75);
} }
if (currentTime - oldTime >= (adjustedCooldown * TIME_CONVERSION_FACTOR)) { if (currentTime - oldTime >= (adjustedCooldown * Misc.TIME_CONVERSION_FACTOR)) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -85,7 +77,7 @@ public class Skills {
adjustedCooldown = (int) (adjustedCooldown * 0.75); adjustedCooldown = (int) (adjustedCooldown * 0.75);
} }
return (int) (((deactivatedTimeStamp + (adjustedCooldown * TIME_CONVERSION_FACTOR)) - System.currentTimeMillis()) / TIME_CONVERSION_FACTOR); return (int) (((deactivatedTimeStamp + (adjustedCooldown * Misc.TIME_CONVERSION_FACTOR)) - System.currentTimeMillis()) / Misc.TIME_CONVERSION_FACTOR);
} }
/** /**
@ -96,10 +88,10 @@ public class Skills {
* @param ability The ability to watch cooldowns for * @param ability The ability to watch cooldowns for
*/ */
public static void watchCooldown(Player player, PlayerProfile profile, AbilityType ability) { public static void watchCooldown(Player player, PlayerProfile profile, AbilityType ability) {
if(player == null || profile == null || ability == null) if (player == null || profile == null || ability == null)
return; return;
if (!profile.getAbilityInformed(ability) && cooldownOver(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) { if (!profile.getAbilityInformed(ability) && cooldownOver(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
profile.setAbilityInformed(ability, true); profile.setAbilityInformed(ability, true);
player.sendMessage(ability.getAbilityRefresh()); player.sendMessage(ability.getAbilityRefresh());
} }
@ -145,8 +137,8 @@ public class Skills {
*/ */
if (ability.getPermissions(player) && tool.inHand(inHand) && !profile.getToolPreparationMode(tool)) { if (ability.getPermissions(player) && tool.inHand(inHand) && !profile.getToolPreparationMode(tool)) {
if (skill != SkillType.WOODCUTTING && skill != SkillType.AXES) { if (skill != SkillType.WOODCUTTING && skill != SkillType.AXES) {
if (!profile.getAbilityMode(ability) && !cooldownOver(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) { if (!profile.getAbilityMode(ability) && !cooldownOver(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player) + "s)"); player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player) + "s)");
return; return;
} }
} }
@ -178,7 +170,7 @@ public class Skills {
return; return;
} }
if (profile.getToolPreparationMode(tool) && curTime - (profile.getToolPreparationATS(tool) * TIME_CONVERSION_FACTOR) >= FOUR_SECONDS) { if (profile.getToolPreparationMode(tool) && curTime - (profile.getToolPreparationATS(tool) * Misc.TIME_CONVERSION_FACTOR) >= FOUR_SECONDS) {
profile.setToolPreparationMode(tool, false); profile.setToolPreparationMode(tool, false);
if (Config.getInstance().getAbilityMessagesEnabled()) { if (Config.getInstance().getAbilityMessagesEnabled()) {
@ -187,16 +179,12 @@ public class Skills {
} }
if (ability.getPermissions(player)) { if (ability.getPermissions(player)) {
if (profile.getAbilityMode(ability) && (profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR) <= curTime) { if (profile.getAbilityMode(ability) && (profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR) <= curTime) {
profile.setAbilityMode(ability, false); profile.setAbilityMode(ability, false);
profile.setAbilityInformed(ability, false); profile.setAbilityInformed(ability, false);
player.sendMessage(ability.getAbilityOff()); player.sendMessage(ability.getAbilityOff());
for (Player nearbyPlayer : player.getWorld().getPlayers()) { Misc.sendSkillMessage(player, ability.getAbilityPlayerOff(player));
if (nearbyPlayer != player && Misc.isNear(player.getLocation(), nearbyPlayer.getLocation(), MAX_DISTANCE_AWAY)) {
nearbyPlayer.sendMessage(ability.getAbilityPlayerOff(player));
}
}
} }
} }
} }
@ -331,9 +319,8 @@ public class Skills {
if (getSkillType(skillName) != null) { if (getSkillType(skillName) != null) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -350,9 +337,8 @@ public class Skills {
|| Permissions.unarmed(player)) { || Permissions.unarmed(player)) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -369,9 +355,8 @@ public class Skills {
|| Permissions.woodcutting(player)) { || Permissions.woodcutting(player)) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -384,9 +369,8 @@ public class Skills {
if (Permissions.acrobatics(player) || Permissions.repair(player)) { if (Permissions.acrobatics(player) || Permissions.repair(player)) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -399,7 +383,7 @@ public class Skills {
if (Config.getInstance().getAbilitiesDamageTools()) { if (Config.getInstance().getAbilitiesDamageTools()) {
if (inHand.containsEnchantment(Enchantment.DURABILITY)) { if (inHand.containsEnchantment(Enchantment.DURABILITY)) {
int level = inHand.getEnchantmentLevel(Enchantment.DURABILITY); int level = inHand.getEnchantmentLevel(Enchantment.DURABILITY);
if (random.nextInt(level + 1) > 0) { if (Misc.getRandom().nextInt(level + 1) > 0) {
return; return;
} }
} }
@ -432,8 +416,8 @@ public class Skills {
* We show them the too tired message when they take action. * We show them the too tired message when they take action.
*/ */
if (type == SkillType.WOODCUTTING || type == SkillType.AXES) { if (type == SkillType.WOODCUTTING || type == SkillType.AXES) {
if (!profile.getAbilityMode(ability) && !cooldownOver(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) { if (!profile.getAbilityMode(ability) && !cooldownOver(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player) + "s)"); player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player) + "s)");
return; return;
} }
} }
@ -459,13 +443,9 @@ public class Skills {
if (!profile.getAbilityMode(ability) && cooldownOver(profile.getSkillDATS(ability), ability.getCooldown(), player)) { if (!profile.getAbilityMode(ability) && cooldownOver(profile.getSkillDATS(ability), ability.getCooldown(), player)) {
player.sendMessage(ability.getAbilityOn()); player.sendMessage(ability.getAbilityOn());
for (Player y : player.getWorld().getPlayers()) { Misc.sendSkillMessage(player, ability.getAbilityPlayer(player));
if (y != player && Misc.isNear(player.getLocation(), y.getLocation(), MAX_DISTANCE_AWAY)) {
y.sendMessage(ability.getAbilityPlayer(player));
}
}
profile.setSkillDATS(ability, System.currentTimeMillis() + (ticks * TIME_CONVERSION_FACTOR)); profile.setSkillDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
profile.setAbilityMode(ability, true); profile.setAbilityMode(ability, true);
} }
} }
@ -526,14 +506,14 @@ public class Skills {
* @param xp the amount of XP to gain * @param xp the amount of XP to gain
*/ */
public static void xpProcessing(Player player, PlayerProfile profile, SkillType type, int xp) { public static void xpProcessing(Player player, PlayerProfile profile, SkillType type, int xp) {
if(player == null) if (player == null)
return; return;
if (type.getPermissions(player)) { if (type.getPermissions(player)) {
if(Users.getPlayer(player) == null) if (Users.getPlayer(player) == null)
return; return;
if((type.getMaxLevel() < profile.getSkillLevel(type) + 1) || (Misc.getPowerLevelCap() < Users.getPlayer(player).getPowerLevel() + 1)) if ((type.getMaxLevel() < profile.getSkillLevel(type) + 1) || (Misc.getPowerLevelCap() < Users.getPlayer(player).getPowerLevel() + 1))
return; return;
Users.getPlayer(player).addXP(type, xp); Users.getPlayer(player).addXP(type, xp);

View File

@ -6,10 +6,10 @@ public class ChunkletManagerFactory {
public static ChunkletManager getChunkletManager() { public static ChunkletManager getChunkletManager() {
HiddenConfig hConfig = HiddenConfig.getInstance(); HiddenConfig hConfig = HiddenConfig.getInstance();
if(hConfig.getChunkletsEnabled()) { if (hConfig.getChunkletsEnabled()) {
return new HashChunkletManager(); return new HashChunkletManager();
} else {
return new NullChunkletManager();
} }
return new NullChunkletManager();
} }
} }

View File

@ -25,14 +25,14 @@ public class HashChunkletManager implements ChunkletManager {
public void loadChunklet(int cx, int cy, int cz, World world) { public void loadChunklet(int cx, int cy, int cz, World world) {
File dataDir = new File(world.getWorldFolder(), "mcmmo_data"); File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
File cxDir = new File(dataDir, "" + cx); File cxDir = new File(dataDir, "" + cx);
if(!cxDir.exists()) return; if (!cxDir.exists()) return;
File czDir = new File(cxDir, "" + cz); File czDir = new File(cxDir, "" + cz);
if(!czDir.exists()) return; if (!czDir.exists()) return;
File yFile = new File(czDir, "" + cy); File yFile = new File(czDir, "" + cy);
if(!yFile.exists()) return; if (!yFile.exists()) return;
ChunkletStore in = deserializeChunkletStore(yFile); ChunkletStore in = deserializeChunkletStore(yFile);
if(in != null) { if (in != null) {
store.put(world.getName() + "," + cx + "," + cz + "," + cy, in); store.put(world.getName() + "," + cx + "," + cz + "," + cy, in);
} }
} }
@ -40,11 +40,11 @@ public class HashChunkletManager implements ChunkletManager {
@Override @Override
public void unloadChunklet(int cx, int cy, int cz, World world) { public void unloadChunklet(int cx, int cy, int cz, World world) {
File dataDir = new File(world.getWorldFolder(), "mcmmo_data"); File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
if(store.containsKey(world.getName() + "," + cx + "," + cz + "," + cy)) { if (store.containsKey(world.getName() + "," + cx + "," + cz + "," + cy)) {
File cxDir = new File(dataDir, "" + cx); File cxDir = new File(dataDir, "" + cx);
if(!cxDir.exists()) cxDir.mkdir(); if (!cxDir.exists()) cxDir.mkdir();
File czDir = new File(cxDir, "" + cz); File czDir = new File(cxDir, "" + cz);
if(!czDir.exists()) czDir.mkdir(); if (!czDir.exists()) czDir.mkdir();
File yFile = new File(czDir, "" + cy); File yFile = new File(czDir, "" + cy);
ChunkletStore out = store.get(world.getName() + "," + cx + "," + cz + "," + cy); ChunkletStore out = store.get(world.getName() + "," + cx + "," + cz + "," + cy);
@ -57,19 +57,19 @@ public class HashChunkletManager implements ChunkletManager {
public void loadChunk(int cx, int cz, World world) { public void loadChunk(int cx, int cz, World world) {
File dataDir = new File(world.getWorldFolder(), "mcmmo_data"); File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
File cxDir = new File(dataDir, "" + cx); File cxDir = new File(dataDir, "" + cx);
if(!cxDir.exists()) return; if (!cxDir.exists()) return;
File czDir = new File(cxDir, "" + cz); File czDir = new File(cxDir, "" + cz);
if(!czDir.exists()) return; if (!czDir.exists()) return;
for(int y = 0; y < 4; y++) { for (int y = 0; y < 4; y++) {
File yFile = new File(czDir, "" + y); File yFile = new File(czDir, "" + y);
if(!yFile.exists()) { if (!yFile.exists()) {
continue; continue;
} else { }
ChunkletStore in = deserializeChunkletStore(yFile);
if(in != null) { ChunkletStore in = deserializeChunkletStore(yFile);
store.put(world.getName() + "," + cx + "," + cz + "," + y, in); if (in != null) {
} store.put(world.getName() + "," + cx + "," + cz + "," + y, in);
} }
} }
} }
@ -78,12 +78,12 @@ public class HashChunkletManager implements ChunkletManager {
public void unloadChunk(int cx, int cz, World world) { public void unloadChunk(int cx, int cz, World world) {
File dataDir = new File(world.getWorldFolder(), "mcmmo_data"); File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
for(int y = 0; y < 4; y++) { for (int y = 0; y < 4; y++) {
if(store.containsKey(world.getName() + "," + cx + "," + cz + "," + y)) { if (store.containsKey(world.getName() + "," + cx + "," + cz + "," + y)) {
File cxDir = new File(dataDir, "" + cx); File cxDir = new File(dataDir, "" + cx);
if(!cxDir.exists()) cxDir.mkdir(); if (!cxDir.exists()) cxDir.mkdir();
File czDir = new File(cxDir, "" + cz); File czDir = new File(cxDir, "" + cz);
if(!czDir.exists()) czDir.mkdir(); if (!czDir.exists()) czDir.mkdir();
File yFile = new File(czDir, "" + y); File yFile = new File(czDir, "" + y);
ChunkletStore out = store.get(world.getName() + "," + cx + "," + cz + "," + y); ChunkletStore out = store.get(world.getName() + "," + cx + "," + cz + "," + y);
@ -107,16 +107,16 @@ public class HashChunkletManager implements ChunkletManager {
public void saveWorld(World world) { public void saveWorld(World world) {
String worldName = world.getName(); String worldName = world.getName();
File dataDir = new File(world.getWorldFolder(), "mcmmo_data"); File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
if(!dataDir.exists()) if (!dataDir.exists())
dataDir.mkdirs(); dataDir.mkdirs();
for(String key : store.keySet()) { for (String key : store.keySet()) {
String[] info = key.split(","); String[] info = key.split(",");
if(worldName.equals(info[0])) { if (worldName.equals(info[0])) {
File cxDir = new File(dataDir, "" + info[1]); File cxDir = new File(dataDir, "" + info[1]);
if(!cxDir.exists()) cxDir.mkdir(); if (!cxDir.exists()) cxDir.mkdir();
File czDir = new File(cxDir, "" + info[2]); File czDir = new File(cxDir, "" + info[2]);
if(!czDir.exists()) czDir.mkdir(); if (!czDir.exists()) czDir.mkdir();
File yFile = new File(czDir, "" + info[3]); File yFile = new File(czDir, "" + info[3]);
serializeChunkletStore(store.get(key), yFile); serializeChunkletStore(store.get(key), yFile);
@ -130,9 +130,9 @@ public class HashChunkletManager implements ChunkletManager {
String worldName = world.getName(); String worldName = world.getName();
for(String key : store.keySet()) { for (String key : store.keySet()) {
String tempWorldName = key.split(",")[0]; String tempWorldName = key.split(",")[0];
if(tempWorldName.equals(worldName)) { if (tempWorldName.equals(worldName)) {
store.remove(key); store.remove(key);
return; return;
} }
@ -141,14 +141,14 @@ public class HashChunkletManager implements ChunkletManager {
@Override @Override
public void loadWorld(World world) { public void loadWorld(World world) {
//for(Chunk chunk : world.getLoadedChunks()) { //for (Chunk chunk : world.getLoadedChunks()) {
// this.chunkLoaded(chunk.getX(), chunk.getZ(), world); // this.chunkLoaded(chunk.getX(), chunk.getZ(), world);
//} //}
} }
@Override @Override
public void saveAll() { public void saveAll() {
for(World world : Bukkit.getWorlds()) { for (World world : Bukkit.getWorlds()) {
saveWorld(world); saveWorld(world);
} }
} }
@ -156,7 +156,7 @@ public class HashChunkletManager implements ChunkletManager {
@Override @Override
public void unloadAll() { public void unloadAll() {
saveAll(); saveAll();
for(World world : Bukkit.getWorlds()) { for (World world : Bukkit.getWorlds()) {
unloadWorld(world); unloadWorld(world);
} }
} }
@ -253,22 +253,22 @@ public class HashChunkletManager implements ChunkletManager {
@Override @Override
public void cleanUp() { public void cleanUp() {
for(String key : store.keySet()) { for (String key : store.keySet()) {
if(store.get(key).isEmpty()) { if (store.get(key).isEmpty()) {
String[] info = key.split(","); String[] info = key.split(",");
File dataDir = new File(Bukkit.getWorld(info[0]).getWorldFolder(), "mcmmo_data"); File dataDir = new File(Bukkit.getWorld(info[0]).getWorldFolder(), "mcmmo_data");
File cxDir = new File(dataDir, "" + info[1]); File cxDir = new File(dataDir, "" + info[1]);
if(!cxDir.exists()) continue; if (!cxDir.exists()) continue;
File czDir = new File(cxDir, "" + info[2]); File czDir = new File(cxDir, "" + info[2]);
if(!czDir.exists()) continue; if (!czDir.exists()) continue;
File yFile = new File(czDir, "" + info[3]); File yFile = new File(czDir, "" + info[3]);
yFile.delete(); yFile.delete();
//Delete empty directories //Delete empty directories
if(czDir.list().length == 0) czDir.delete(); if (czDir.list().length == 0) czDir.delete();
if(cxDir.list().length == 0) cxDir.delete(); if (cxDir.list().length == 0) cxDir.delete();
} }
} }
} }
@ -282,7 +282,7 @@ public class HashChunkletManager implements ChunkletManager {
ObjectOutputStream objOut = null; ObjectOutputStream objOut = null;
try { try {
if(!location.exists()) if (!location.exists())
location.createNewFile(); location.createNewFile();
fileOut = new FileOutputStream(location); fileOut = new FileOutputStream(location);
objOut = new ObjectOutputStream(fileOut); objOut = new ObjectOutputStream(fileOut);
@ -374,9 +374,9 @@ public class HashChunkletManager implements ChunkletManager {
// IMPORTANT! If ChunkletStoreFactory is going to be returning something other than PrimitiveEx we need to remove this, as it will be breaking time for old maps // IMPORTANT! If ChunkletStoreFactory is going to be returning something other than PrimitiveEx we need to remove this, as it will be breaking time for old maps
/* /*
if(!(storeIn instanceof PrimitiveExChunkletStore)) { if (!(storeIn instanceof PrimitiveExChunkletStore)) {
ChunkletStore tempStore = ChunkletStoreFactory.getChunkletStore(); ChunkletStore tempStore = ChunkletStoreFactory.getChunkletStore();
if(storeIn != null) { if (storeIn != null) {
tempStore.copyFrom(storeIn); tempStore.copyFrom(storeIn);
} }
storeIn = tempStore; storeIn = tempStore;

View File

@ -23,10 +23,10 @@ public class PrimitiveChunkletStore implements ChunkletStore {
@Override @Override
public boolean isEmpty() { public boolean isEmpty() {
for(int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
for(int y = 0; y < 64; y++) { for (int y = 0; y < 64; y++) {
if(store[x][z][y]) return false; if (store[x][z][y]) return false;
} }
} }
} }
@ -35,9 +35,9 @@ public class PrimitiveChunkletStore implements ChunkletStore {
@Override @Override
public void copyFrom(ChunkletStore otherStore) { public void copyFrom(ChunkletStore otherStore) {
for(int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
for(int y = 0; y < 64; y++) { for (int y = 0; y < 64; y++) {
store[x][z][y] = otherStore.isTrue(x, y, z); store[x][z][y] = otherStore.isTrue(x, y, z);
} }
} }

View File

@ -28,10 +28,10 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
@Override @Override
public boolean isEmpty() { public boolean isEmpty() {
for(int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
for(int y = 0; y < 64; y++) { for (int y = 0; y < 64; y++) {
if(store[x][z][y]) return false; if (store[x][z][y]) return false;
} }
} }
} }
@ -40,9 +40,9 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
@Override @Override
public void copyFrom(ChunkletStore otherStore) { public void copyFrom(ChunkletStore otherStore) {
for(int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
for(int y = 0; y < 64; y++) { for (int y = 0; y < 64; y++) {
store[x][z][y] = otherStore.isTrue(x, y, z); store[x][z][y] = otherStore.isTrue(x, y, z);
} }
} }
@ -54,13 +54,13 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
byte[] buffer = new byte[2304]; // 2304 is 16*16*9 byte[] buffer = new byte[2304]; // 2304 is 16*16*9
int bufferIndex = 0; int bufferIndex = 0;
for(int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
for(int y = 0; y < 64; y++) { for (int y = 0; y < 64; y++) {
if(store[x][z][y]) { if (store[x][z][y]) {
byte[] temp = constructColumn(x, z); byte[] temp = constructColumn(x, z);
for(int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
buffer[bufferIndex] = temp[i]; buffer[bufferIndex] = temp[i];
bufferIndex++; bufferIndex++;
} }
@ -81,13 +81,13 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
byte[] temp = new byte[9]; byte[] temp = new byte[9];
// Could probably reorganize this loop to print nasty things if it does not equal 9 or -1 // Could probably reorganize this loop to print nasty things if it does not equal 9 or -1
while(in.read(temp, 0, 9) == 9) { while (in.read(temp, 0, 9) == 9) {
int x = addressByteX(temp[0]); int x = addressByteX(temp[0]);
int z = addressByteZ(temp[0]); int z = addressByteZ(temp[0]);
boolean[] yColumn = new boolean[64]; boolean[] yColumn = new boolean[64];
for(int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
for(int j = 0; j < 8; j++) { for (int j = 0; j < 8; j++) {
yColumn[j + (i * 8)] = (temp[i + 1] & (1 << j)) != 0; yColumn[j + (i * 8)] = (temp[i + 1] & (1 << j)) != 0;
} }
} }
@ -127,13 +127,13 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
column[0] = makeAddressByte(x, z); column[0] = makeAddressByte(x, z);
for (int i = 0; i < 8; i++){ for (int i = 0; i < 8; i++) {
byte yCompressed = 0x0; byte yCompressed = 0x0;
int subColumnIndex = 8 * i; int subColumnIndex = 8 * i;
int subColumnEnd = subColumnIndex + 8; int subColumnEnd = subColumnIndex + 8;
for(int y = subColumnIndex; y < subColumnEnd; y++) { for (int y = subColumnIndex; y < subColumnEnd; y++) {
if(store[x][z][y]) { if (store[x][z][y]) {
yCompressed |= 1 << (y % 8); yCompressed |= 1 << (y % 8);
} }
} }

View File

@ -6,10 +6,10 @@ public class ChunkManagerFactory {
public static ChunkManager getChunkManager() { public static ChunkManager getChunkManager() {
HiddenConfig hConfig = HiddenConfig.getInstance(); HiddenConfig hConfig = HiddenConfig.getInstance();
if(hConfig.getChunkletsEnabled()) { if (hConfig.getChunkletsEnabled()) {
return new HashChunkManager(); return new HashChunkManager();
} else {
return new NullChunkManager();
} }
return new NullChunkManager();
} }
} }

View File

@ -38,12 +38,11 @@ public class HashChunkManager implements ChunkManager {
public synchronized void closeAll() { public synchronized void closeAll() {
for (UUID uid : regionFiles.keySet()) { for (UUID uid : regionFiles.keySet()) {
HashMap<Long, mcMMOSimpleRegionFile> worldRegions = regionFiles.get(uid); HashMap<Long, mcMMOSimpleRegionFile> worldRegions = regionFiles.get(uid);
Iterator<mcMMOSimpleRegionFile> itr = worldRegions.values().iterator(); for (Iterator<mcMMOSimpleRegionFile> worldRegionIterator = worldRegions.values().iterator(); worldRegionIterator.hasNext();) {
while (itr.hasNext()) { mcMMOSimpleRegionFile rf = worldRegionIterator.next();
mcMMOSimpleRegionFile rf = itr.next();
if (rf != null) { if (rf != null) {
rf.close(); rf.close();
itr.remove(); worldRegionIterator.remove();
} }
} }
} }
@ -62,9 +61,9 @@ public class HashChunkManager implements ChunkManager {
Object o = objectStream.readObject(); Object o = objectStream.readObject();
if (o instanceof ChunkStore) { if (o instanceof ChunkStore) {
return (ChunkStore) o; return (ChunkStore) o;
} else {
throw new RuntimeException("Wrong class type read for chunk meta data for " + x + ", " + z);
} }
throw new RuntimeException("Wrong class type read for chunk meta data for " + x + ", " + z);
} catch (IOException e) { } catch (IOException e) {
// Assume the format changed // Assume the format changed
return null; return null;
@ -144,19 +143,19 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void loadChunk(int cx, int cz, World world) { public synchronized void loadChunk(int cx, int cz, World world) {
if(world == null) if (world == null)
return; return;
if(store.containsKey(world.getName() + "," + cx + "," + cz)) if (store.containsKey(world.getName() + "," + cx + "," + cz))
return; return;
ChunkStore in = null; ChunkStore in = null;
UUID key = world.getUID(); UUID key = world.getUID();
if(!this.oldData.containsKey(key)) if (!this.oldData.containsKey(key))
this.oldData.put(key, (new File(world.getWorldFolder(), "mcmmo_data")).exists()); this.oldData.put(key, (new File(world.getWorldFolder(), "mcmmo_data")).exists());
if(this.oldData.containsKey(key) && oldData.get(key)) if (this.oldData.containsKey(key) && oldData.get(key))
convertChunk(new File(world.getWorldFolder(), "mcmmo_data"), cx, cz, world, true); convertChunk(new File(world.getWorldFolder(), "mcmmo_data"), cx, cz, world, true);
try { try {
@ -164,20 +163,20 @@ public class HashChunkManager implements ChunkManager {
} }
catch(Exception e) {} catch(Exception e) {}
if(in != null) { if (in != null) {
store.put(world.getName() + "," + cx + "," + cz, in); store.put(world.getName() + "," + cx + "," + cz, in);
List<UUID> mobs = in.getSpawnedMobs(); List<UUID> mobs = in.getSpawnedMobs();
List<UUID> pets = in.getSpawnedPets(); List<UUID> pets = in.getSpawnedPets();
if(mobs.isEmpty() && pets.isEmpty()) if (mobs.isEmpty() && pets.isEmpty())
return; return;
for(LivingEntity entity : world.getLivingEntities()) { for (LivingEntity entity : world.getLivingEntities()) {
if(mobs.contains(entity.getUniqueId())) if (mobs.contains(entity.getUniqueId()))
addSpawnedMob(entity); addSpawnedMob(entity);
if(pets.contains(entity.getUniqueId())) if (pets.contains(entity.getUniqueId()))
addSpawnedPet(entity); addSpawnedPet(entity);
} }
@ -190,24 +189,24 @@ public class HashChunkManager implements ChunkManager {
public synchronized void unloadChunk(int cx, int cz, World world) { public synchronized void unloadChunk(int cx, int cz, World world) {
saveChunk(cx, cz, world); saveChunk(cx, cz, world);
if(store.containsKey(world.getName() + "," + cx + "," + cz)) { if (store.containsKey(world.getName() + "," + cx + "," + cz)) {
store.remove(world.getName() + "," + cx + "," + cz); store.remove(world.getName() + "," + cx + "," + cz);
for(Entity entity : spawnedMobs) { for (Entity entity : spawnedMobs) {
if(!isEntityInChunk(entity, cx, cz, world)) if (!isEntityInChunk(entity, cx, cz, world))
continue; continue;
mobsToRemove.add(entity); mobsToRemove.add(entity);
} }
for(Entity entity : spawnedPets) { for (Entity entity : spawnedPets) {
if(!isEntityInChunk(entity, cx, cz, world)) if (!isEntityInChunk(entity, cx, cz, world))
continue; continue;
mobsToRemove.add(entity); mobsToRemove.add(entity);
} }
if(safeToRemoveMobs) { if (safeToRemoveMobs) {
spawnedMobs.remove(mobsToRemove); spawnedMobs.remove(mobsToRemove);
spawnedPets.remove(mobsToRemove); spawnedPets.remove(mobsToRemove);
mobsToRemove.clear(); mobsToRemove.clear();
@ -217,14 +216,14 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void saveChunk(int cx, int cz, World world) { public synchronized void saveChunk(int cx, int cz, World world) {
if(world == null) if (world == null)
return; return;
boolean unloaded = false; boolean unloaded = false;
if(!store.containsKey(world.getName() + "," + cx + "," + cz)) { if (!store.containsKey(world.getName() + "," + cx + "," + cz)) {
List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs); List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs);
for(Entity entity : tempSpawnedMobs) { for (Entity entity : tempSpawnedMobs) {
if(!isEntityInChunk(entity, cx, cz, world)) if (!isEntityInChunk(entity, cx, cz, world))
continue; continue;
loadChunk(cx, cz, world); loadChunk(cx, cz, world);
@ -232,10 +231,10 @@ public class HashChunkManager implements ChunkManager {
break; break;
} }
if(!unloaded) { if (!unloaded) {
List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets); List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets);
for(Entity entity : tempSpawnedPets) { for (Entity entity : tempSpawnedPets) {
if(!isEntityInChunk(entity, cx, cz, world)) if (!isEntityInChunk(entity, cx, cz, world))
continue; continue;
loadChunk(cx, cz, world); loadChunk(cx, cz, world);
@ -245,31 +244,31 @@ public class HashChunkManager implements ChunkManager {
} }
} }
if(!store.containsKey(world.getName() + "," + cx + "," + cz) && unloaded) { if (!store.containsKey(world.getName() + "," + cx + "," + cz) && unloaded) {
ChunkStore cStore = ChunkStoreFactory.getChunkStore(world, cx, cz); ChunkStore cStore = ChunkStoreFactory.getChunkStore(world, cx, cz);
store.put(world.getName() + "," + cx + "," + cz, cStore); store.put(world.getName() + "," + cx + "," + cz, cStore);
} }
if(store.containsKey(world.getName() + "," + cx + "," + cz)) { if (store.containsKey(world.getName() + "," + cx + "," + cz)) {
ChunkStore out = store.get(world.getName() + "," + cx + "," + cz); ChunkStore out = store.get(world.getName() + "," + cx + "," + cz);
List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs); List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs);
for(Entity entity : tempSpawnedMobs) { for (Entity entity : tempSpawnedMobs) {
if(!isEntityInChunk(entity, cx, cz, world)) if (!isEntityInChunk(entity, cx, cz, world))
continue; continue;
out.addSpawnedMob(entity.getUniqueId()); out.addSpawnedMob(entity.getUniqueId());
} }
List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets); List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets);
for(Entity entity : tempSpawnedPets) { for (Entity entity : tempSpawnedPets) {
if(!isEntityInChunk(entity, cx, cz, world)) if (!isEntityInChunk(entity, cx, cz, world))
continue; continue;
out.addSpawnedPet(entity.getUniqueId()); out.addSpawnedPet(entity.getUniqueId());
} }
if(!out.isDirty()) if (!out.isDirty())
return; return;
writeChunkStore(world, cx, cz, out); writeChunkStore(world, cx, cz, out);
@ -277,16 +276,16 @@ public class HashChunkManager implements ChunkManager {
} }
private boolean isEntityInChunk(Entity entity, int cx, int cz, World world) { private boolean isEntityInChunk(Entity entity, int cx, int cz, World world) {
if(entity == null || world == null) if (entity == null || world == null)
return false; return false;
if(entity.getLocation().getChunk().getX() != cx) if (entity.getLocation().getChunk().getX() != cx)
return false; return false;
if(entity.getLocation().getChunk().getZ() != cz) if (entity.getLocation().getChunk().getZ() != cz)
return false; return false;
if(entity.getWorld() != world) if (entity.getWorld() != world)
return false; return false;
return true; return true;
@ -294,7 +293,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized boolean isChunkLoaded(int cx, int cz, World world) { public synchronized boolean isChunkLoaded(int cx, int cz, World world) {
if(world == null) if (world == null)
return false; return false;
return store.containsKey(world.getName() + "," + cx + "," + cz); return store.containsKey(world.getName() + "," + cx + "," + cz);
@ -305,7 +304,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void chunkUnloaded(int cx, int cz, World world) { public synchronized void chunkUnloaded(int cx, int cz, World world) {
if(world == null) if (world == null)
return; return;
ChunkletUnloader.addToList(cx, cz, world); ChunkletUnloader.addToList(cx, cz, world);
@ -313,16 +312,16 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void saveWorld(World world) { public synchronized void saveWorld(World world) {
if(world == null) if (world == null)
return; return;
closeAll(); closeAll();
String worldName = world.getName(); String worldName = world.getName();
List<String> keys = new ArrayList<String>(store.keySet()); List<String> keys = new ArrayList<String>(store.keySet());
for(String key : keys) { for (String key : keys) {
String[] info = key.split(","); String[] info = key.split(",");
if(worldName.equals(info[0])) { if (worldName.equals(info[0])) {
int cx = 0; int cx = 0;
int cz = 0; int cz = 0;
@ -338,10 +337,10 @@ public class HashChunkManager implements ChunkManager {
} }
List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs); List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs);
for(Entity entity : tempSpawnedMobs) { for (Entity entity : tempSpawnedMobs) {
World entityWorld = entity.getWorld(); World entityWorld = entity.getWorld();
if(world != entityWorld) if (world != entityWorld)
continue; continue;
int cx = entity.getLocation().getChunk().getX(); int cx = entity.getLocation().getChunk().getX();
@ -351,10 +350,10 @@ public class HashChunkManager implements ChunkManager {
} }
List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets); List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets);
for(Entity entity : tempSpawnedPets) { for (Entity entity : tempSpawnedPets) {
World entityWorld = entity.getWorld(); World entityWorld = entity.getWorld();
if(world != entityWorld) if (world != entityWorld)
continue; continue;
int cx = entity.getLocation().getChunk().getX(); int cx = entity.getLocation().getChunk().getX();
@ -366,16 +365,16 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void unloadWorld(World world) { public synchronized void unloadWorld(World world) {
if(world == null) if (world == null)
return; return;
closeAll(); closeAll();
String worldName = world.getName(); String worldName = world.getName();
List<String> keys = new ArrayList<String>(store.keySet()); List<String> keys = new ArrayList<String>(store.keySet());
for(String key : keys) { for (String key : keys) {
String[] info = key.split(","); String[] info = key.split(",");
if(worldName.equals(info[0])) { if (worldName.equals(info[0])) {
int cx = 0; int cx = 0;
int cz = 0; int cz = 0;
@ -393,10 +392,10 @@ public class HashChunkManager implements ChunkManager {
safeToRemoveMobs = false; safeToRemoveMobs = false;
List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs); List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs);
for(Entity entity : tempSpawnedMobs) { for (Entity entity : tempSpawnedMobs) {
World entityWorld = entity.getWorld(); World entityWorld = entity.getWorld();
if(world != entityWorld) if (world != entityWorld)
continue; continue;
int cx = entity.getLocation().getChunk().getX(); int cx = entity.getLocation().getChunk().getX();
@ -406,10 +405,10 @@ public class HashChunkManager implements ChunkManager {
} }
List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets); List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets);
for(Entity entity : tempSpawnedPets) { for (Entity entity : tempSpawnedPets) {
World entityWorld = entity.getWorld(); World entityWorld = entity.getWorld();
if(world != entityWorld) if (world != entityWorld)
continue; continue;
int cx = entity.getLocation().getChunk().getX(); int cx = entity.getLocation().getChunk().getX();
@ -432,7 +431,7 @@ public class HashChunkManager implements ChunkManager {
public synchronized void saveAll() { public synchronized void saveAll() {
closeAll(); closeAll();
for(World world : Bukkit.getWorlds()) { for (World world : Bukkit.getWorlds()) {
saveWorld(world); saveWorld(world);
} }
} }
@ -441,14 +440,14 @@ public class HashChunkManager implements ChunkManager {
public synchronized void unloadAll() { public synchronized void unloadAll() {
closeAll(); closeAll();
for(World world : Bukkit.getWorlds()) { for (World world : Bukkit.getWorlds()) {
unloadWorld(world); unloadWorld(world);
} }
} }
@Override @Override
public synchronized boolean isTrue(int x, int y, int z, World world) { public synchronized boolean isTrue(int x, int y, int z, World world) {
if(world == null) if (world == null)
return false; return false;
int cx = x / 16; int cx = x / 16;
@ -472,7 +471,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized boolean isTrue(Block block) { public synchronized boolean isTrue(Block block) {
if(block == null) if (block == null)
return false; return false;
return isTrue(block.getX(), block.getY(), block.getZ(), block.getWorld()); return isTrue(block.getX(), block.getY(), block.getZ(), block.getWorld());
@ -480,7 +479,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void setTrue(int x, int y, int z, World world) { public synchronized void setTrue(int x, int y, int z, World world) {
if(world == null) if (world == null)
return; return;
int cx = x / 16; int cx = x / 16;
@ -507,7 +506,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void setTrue(Block block) { public synchronized void setTrue(Block block) {
if(block == null) if (block == null)
return; return;
setTrue(block.getX(), block.getY(), block.getZ(), block.getWorld()); setTrue(block.getX(), block.getY(), block.getZ(), block.getWorld());
@ -515,7 +514,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void setFalse(int x, int y, int z, World world) { public synchronized void setFalse(int x, int y, int z, World world) {
if(world == null) if (world == null)
return; return;
int cx = x / 16; int cx = x / 16;
@ -541,7 +540,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void setFalse(Block block) { public synchronized void setFalse(Block block) {
if(block == null) if (block == null)
return; return;
setFalse(block.getX(), block.getY(), block.getZ(), block.getWorld()); setFalse(block.getX(), block.getY(), block.getZ(), block.getWorld());
@ -555,21 +554,21 @@ public class HashChunkManager implements ChunkManager {
} }
public synchronized void convertChunk(File dataDir, int cx, int cz, World world, boolean actually) { public synchronized void convertChunk(File dataDir, int cx, int cz, World world, boolean actually) {
if(!actually) if (!actually)
return; return;
if(!dataDir.exists()) return; if (!dataDir.exists()) return;
File cxDir = new File(dataDir, "" + cx); File cxDir = new File(dataDir, "" + cx);
if(!cxDir.exists()) return; if (!cxDir.exists()) return;
File czDir = new File(cxDir, "" + cz); File czDir = new File(cxDir, "" + cz);
if(!czDir.exists()) return; if (!czDir.exists()) return;
boolean conversionSet = false; boolean conversionSet = false;
for(BlockStoreConversionZDirectory converter : this.converters) { for (BlockStoreConversionZDirectory converter : this.converters) {
if(converter == null) if (converter == null)
continue; continue;
if(converter.taskID >= 0) if (converter.taskID >= 0)
continue; continue;
converter.start(world, cxDir, czDir); converter.start(world, cxDir, czDir);
@ -577,7 +576,7 @@ public class HashChunkManager implements ChunkManager {
break; break;
} }
if(!conversionSet) { if (!conversionSet) {
BlockStoreConversionZDirectory converter = new BlockStoreConversionZDirectory(); BlockStoreConversionZDirectory converter = new BlockStoreConversionZDirectory();
converter.start(world, cxDir, czDir); converter.start(world, cxDir, czDir);
converters.add(converter); converters.add(converter);
@ -593,22 +592,22 @@ public class HashChunkManager implements ChunkManager {
} }
public void addSpawnedMob(Entity entity) { public void addSpawnedMob(Entity entity) {
if(!isSpawnedMob(entity)) if (!isSpawnedMob(entity))
spawnedMobs.add(entity); spawnedMobs.add(entity);
} }
public void addSpawnedPet(Entity entity) { public void addSpawnedPet(Entity entity) {
if(!isSpawnedPet(entity)) if (!isSpawnedPet(entity))
spawnedPets.add(entity); spawnedPets.add(entity);
} }
public void removeSpawnedMob(Entity entity) { public void removeSpawnedMob(Entity entity) {
if(isSpawnedMob(entity)) if (isSpawnedMob(entity))
spawnedMobs.remove(entity); spawnedMobs.remove(entity);
} }
public void removeSpawnedPet(Entity entity) { public void removeSpawnedPet(Entity entity) {
if(isSpawnedPet(entity)) if (isSpawnedPet(entity))
spawnedPets.remove(entity); spawnedPets.remove(entity);
} }
} }

View File

@ -82,10 +82,10 @@ public class PrimitiveChunkStore implements ChunkStore {
@Override @Override
public boolean isEmpty() { public boolean isEmpty() {
for(int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
for(int y = 0; y < this.worldHeight; y++) { for (int y = 0; y < this.worldHeight; y++) {
if(store[x][z][y]) return false; if (store[x][z][y]) return false;
} }
} }
} }
@ -94,9 +94,9 @@ public class PrimitiveChunkStore implements ChunkStore {
@Override @Override
public void copyFrom(ChunkletStore otherStore) { public void copyFrom(ChunkletStore otherStore) {
for(int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
for(int y = 0; y < this.worldHeight; y++) { for (int y = 0; y < this.worldHeight; y++) {
store[x][z][y] = otherStore.isTrue(x, y, z); store[x][z][y] = otherStore.isTrue(x, y, z);
} }
} }
@ -113,42 +113,42 @@ public class PrimitiveChunkStore implements ChunkStore {
} }
public void addSpawnedMob(UUID id) { public void addSpawnedMob(UUID id) {
if(!isSpawnedMob(id)) { if (!isSpawnedMob(id)) {
spawnedMobs.add(id); spawnedMobs.add(id);
dirty = true; dirty = true;
} }
} }
public void addSpawnedPet(UUID id) { public void addSpawnedPet(UUID id) {
if(!isSpawnedPet(id)) { if (!isSpawnedPet(id)) {
spawnedPets.add(id); spawnedPets.add(id);
dirty = true; dirty = true;
} }
} }
public void removeSpawnedMob(UUID id) { public void removeSpawnedMob(UUID id) {
if(isSpawnedMob(id)) { if (isSpawnedMob(id)) {
spawnedMobs.remove(id); spawnedMobs.remove(id);
dirty = true; dirty = true;
} }
} }
public void removeSpawnedPet(UUID id) { public void removeSpawnedPet(UUID id) {
if(isSpawnedPet(id)) { if (isSpawnedPet(id)) {
spawnedPets.remove(id); spawnedPets.remove(id);
dirty = true; dirty = true;
} }
} }
public void clearSpawnedMobs() { public void clearSpawnedMobs() {
if(!spawnedMobs.isEmpty()) { if (!spawnedMobs.isEmpty()) {
spawnedMobs.clear(); spawnedMobs.clear();
dirty = true; dirty = true;
} }
} }
public void clearSpawnedPets() { public void clearSpawnedPets() {
if(!spawnedPets.isEmpty()) { if (!spawnedPets.isEmpty()) {
spawnedPets.clear(); spawnedPets.clear();
dirty = true; dirty = true;
} }
@ -204,16 +204,16 @@ public class PrimitiveChunkStore implements ChunkStore {
store = (boolean[][][]) in.readObject(); store = (boolean[][][]) in.readObject();
if (fileVersionNumber < CURRENT_VERSION) { if (fileVersionNumber < CURRENT_VERSION) {
if(fileVersionNumber < 5) if (fileVersionNumber < 5)
fixArray(); fixArray();
if(fileVersionNumber < 6) { if (fileVersionNumber < 6) {
spawnedMobs = new ArrayList<UUID>(); spawnedMobs = new ArrayList<UUID>();
spawnedPets = new ArrayList<UUID>(); spawnedPets = new ArrayList<UUID>();
} }
dirty = true; dirty = true;
} }
if(fileVersionNumber >= 6) { if (fileVersionNumber >= 6) {
//What do we want to do about this? These casts are unchecked. //What do we want to do about this? These casts are unchecked.
spawnedMobs = (ArrayList<UUID>) in.readObject(); spawnedMobs = (ArrayList<UUID>) in.readObject();
spawnedPets = (ArrayList<UUID>) in.readObject(); spawnedPets = (ArrayList<UUID>) in.readObject();
@ -223,9 +223,9 @@ public class PrimitiveChunkStore implements ChunkStore {
private void fixArray() { private void fixArray() {
boolean[][][] temp = this.store; boolean[][][] temp = this.store;
this.store = new boolean[16][16][this.worldHeight]; this.store = new boolean[16][16][this.worldHeight];
for(int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
for(int y = 0; y < this.worldHeight; y++) { for (int y = 0; y < this.worldHeight; y++) {
try { try {
store[x][z][y] = temp[x][y][z]; store[x][z][y] = temp[x][y][z];
} }

View File

@ -84,9 +84,8 @@ public class ZipLibrary {
if (path == null || path.isEmpty()) { if (path == null || path.isEmpty()) {
return file; return file;
} }
else {
return path + File.separator + file; return path + File.separator + file;
}
} }
private static void zipDir(ZipOutputStream zos, String path, File dir) throws IOException { private static void zipDir(ZipOutputStream zos, String path, File dir) throws IOException {

View File

@ -216,9 +216,9 @@ public class mcMMOSimpleRegionFile {
if (old != null && old == used) { if (old != null && old == used) {
if (old) { if (old) {
throw new IllegalStateException("Attempting to overwrite an in-use segment"); throw new IllegalStateException("Attempting to overwrite an in-use segment");
} else {
throw new IllegalStateException("Attempting to delete empty segment");
} }
throw new IllegalStateException("Attempting to delete empty segment");
} }
} }
@ -271,9 +271,9 @@ public class mcMMOSimpleRegionFile {
private synchronized int sizeToSegments(int size) { private synchronized int sizeToSegments(int size) {
if (size <= 0) { if (size <= 0) {
return 1; return 1;
} else {
return ((size - 1) >> segmentSize) + 1;
} }
return ((size - 1) >> segmentSize) + 1;
} }
private synchronized Integer getChunkIndex(int x, int z) { private synchronized Integer getChunkIndex(int x, int z) {

View File

@ -126,7 +126,7 @@ Skills:
DoubleDrops_ChanceMax: 100 DoubleDrops_ChanceMax: 100
DoubleDrops_MaxBonusLevel: 1000 DoubleDrops_MaxBonusLevel: 1000
# BlastMining rank unlocks # BlastMining_Rank: BlastMining rank unlocks
BlastMining_Rank1: 125 BlastMining_Rank1: 125
BlastMining_Rank2: 250 BlastMining_Rank2: 250
BlastMining_Rank3: 375 BlastMining_Rank3: 375
@ -135,49 +135,117 @@ Skills:
BlastMining_Rank6: 750 BlastMining_Rank6: 750
BlastMining_Rank7: 875 BlastMining_Rank7: 875
BlastMining_Rank8: 1000 BlastMining_Rank8: 1000
#
# Settings for Repair
###
Repair: Repair:
RepairMastery_ChanceMax: 200 # RepairMastery_ChanceMax: Maximum bonus percentage for Repair Mastery
# RepairMastery_MaxBonusLevel: On this level, the maximum bonus is reached
RepairMastery_MaxBonusPercentage: 200
RepairMastery_MaxBonusLevel: 1000 RepairMastery_MaxBonusLevel: 1000
# SuperRepair_ChanceMax: Maximum chance of Super Repair
# SuperRepair_MaxBonusLevel: On this level, Super Repair chance will be SuperRepair_ChanceMax
SuperRepair_ChanceMax: 100 SuperRepair_ChanceMax: 100
SuperRepair_MaxBonusLevel: 1000 SuperRepair_MaxBonusLevel: 1000
#
# Settings for Swords
###
Swords: Swords:
# Bleed_ChanceMax: Maximum chance of triggering bleeding
# Bleed_MaxBonusLevel: On this level, the chance to cause Bleeding will be Bleed_ChanceMax
Bleed_ChanceMax: 75 Bleed_ChanceMax: 75
Bleed_MaxBonusLevel: 750 Bleed_MaxBonusLevel: 750
# These settings determine how long the Bleeding effect lasts
Bleed_MaxTicks: 3 Bleed_MaxTicks: 3
Bleed_BaseTicks: 2 Bleed_BaseTicks: 2
# Counter_ChanceMax: Maximum chance of triggering a counter attack
# Counter_MaxBonusLevel: On this level, the chance to Counter will be Counter_ChanceMax
Counter_ChanceMax: 30 Counter_ChanceMax: 30
Counter_MaxBonusLevel: 600 Counter_MaxBonusLevel: 600
# Counter_DamageModifier: Damaged caused by the damager will get divided by this modifier and dealt back to the damager
Counter_DamageModifier: 2 Counter_DamageModifier: 2
# SerratedStrikes_DamageModifier: Damage will get divided by this modifier
# SerratedStrikes_BleedTicks: This determines how long the bleeding effect of SerratedStrikes lasts
SerratedStrikes_DamageModifier: 4 SerratedStrikes_DamageModifier: 4
SerratedStrikes_BleedTicks: 5 SerratedStrikes_BleedTicks: 5
#
# Settings for Taming
###
Taming: Taming:
# Gore_ChanceMax: Maximum chance of triggering gore
# Gore_MaxBonusLevel: On this level, the chance to cause Gore will be Gore_ChanceMax
Gore_ChanceMax: 100 Gore_ChanceMax: 100
Gore_MaxBonusLevel: 1000 Gore_MaxBonusLevel: 1000
# Gore_BleedTicks: Determines the length of the bleeding effect
# Gore_Modifier: Damage will get multiplied by this modifier
Gore_BleedTicks: 2 Gore_BleedTicks: 2
Gore_Modifier: 2 Gore_Modifier: 2
# FastFood_UnlockLevel: Level when FastFood unlocks
# FastFood_Chance: The chance for wolves to heal hp when inflicting damage
FastFood_UnlockLevel: 50 FastFood_UnlockLevel: 50
FastFood_Chance: 50 FastFood_Chance: 50
# EnvironmentallyAware_UnlockLevel: Level when EnvironmentallyAware unlocks
EnvironmentallyAware_UnlockLevel: 100 EnvironmentallyAware_UnlockLevel: 100
# ThickFur_UnlockLevel: Level when ThickFur unlocks
# ThickFur_Modifier: Damage will get divided by this modifier
ThickFur_UnlockLevel: 250 ThickFur_UnlockLevel: 250
ThickFur_Modifier: 2 ThickFur_Modifier: 2
# ShockProof_UnlockLevel: Level when ShockProof unlocks
# ShockProof_Modifier: Damage will get divided by this modifier
ShockProof_UnlockLevel: 500 ShockProof_UnlockLevel: 500
ShockProof_Modifier: 6 ShockProof_Modifier: 6
# SharpenedClaws_UnlockLevel: Level when SharpenedClaws unlocks
# SharpenedClaws_Bonus: This bonus will get added to the damage caused
SharpenedClaws_UnlockLevel: 750 SharpenedClaws_UnlockLevel: 750
SharpenedClaws_Bonus: 2 SharpenedClaws_Bonus: 2
#
# Settings for Unarmed
###
Unarmed: Unarmed:
# Disarm_ChanceMax: Maximum chance of disarming other players
# Disarm_MaxBonusLevel: Level when the maximum chance to disarm is reached
Disarm_ChanceMax: 33 Disarm_ChanceMax: 33
Disarm_MaxBonusLevel: 1000 Disarm_MaxBonusLevel: 1000
# Deflect_ChanceMax: Maximum chance of deflecting arrows
# Deflect_MaxBonusLevel: Level when the maximum chance to deflect is reached
Deflect_ChanceMax: 50 Deflect_ChanceMax: 50
Deflect_MaxBonusLevel: 1000 Deflect_MaxBonusLevel: 1000
# IronGrip_ChanceMax: Maximum chance of preventing being disarmed
# IronGrip_MaxBonusLevel: Level when the maximum chance to prevent being disarmed is reached
IronGrip_ChanceMax: 100 IronGrip_ChanceMax: 100
IronGrip_MaxBonusLevel: 1000 IronGrip_MaxBonusLevel: 1000
IronArmBonus: 8
# IronArmBonusMax: Maximum bonus damage for unarmed
# IronArm_IncreaseLevel: Bonus damage increases every increase level
IronArmBonusMax: 8
IronArm_IncreaseLevel: 50 IronArm_IncreaseLevel: 50
#
# Settings for Woodcutting
###
Woodcutting: Woodcutting:
# LeafBlower_UnlockLevel: At this level, the passive ability LeafBlower unlocks
LeafBlower_UnlockLevel: 100 LeafBlower_UnlockLevel: 100
# DoubleDrops_ChanceMax: Maximum chance of receiving double drops
# DoubleDrops_MaxBonusLevel: Level when the maximum chance of receiving double drops is reached
DoubleDrops_ChanceMax: 100 DoubleDrops_ChanceMax: 100
DoubleDrops_MaxBonusLevel: 1000 DoubleDrops_MaxBonusLevel: 1000
Spout: Spout:
#
# Settings for the Spout notifications, when a player reaches a higher tier, the image of the notification will change.
###
Notifications: Notifications:
Tier1: 200 Tier1: 200
Tier2: 400 Tier2: 400

View File

@ -86,7 +86,7 @@ Fishing.Effect.4=Shake (vs. Entities)
Fishing.Effect.5=Vyklepni p\u0159edm\u011bty z p\u0159\u00ed\u0161er s prutem Fishing.Effect.5=Vyklepni p\u0159edm\u011bty z p\u0159\u00ed\u0161er s prutem
Fishing.Effect.6=Fisherman\'s Diet Fishing.Effect.6=Fisherman\'s Diet
Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Effect.7=Improves hunger restored from fished foods
Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0}% Fishing.Enchant.Chance=[[RED]]\u0160ance na magick\u00e9ho lovce: [[YELLOW]]{0}
Fishing.ItemFound=[[GRAY]]Nasel si poklad! Fishing.ItemFound=[[GRAY]]Nasel si poklad!
Fishing.Listener=Rybareni: Fishing.Listener=Rybareni:
Fishing.MagicFound=[[GRAY]]C\u00edt\u00edte dotek magie s t\u00edmto \u00falovkem... Fishing.MagicFound=[[GRAY]]C\u00edt\u00edte dotek magie s t\u00edmto \u00falovkem...
@ -417,7 +417,7 @@ Commands.XPGain.Repair=Opravovani
Commands.XPGain.Swords=Zabijenim monster. Commands.XPGain.Swords=Zabijenim monster.
Commands.XPGain.Taming=Ochoceni zvirat nebo boj s vlky Commands.XPGain.Taming=Ochoceni zvirat nebo boj s vlky
Commands.XPGain.Unarmed=Zabijenim monster. Commands.XPGain.Unarmed=Zabijenim monster.
Commands.XPGain.WoodCutting=Kaceni stromu Commands.XPGain.Woodcutting=Chopping down trees
Commands.XPGain=[[DARK_GRAY]]Zisk dovednosti: [[WHITE]]{0} Commands.XPGain=[[DARK_GRAY]]Zisk dovednosti: [[WHITE]]{0}
Commands.xplock.locked=[[GOLD]]Tvuj XP bar byl uzamcen na {0}! Commands.xplock.locked=[[GOLD]]Tvuj XP bar byl uzamcen na {0}!
Commands.xplock.unlocked=[[GOLD]]Tvuj XP bar je nyni [[GREEN]]ODEMCEN[[GOLD]]! Commands.xplock.unlocked=[[GOLD]]Tvuj XP bar je nyni [[GREEN]]ODEMCEN[[GOLD]]!
@ -464,6 +464,7 @@ Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck Perks.lucky.name=Luck
Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate.
Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate. Perks.lucky.desc.login=Gives certain skills and abilities a 33.3% better chance to activate.
Perks.lucky.bonus=[[GOLD]] ({0}% with Lucky Perk)
Perks.cooldowns.name=Fast Recovery Perks.cooldowns.name=Fast Recovery
Perks.cooldowns.desc=Cuts cooldown duration by {0}. Perks.cooldowns.desc=Cuts cooldown duration by {0}.
Perks.activationtime.name=Endurance Perks.activationtime.name=Endurance

View File

@ -1,5 +1,5 @@
Acrobatics.Ability.Proc=[[GREEN]]**Graceful Landing** Acrobatics.Ability.Proc=[[GREEN]]**Graceful Landing**
Acrobatics.Combat.Proc=[[GWYRDD]] **osgoi\'r** Acrobatics.Combat.Proc=[[GREEN]] **osgoi\'r**
Acrobatics.DodgeChance=[[RED]]Dodge Chance: [[YELLOW]]{0}% Acrobatics.DodgeChance=[[RED]]Dodge Chance: [[YELLOW]]{0}%
Acrobatics.Effect.0=Roll Acrobatics.Effect.0=Roll
Acrobatics.Effect.1=Reduces or Negates fall damage Acrobatics.Effect.1=Reduces or Negates fall damage
@ -12,7 +12,7 @@ Acrobatics.Roll.Chance=[[RED]]Roll Chance: [[YELLOW]]{0}%
Acrobatics.Roll.GraceChance=[[RED]]Graceful Roll Chance: [[YELLOW]]{0}% Acrobatics.Roll.GraceChance=[[RED]]Graceful Roll Chance: [[YELLOW]]{0}%
Acrobatics.Roll.Text=**Rolled** Acrobatics.Roll.Text=**Rolled**
Acrobatics.SkillName=ACROBATEG Acrobatics.SkillName=ACROBATEG
Acrobatics.Skillup=[[MELYN]] Acrobateg sgil cynyddu {0}. Cyfanswm ({1}) Acrobatics.Skillup=[[YELLOW]] Acrobateg sgil cynyddu {0}. Cyfanswm ({1})
Archery.Combat.DazeChance=[[RED]]Chance to Daze: [[YELLOW]]{0}% Archery.Combat.DazeChance=[[RED]]Chance to Daze: [[YELLOW]]{0}%
Archery.Combat.RetrieveChance=[[RED]]Chance to Retrieve Arrows: [[YELLOW]]{0}% Archery.Combat.RetrieveChance=[[RED]]Chance to Retrieve Arrows: [[YELLOW]]{0}%
Archery.Combat.SkillshotBonus=[[RED]]Skill Shot Bonus Damage: [[YELLOW]]{0} Archery.Combat.SkillshotBonus=[[RED]]Skill Shot Bonus Damage: [[YELLOW]]{0}
@ -24,7 +24,7 @@ Archery.Effect.4=Arrow Retrieval
Archery.Effect.5=Chance to retrieve arrows from corpses Archery.Effect.5=Chance to retrieve arrows from corpses
Archery.Listener=Archery: Archery.Listener=Archery:
Archery.SkillName=ARCHERY Archery.SkillName=ARCHERY
Archery.Skillup=[[MELYN]] sgiliau Saethyddiaeth cynyddu {0}. Cyfanswm ({1}) Archery.Skillup=[[YELLOW]] sgiliau Saethyddiaeth cynyddu {0}. Cyfanswm ({1})
Axes.Ability.Bonus.0=Axe Mastery Axes.Ability.Bonus.0=Axe Mastery
Axes.Ability.Bonus.1=Bonus {0} damage Axes.Ability.Bonus.1=Bonus {0} damage
Axes.Ability.Bonus.2=Impact Axes.Ability.Bonus.2=Impact
@ -38,7 +38,7 @@ Axes.Combat.CritStruck=[[DARK_RED]]You were CRITICALLY hit!
Axes.Combat.CritChance=[[RED]]Chance to critically strike: [[YELLOW]]{0}% Axes.Combat.CritChance=[[RED]]Chance to critically strike: [[YELLOW]]{0}%
Axes.Combat.CriticalHit=[[RED]]CRITICAL HIT! Axes.Combat.CriticalHit=[[RED]]CRITICAL HIT!
Axes.Combat.GI.Proc=[[GREEN]]**STRUCK WITH GREAT FORCE** Axes.Combat.GI.Proc=[[GREEN]]**STRUCK WITH GREAT FORCE**
Axes.Combat.GI.Struck=[[COCH]] ** ** BRIFO GAN EFFAITH FWYAF Axes.Combat.GI.Struck=[[RED]] ** ** BRIFO GAN EFFAITH FWYAF
Axes.Combat.SS.Length=[[RED]]Skull Splitter Length: [[YELLOW]]{0}s Axes.Combat.SS.Length=[[RED]]Skull Splitter Length: [[YELLOW]]{0}s
Axes.Effect.0=Skull Splitter (Ability) Axes.Effect.0=Skull Splitter (Ability)
Axes.Effect.1=Deal AoE Damage Axes.Effect.1=Deal AoE Damage
@ -54,10 +54,10 @@ Axes.Listener=Axes:
Axes.SkillName=AXES Axes.SkillName=AXES
Axes.Skills.SS.Off=[[RED]]**Skull Splitter has worn off** Axes.Skills.SS.Off=[[RED]]**Skull Splitter has worn off**
Axes.Skills.SS.On=actifadu Penglog Llorweddol Axes.Skills.SS.On=actifadu Penglog Llorweddol
Axes.Skills.SS.Refresh=[[GWYRDD]] Eich [[MELYN]] Penglog Llorweddol [[GWYRDD]] gallu ei hadnewyddu! Axes.Skills.SS.Refresh=[[GREEN]] Eich [[YELLOW]] Penglog Llorweddol [[GREEN]] gallu ei hadnewyddu!
Axes.Skills.SS.Other.Off=[[RED]]Skull Splitter[[GREEN]] has worn off for [[YELLOW]]{0} Axes.Skills.SS.Other.Off=[[RED]]Skull Splitter[[GREEN]] has worn off for [[YELLOW]]{0}
Axes.Skills.SS.Other.On=[[GWYRDD]] {0} [[TYWYLL_GWYRDD]] wedi defnyddio [[COCH]] Llorweddol Benglog! Axes.Skills.SS.Other.On=[[GREEN]] {0} [[DARK_GREEN]] wedi defnyddio [[RED]] Llorweddol Benglog!
Axes.Skillup=[[MELYN]] sgiliau Echelau cynyddu {0}. Cyfanswm ({1}) Axes.Skillup=[[YELLOW]] sgiliau Echelau cynyddu {0}. Cyfanswm ({1})
Excavation.Ability.Lower=[[GRAY]]**YOU LOWER YOUR SHOVEL** Excavation.Ability.Lower=[[GRAY]]**YOU LOWER YOUR SHOVEL**
Excavation.Ability.Ready=[[GREEN]]**YOU READY YOUR SHOVEL** Excavation.Ability.Ready=[[GREEN]]**YOU READY YOUR SHOVEL**
Excavation.Effect.0=Giga Drill Breaker (ABILITY) Excavation.Effect.0=Giga Drill Breaker (ABILITY)
@ -115,16 +115,16 @@ Herbalism.Listener=Meddygaeth lysieuol:
Herbalism.SkillName=HERBALISM Herbalism.SkillName=HERBALISM
Herbalism.Skills.GTe.Off=[[RED]]**Green Terra has worn off** Herbalism.Skills.GTe.Off=[[RED]]**Green Terra has worn off**
Herbalism.Skills.GTe.On=[[GREEN]]**GREEN TERRA ACTIVATED** Herbalism.Skills.GTe.On=[[GREEN]]**GREEN TERRA ACTIVATED**
Herbalism.Skills.GTe.Refresh=[[GWYRDD]] Eich [[MELYN]] Gwyrdd Terra [[GWYRDD]] gallu ei hadnewyddu! Herbalism.Skills.GTe.Refresh=[[GREEN]] Eich [[YELLOW]] Green Terra [[GREEN]] gallu ei hadnewyddu!
Herbalism.Skills.GTe.Other.Off=[[COCH]] gwyrdd terra [[GWYRDD]] wedi gwisgo i ffwrdd ar gyfer [[MELYN]] {0} Herbalism.Skills.GTe.Other.Off=[[RED]] Green terra [[GREEN]] wedi gwisgo i ffwrdd ar gyfer [[YELLOW]] {0}
Herbalism.Skills.GTe.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Green Terra! Herbalism.Skills.GTe.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Green Terra!
Herbalism.Skillup=[[YELLOW]]Herbalism skill increased by {0}. Total ({1}) Herbalism.Skillup=[[YELLOW]]Herbalism skill increased by {0}. Total ({1})
Mining.Ability.Length=[[COCH]] Hyd Torri\'r Super: [[MELYN]] {0} s Mining.Ability.Length=[[RED]] Hyd Torri\'r Super: [[YELLOW]] {0} s
Mining.Ability.Locked.0=LOCKED UNTIL {0}+ SKILL (BLAST MINING) Mining.Ability.Locked.0=LOCKED UNTIL {0}+ SKILL (BLAST MINING)
Mining.Ability.Locked.1=LOCKED UNTIL {0}+ SKILL (BIGGER BOMBS) Mining.Ability.Locked.1=LOCKED UNTIL {0}+ SKILL (BIGGER BOMBS)
Mining.Ability.Locked.2=LOCKED UNTIL {0}+ SKILL (DEMOLITIONS EXPERTISE) Mining.Ability.Locked.2=LOCKED UNTIL {0}+ SKILL (DEMOLITIONS EXPERTISE)
Mining.Ability.Lower=[[GRAY]]**YOU LOWER YOUR PICKAXE** Mining.Ability.Lower=[[GRAY]]**YOU LOWER YOUR PICKAXE**
Mining.Ability.Ready=[[GWYRDD]] ** CHI\'N BAROD EICH PICKAXE ** Mining.Ability.Ready=[[GREEN]] ** CHI\'N BAROD EICH PICKAXE **
Mining.Effect.0=Super Breaker (ABILITY) Mining.Effect.0=Super Breaker (ABILITY)
Mining.Effect.1=Speed+, Triple Drop Chance Mining.Effect.1=Speed+, Triple Drop Chance
Mining.Effect.2=Double Drops Mining.Effect.2=Double Drops
@ -143,8 +143,8 @@ Mining.Skills.SuperBreaker.Off=[[RED]]**Super Breaker has worn off**
Mining.Skills.SuperBreaker.On=[[GREEN]]**SUPER BREAKER ACTIVATED** Mining.Skills.SuperBreaker.On=[[GREEN]]**SUPER BREAKER ACTIVATED**
Mining.Skills.SuperBreaker.Other.Off=[[RED]]Super Breaker[[GREEN]] has worn off for [[YELLOW]]{0} Mining.Skills.SuperBreaker.Other.Off=[[RED]]Super Breaker[[GREEN]] has worn off for [[YELLOW]]{0}
Mining.Skills.SuperBreaker.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Super Breaker! Mining.Skills.SuperBreaker.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Super Breaker!
Mining.Skills.SuperBreaker.Refresh=[[GWYRDD]] Eich [[MELYN]] Super Torri\'r [[GWYRDD]] gallu ei hadnewyddu! Mining.Skills.SuperBreaker.Refresh=[[GREEN]] Eich [[YELLOW]] Super Torri\'r [[GREEN]] gallu ei hadnewyddu!
Mining.Skillup=[[MELYN]] sgiliau Mwyngloddio cynyddu {0}. Cyfanswm ({1}) Mining.Skillup=[[YELLOW]] sgiliau Mwyngloddio cynyddu {0}. Cyfanswm ({1})
Mining.Blast.Boom=[[GRAY]]**BOOM** Mining.Blast.Boom=[[GRAY]]**BOOM**
Mining.Blast.Effect.0=+35% ore yield Mining.Blast.Effect.0=+35% ore yield
Mining.Blast.Effect.1=+40% ore yield Mining.Blast.Effect.1=+40% ore yield
@ -154,10 +154,10 @@ Mining.Blast.Effect.4=+55% ore yield, no debris, double drops
Mining.Blast.Effect.5=+60% ore yield, no debris, double drops Mining.Blast.Effect.5=+60% ore yield, no debris, double drops
Mining.Blast.Effect.6=+65% ore yield, no debris, triple drops Mining.Blast.Effect.6=+65% ore yield, no debris, triple drops
Mining.Blast.Effect.7=+70% ore yield, no debris, triple drops Mining.Blast.Effect.7=+70% ore yield, no debris, triple drops
Mining.Blast.Radius.Increase=[[COCH]] Chwyth Cynnydd Radiws [[MELYN]] {0} Mining.Blast.Radius.Increase=[[RED]] Chwyth Cynnydd Radiws [[YELLOW]] {0}
Mining.Blast.Rank=[[RED]]Blast Mining: [[YELLOW]] Rank {0}/8 [[GRAY]]({1}) Mining.Blast.Rank=[[RED]]Blast Mining: [[YELLOW]] Rank {0}/8 [[GRAY]]({1})
Mining.Blast.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Blast Mining! Mining.Blast.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Blast Mining!
Mining.Blast.Refresh=[[GWYRDD]] Eich [[MELYN]] Mwyngloddio Chwyth [[GWYRDD]] gallu ei hadnewyddu! Mining.Blast.Refresh=[[GREEN]] Eich [[YELLOW]] Mwyngloddio Chwyth [[GREEN]] gallu ei hadnewyddu!
Repair.Effect.0=Repair Repair.Effect.0=Repair
Repair.Effect.1=Repair Tools & Armor Repair.Effect.1=Repair Tools & Armor
Repair.Effect.10=Gold Repair ({0}+ SKILL) Repair.Effect.10=Gold Repair ({0}+ SKILL)
@ -181,10 +181,10 @@ Repair.Listener.Anvil2=[[DARK_RED]]You have placed a Salvage anvil, use this to
Repair.Listener=Atgyweirio: Repair.Listener=Atgyweirio:
Repair.SkillName=ATGYWEIRIO: Repair.SkillName=ATGYWEIRIO:
Repair.Skills.AdeptSalvage=[[DARK_RED]]You\'re not skilled enough to Salvage items. Repair.Skills.AdeptSalvage=[[DARK_RED]]You\'re not skilled enough to Salvage items.
Repair.Skills.AdeptDiamond=[[TYWYLL_COCH]] Dydych chi ddim yn ddigon medrus i drwsio Diemwnt. Repair.Skills.AdeptDiamond=[[DARK_RED]] Dydych chi ddim yn ddigon medrus i drwsio Diemwnt.
Repair.Skills.AdeptGold=[[TYWYLL COCH]] Dydych chi ddim yn ddigon medrus i drwsio Aur. Repair.Skills.AdeptGold=[[DARK RED]] Dydych chi ddim yn ddigon medrus i drwsio Aur.
Repair.Skills.AdeptIron=[[DARK_RED]]You\'re not skilled enough to repair Iron. Repair.Skills.AdeptIron=[[DARK_RED]]You\'re not skilled enough to repair Iron.
Repair.Skills.AdeptStone=[[TYWYLL_COCH]] Dydych chi ddim yn ddigon medrus i drwsio cerrig. Repair.Skills.AdeptStone=[[DARK_RED]] Dydych chi ddim yn ddigon medrus i drwsio cerrig.
Repair.Skills.Adept=[[RED]]You must be level [[YELLOW]]{0}[[RED]] to repair [[YELLOW]]{1} Repair.Skills.Adept=[[RED]]You must be level [[YELLOW]]{0}[[RED]] to repair [[YELLOW]]{1}
Repair.Skills.FeltEasy=[[GRAY]]That felt easy. Repair.Skills.FeltEasy=[[GRAY]]That felt easy.
Repair.Skills.FullDurability=[[GRAY]]That is at full durability. Repair.Skills.FullDurability=[[GRAY]]That is at full durability.
@ -193,26 +193,26 @@ Repair.Skills.NotFullDurability=[[DARK_RED]]You can\'t salvage damaged items.
Repair.Skills.Mastery=[[RED]]Repair Mastery: [[YELLOW]]Extra {0}% durability restored Repair.Skills.Mastery=[[RED]]Repair Mastery: [[YELLOW]]Extra {0}% durability restored
Repair.Skills.StackedItems=[[DARK_RED]]You can\'t repair stacked items. Repair.Skills.StackedItems=[[DARK_RED]]You can\'t repair stacked items.
Repair.Skills.Super.Chance=[[RED]]Super Repair Chance: [[YELLOW]]{0}% Repair.Skills.Super.Chance=[[RED]]Super Repair Chance: [[YELLOW]]{0}%
Repair.Skillup=[[MELYN]] sgiliau Atgyweirio cynyddu {0}. Cyfanswm ({1}) Repair.Skillup=[[YELLOW]] sgiliau Atgyweirio cynyddu {0}. Cyfanswm ({1})
Repair.Arcane.Chance.Downgrade=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}% Repair.Arcane.Chance.Downgrade=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}%
Repair.Arcane.Chance.Success=[[GRAY]] Cyfradd Llwyddiant AF: [[MELYN]] {0}% Repair.Arcane.Chance.Success=[[GRAY]] Cyfradd Llwyddiant AF: [[YELLOW]] {0}%
Repair.Arcane.Downgrade=[[RED]]Arcane power has decreased for this item. Repair.Arcane.Downgrade=[[RED]]Arcane power has decreased for this item.
Repair.Arcane.Fail=[[RED]]P\u0175er dirgel wedi gadael yr eitem barhaol Repair.Arcane.Fail=[[RED]]P\u0175er dirgel wedi gadael yr eitem barhaol
Repair.Arcane.Lost=[[RED]]You were not skilled enough to keep any enchantments. Repair.Arcane.Lost=[[RED]]You were not skilled enough to keep any enchantments.
Repair.Arcane.Perfect=[[GREEN]]You have sustained the arcane energies in this item. Repair.Arcane.Perfect=[[GREEN]]You have sustained the arcane energies in this item.
Repair.Arcane.Rank=[[RED]]Arcane Forging: [[YELLOW]]Rank {0}/4 Repair.Arcane.Rank=[[RED]]Arcane Forging: [[YELLOW]]Rank {0}/4
Swords.Ability.Lower=[[GRAY]] ** I LEIHAU EICH CLEDDYF ** Swords.Ability.Lower=[[GRAY]] ** I LEIHAU EICH CLEDDYF **
Swords.Ability.Ready=[[GWYRDD]] ** CHI\'N BAROD EICH SWORD ** Swords.Ability.Ready=[[GREEN]] ** CHI\'N BAROD EICH SWORD **
Swords.Combat.Bleed.Chance=[[RED]]Bleed Chance: [[YELLOW]]{0}% Swords.Combat.Bleed.Chance=[[RED]]Bleed Chance: [[YELLOW]]{0}%
Swords.Combat.Bleed.Length=[[RED]]Bleed Length: [[YELLOW]]{0} ticks Swords.Combat.Bleed.Length=[[RED]]Bleed Length: [[YELLOW]]{0} ticks
Swords.Combat.Bleed.Note=[[GRAY]]NOTE: [[YELLOW]]1 Tick happens every 2 seconds Swords.Combat.Bleed.Note=[[GRAY]]NOTE: [[YELLOW]]1 Tick happens every 2 seconds
Swords.Combat.Bleeding.Started=[[DARK_RED]] You\'re bleeding! Swords.Combat.Bleeding.Started=[[DARK_RED]] You\'re bleeding!
Swords.Combat.Bleeding.Stopped=[[GRAY]] y gwaedu wedi [[GWYRDD]] rhoi\'r gorau i [[GRAY]]! Swords.Combat.Bleeding.Stopped=[[GRAY]] y gwaedu wedi [[GREEN]] rhoi\'r gorau i [[GRAY]]!
Swords.Combat.Bleeding=[[GWYRDD]]** GELYN GWAEDU\'N** Swords.Combat.Bleeding=[[GREEN]]** GELYN GWAEDU\'N**
Swords.Combat.Counter.Chance=[[RED]]Counter Attack Chance: [[YELLOW]]{0}% Swords.Combat.Counter.Chance=[[RED]]Counter Attack Chance: [[YELLOW]]{0}%
Swords.Combat.Counter.Hit=[[DARK_RED]]Hit with a counter-attack! Swords.Combat.Counter.Hit=[[DARK_RED]]Hit with a counter-attack!
Swords.Combat.Countered=[[GWYRDD]] ** GWRTH-YMOSOD ** Swords.Combat.Countered=[[GREEN]] ** GWRTH-YMOSOD **
Swords.Combat.SS.Struck=[[TYWYLL_COCH]] Taro gan Streiciau danheddog! Swords.Combat.SS.Struck=[[DARK_RED]] Taro gan Streiciau danheddog!
Swords.Effect.0=Counter Attack Swords.Effect.0=Counter Attack
Swords.Effect.1=Reflect 50% of damage taken Swords.Effect.1=Reflect 50% of damage taken
Swords.Effect.2=Serrated Strikes (ABILITY) Swords.Effect.2=Serrated Strikes (ABILITY)
@ -224,7 +224,7 @@ Swords.Effect.7=Apply a bleed DoT
Swords.Listener=Swords: Swords.Listener=Swords:
Swords.SkillName=SWORDS Swords.SkillName=SWORDS
Swords.Skills.SS.Off=[[RED]]**Serrated Strikes has worn off** Swords.Skills.SS.Off=[[RED]]**Serrated Strikes has worn off**
Swords.Skills.SS.On=[[GWYRDD]] ** Streiciau danheddog actifadu ** Swords.Skills.SS.On=[[GREEN]] ** Streiciau danheddog actifadu **
Swords.Skills.SS.Refresh=[[GREEN]]Your [[YELLOW]]Serrated Strikes [[GREEN]]ability is refreshed! Swords.Skills.SS.Refresh=[[GREEN]]Your [[YELLOW]]Serrated Strikes [[GREEN]]ability is refreshed!
Swords.Skills.SS.Other.Off=[[RED]] Streiciau danheddog [[GREEN]] wedi gwisgo i ffwrdd ar gyfer [[YELLOW]] {0} Swords.Skills.SS.Other.Off=[[RED]] Streiciau danheddog [[GREEN]] wedi gwisgo i ffwrdd ar gyfer [[YELLOW]] {0}
Swords.Skills.SS.Other.On=[[GREEN]] {0} [[DARK_GREEN]] wedi defnyddio [[RED]] Streiciau danheddog! Swords.Skills.SS.Other.On=[[GREEN]] {0} [[DARK_GREEN]] wedi defnyddio [[RED]] Streiciau danheddog!
@ -267,14 +267,14 @@ Taming.Effect.9=DMG Reduction, Fire Resistance
Taming.Listener.Wolf=[[DARK_GRAY]] Eich sgrialu i blaidd yn \u00f4l i chi ... Taming.Listener.Wolf=[[DARK_GRAY]] Eich sgrialu i blaidd yn \u00f4l i chi ...
Taming.Listener=Taming: Taming.Listener=Taming:
Taming.SkillName=TAMING Taming.SkillName=TAMING
Taming.Skillup=[[MELYN]] sgiliau Ddofi cynyddu {0}.\u00a0Cyfanswm ({1}) Taming.Skillup=[[YELLOW]] sgiliau Ddofi cynyddu {0}.\u00a0Cyfanswm ({1})
Taming.Summon.Complete=[[GREEN]]Summoning complete Taming.Summon.Complete=[[GREEN]]Summoning complete
Taming.Summon.Fail.Ocelot=[[RED]]You have too many ocelots nearby to summon any more. Taming.Summon.Fail.Ocelot=[[RED]]You have too many ocelots nearby to summon any more.
Taming.Summon.Fail.Wolf=[[RED]]You have too many wolves nearby to summon any more. Taming.Summon.Fail.Wolf=[[RED]]You have too many wolves nearby to summon any more.
Unarmed.Ability.Berserk.Length=[[RED]]Berserk Length: [[YELLOW]]{0}s Unarmed.Ability.Berserk.Length=[[RED]]Berserk Length: [[YELLOW]]{0}s
Unarmed.Ability.Bonus.0=Iron Arm Style Unarmed.Ability.Bonus.0=Iron Arm Style
Unarmed.Ability.Bonus.1=+{0} DMG Upgrade Unarmed.Ability.Bonus.1=+{0} DMG Upgrade
Unarmed.Ability.Chance.ArrowDeflect=[[COCH]] Saeth wyro cyfle: [[MELYN]] {0}% Unarmed.Ability.Chance.ArrowDeflect=[[RED]] Saeth wyro cyfle: [[YELLOW]] {0}%
Unarmed.Ability.Chance.Disarm=[[RED]]Disarm Chance: [[YELLOW]]{0}% Unarmed.Ability.Chance.Disarm=[[RED]]Disarm Chance: [[YELLOW]]{0}%
Unarmed.Ability.Lower=[[GRAY]]**YOU LOWER YOUR FISTS** Unarmed.Ability.Lower=[[GRAY]]**YOU LOWER YOUR FISTS**
Unarmed.Ability.Ready=[[GREEN]]**YOU READY YOUR FISTS** Unarmed.Ability.Ready=[[GREEN]]**YOU READY YOUR FISTS**
@ -288,10 +288,10 @@ Unarmed.Effect.6=Arrow Deflect
Unarmed.Effect.7=Deflect arrows Unarmed.Effect.7=Deflect arrows
Unarmed.Listener=Dim Arfau: Unarmed.Listener=Dim Arfau:
Unarmed.SkillName=UNARMED Unarmed.SkillName=UNARMED
Unarmed.Skills.Berserk.Off=[[COCH]] ** arno\'i hun wedi gwisgo i ffwrdd ** Unarmed.Skills.Berserk.Off=[[RED]] ** arno\'i hun wedi gwisgo i ffwrdd **
Unarmed.Skills.Berserk.On=[[GREEN]]**BERSERK ACTIVATED** Unarmed.Skills.Berserk.On=[[GREEN]]**BERSERK ACTIVATED**
Unarmed.Skills.Berserk.Other.Off=[[COCH]] arno\'i hun [[GWYRDD]] wedi gwisgo i ffwrdd ar gyfer [[MELYN]] {0} Unarmed.Skills.Berserk.Other.Off=[[RED]] arno\'i hun [[GREEN]] wedi gwisgo i ffwrdd ar gyfer [[YELLOW]] {0}
Unarmed.Skills.Berserk.Other.On=[[GWYRDD]] {0} [[TYWYLL_GWYRDD]] wedi defnyddio [[COCH]] arno\'i hun! Unarmed.Skills.Berserk.Other.On=[[GREEN]] {0} [[DARK_GREEN]] wedi defnyddio [[RED]] arno\'i hun!
Unarmed.Skills.Berserk.Refresh=[[GREEN]]Your [[YELLOW]]Berserk [[GREEN]]ability is refreshed! Unarmed.Skills.Berserk.Refresh=[[GREEN]]Your [[YELLOW]]Berserk [[GREEN]]ability is refreshed!
Unarmed.Skillup=[[YELLOW]]Unarmed skill increased by {0}. Total ({1}) Unarmed.Skillup=[[YELLOW]]Unarmed skill increased by {0}. Total ({1})
Woodcutting.Ability.0=Chwythwr o ddail Woodcutting.Ability.0=Chwythwr o ddail
@ -309,18 +309,18 @@ Woodcutting.Listener=Woodcutting:
Woodcutting.SkillName=Torri coed Woodcutting.SkillName=Torri coed
Woodcutting.Skills.TreeFeller.Off=[[RED]]**Tree Feller has worn off** Woodcutting.Skills.TreeFeller.Off=[[RED]]**Tree Feller has worn off**
Woodcutting.Skills.TreeFeller.On=[[GREEN]]**TREE FELLER ACTIVATED** Woodcutting.Skills.TreeFeller.On=[[GREEN]]**TREE FELLER ACTIVATED**
Woodcutting.Skills.TreeFeller.Refresh=[[GWYRDD]] Eich [[MELYN]] Feller Coed [[GWYRDD]] gallu ei hadnewyddu! Woodcutting.Skills.TreeFeller.Refresh=[[GREEN]] Eich [[YELLOW]] Feller Coed [[GREEN]] gallu ei hadnewyddu!
Woodcutting.Skills.TreeFeller.Other.Off=[[COCH]] Feller Coed [[GWYRDD]] wedi gwisgo i ffwrdd ar gyfer [[MELYN]] {0} Woodcutting.Skills.TreeFeller.Other.Off=[[RED]] Feller Coed [[GREEN]] wedi gwisgo i ffwrdd ar gyfer [[YELLOW]] {0}
Woodcutting.Skills.TreeFeller.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Tree Feller! Woodcutting.Skills.TreeFeller.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Tree Feller!
Woodcutting.Skills.TreeFeller.Splinter=[[COCH]] EICH AXE GWAHANU I DDWSINAU O DARNAU! Woodcutting.Skills.TreeFeller.Splinter=[[RED]] EICH AXE GWAHANU I DDWSINAU O DARNAU!
Woodcutting.Skills.TreeFellerThreshold=[[RED]]That tree is too large! Woodcutting.Skills.TreeFellerThreshold=[[RED]]That tree is too large!
Woodcutting.Skillup=[[YELLOW]]Woodcutting skill increased by {0}. Total ({1}) Woodcutting.Skillup=[[YELLOW]]Woodcutting skill increased by {0}. Total ({1})
Ability.Generic.Refresh=[[GREEN]]**ABILITIES REFRESHED!** Ability.Generic.Refresh=[[GREEN]]**ABILITIES REFRESHED!**
Ability.Generic.Template.Lock=[[GRAY]]{0} Ability.Generic.Template.Lock=[[GRAY]]{0}
Ability.Generic.Template=[[coch]]{0}: [[melyn]]{1} Ability.Generic.Template=[[RED]]{0}: [[YELLOW]]{1}
Combat.ArrowDeflect=[[WHITE]]**ARROW DEFLECT** Combat.ArrowDeflect=[[WHITE]]**ARROW DEFLECT**
Combat.BeastLore=[[GWYRDD]] ** bwystfil ll\u00ean ** Combat.BeastLore=[[GREEN]] ** bwystfil ll\u00ean **
Combat.BeastLoreHealth=[[TYWYLL_AQUA]] Iechyd ([[GWYRDD]] {0} [[TYWYLL_AQUA]] / {1}) Combat.BeastLoreHealth=[[DARK_AQUA]] Iechyd ([[GREEN]] {0} [[DARK_AQUA]] / {1})
Combat.BeastLoreOwner=[[DARK_AQUA]]Owner ([[RED]]{0}[[DARK_AQUA]]) Combat.BeastLoreOwner=[[DARK_AQUA]]Owner ([[RED]]{0}[[DARK_AQUA]])
Combat.BurningArrowHit=[[DARK_RED]]You were struck by a burning arrow! Combat.BurningArrowHit=[[DARK_RED]]You were struck by a burning arrow!
Combat.Gore=[[GREEN]]**GORED** Combat.Gore=[[GREEN]]**GORED**
@ -331,20 +331,20 @@ Combat.TouchedFuzzy=[[DARK_RED]] cyffwrdd Fuzzy. Teimlo benysgafn.
mcMMO.Description=[[DARK_AQUA]]About the [[YELLOW]]mcMMO[[DARK_AQUA]] Project:,[[GOLD]]mcMMO is an [[RED]]open source[[GOLD]] RPG mod created in February 2011,[[GOLD]]by [[BLUE]]nossr50[[GOLD]]. The goal is to provide a quality RPG experience.,[[DARK_AQUA]]Tips:,[[GOLD]] - [[GREEN]]Use [[RED]]/mcc[[GREEN]] to see commands,[[GOLD]] - [[GREEN]]Type [[RED]]/SKILLNAME[[GREEN]] to see detailed skill info,[[DARK_AQUA]]Developers:,[[GOLD]] - [[GREEN]]nossr50 [[BLUE]](Project Lead),[[GOLD]] - [[GREEN]]GJ [[BLUE]](Senior Developer),[[GOLD]] - [[GREEN]]NuclearW [[BLUE]](Developer),[[GOLD]] - [[GREEN]]bm01 [[BLUE]](Developer),[[DARK_AQUA]]Useful Links:,[[GOLD]] - [[GREEN]]issues.mcmmo.org[[GOLD]] Bug Reporting,[[GOLD]] - [[GREEN]]#mcmmo @ irc.esper.net[[GOLD]] IRC Chat,[[GOLD]] - [[GREEN]]http://bit.ly/H6XwFb[[GOLD]] Bukkit Forum Thread mcMMO.Description=[[DARK_AQUA]]About the [[YELLOW]]mcMMO[[DARK_AQUA]] Project:,[[GOLD]]mcMMO is an [[RED]]open source[[GOLD]] RPG mod created in February 2011,[[GOLD]]by [[BLUE]]nossr50[[GOLD]]. The goal is to provide a quality RPG experience.,[[DARK_AQUA]]Tips:,[[GOLD]] - [[GREEN]]Use [[RED]]/mcc[[GREEN]] to see commands,[[GOLD]] - [[GREEN]]Type [[RED]]/SKILLNAME[[GREEN]] to see detailed skill info,[[DARK_AQUA]]Developers:,[[GOLD]] - [[GREEN]]nossr50 [[BLUE]](Project Lead),[[GOLD]] - [[GREEN]]GJ [[BLUE]](Senior Developer),[[GOLD]] - [[GREEN]]NuclearW [[BLUE]](Developer),[[GOLD]] - [[GREEN]]bm01 [[BLUE]](Developer),[[DARK_AQUA]]Useful Links:,[[GOLD]] - [[GREEN]]issues.mcmmo.org[[GOLD]] Bug Reporting,[[GOLD]] - [[GREEN]]#mcmmo @ irc.esper.net[[GOLD]] IRC Chat,[[GOLD]] - [[GREEN]]http://bit.ly/H6XwFb[[GOLD]] Bukkit Forum Thread
Commands.Ability.Off=Ability use toggled [[RED]]off Commands.Ability.Off=Ability use toggled [[RED]]off
Commands.Ability.On=Ability use toggled [[GREEN]]on Commands.Ability.On=Ability use toggled [[GREEN]]on
Commands.AdminChat.Off=Admin Sgwrs unig [[COCH]] Oddi ar Commands.AdminChat.Off=Admin Sgwrs unig [[RED]] Oddi ar
Commands.AdminChat.On=Admin Chat only [[GREEN]]On Commands.AdminChat.On=Admin Chat only [[GREEN]]On
Commands.AdminToggle=[[COCH]] - sgwrs gweinyddol Toggle Commands.AdminToggle=[[RED]] - sgwrs gweinyddol Toggle
Commands.Disabled=[[COCH]] Mae\'r gorchymyn yn anabl. Commands.Disabled=[[RED]] Mae\'r gorchymyn yn anabl.
Commands.DoesNotExist=[[COCH]] nid Chwaraewr yn bodoli yn y gronfa ddata! Commands.DoesNotExist=[[RED]] nid Chwaraewr yn bodoli yn y gronfa ddata!
Commands.GodMode.Disabled=[[YELLOW]]mcMMO Godmode Disabled Commands.GodMode.Disabled=[[YELLOW]]mcMMO Godmode Disabled
Commands.GodMode.Enabled=[[YELLOW]]mcMMO Godmode Enabled Commands.GodMode.Enabled=[[YELLOW]]mcMMO Godmode Enabled
Commands.GodMode.Forbidden=[mcMMO] God Mode not permitted on this world (See Permissions) Commands.GodMode.Forbidden=[mcMMO] God Mode not permitted on this world (See Permissions)
Commands.Inspect=<player> [[RED]]- View detailed player info Commands.Inspect=<player> [[RED]]- View detailed player info
Commands.Invite.Accepted=[[GWYRDD]] Gwahodd Derbyniwyd. Yr ydych wedi ymuno parti {0} Commands.Invite.Accepted=[[GREEN]] Gwahodd Derbyniwyd. Yr ydych wedi ymuno parti {0}
Commands.Invite.Success=[[GREEN]]Invite sent successfully. Commands.Invite.Success=[[GREEN]]Invite sent successfully.
Commands.Leaderboards=<skill> <page> [[RED]]- Leaderboards Commands.Leaderboards=<skill> <page> [[RED]]- Leaderboards
Commands.mcgod=[[RED]]- Toggle GodMode Commands.mcgod=[[RED]]- Toggle GodMode
Commands.mmoedit=[chwaraewr] <skill> <newvalue> [[COCH]] - Targed addasu Commands.mmoedit=[chwaraewr] <skill> <newvalue> [[RED]] - Targed addasu
Commands.ModDescription=[[RED]]- Read brief mod description Commands.ModDescription=[[RED]]- Read brief mod description
Commands.NoConsole=This command does not support console usage. Commands.NoConsole=This command does not support console usage.
Commands.Other=[[GREEN]]--OTHER COMMANDS-- Commands.Other=[[GREEN]]--OTHER COMMANDS--
@ -352,12 +352,12 @@ Commands.Party.Accept=[[RED]]- Accept party invite
Commands.Party.Chat.Off=Party Chat only [[RED]]Off Commands.Party.Chat.Off=Party Chat only [[RED]]Off
Commands.Party.Chat.On=Party Chat only [[GREEN]]On Commands.Party.Chat.On=Party Chat only [[GREEN]]On
Commands.Party.Commands=[[GREEN]]--PARTY COMMANDS-- Commands.Party.Commands=[[GREEN]]--PARTY COMMANDS--
Commands.Party.Invite.0=[[COCH]] RHYBUDD: [[GWYRDD]] fod wedi derbyn gwahoddiad i barti {0} o {1} Commands.Party.Invite.0=[[RED]] RHYBUDD: [[GREEN]] fod wedi derbyn gwahoddiad i barti {0} o {1}
Commands.Party.Invite.1=[[MELYN]] Math [[GWYRDD]]/accept[[MELYN]] i dderbyn y gwahoddiad Commands.Party.Invite.1=[[YELLOW]] Math [[GREEN]]/accept[[YELLOW]] i dderbyn y gwahoddiad
Commands.Party.Invite=<player> [[RED]]- Send party invite Commands.Party.Invite=<player> [[RED]]- Send party invite
Commands.Party.Join=Joined Party: {0} Commands.Party.Join=Joined Party: {0}
Commands.Party.Kick=[[COCH]] oeddech yn cicio o blaid {0}! Commands.Party.Kick=[[RED]] oeddech yn cicio o blaid {0}!
Commands.Party.Leave=[[COCH]] Yr ydych wedi gadael y blaid honno Commands.Party.Leave=[[RED]] Yr ydych wedi gadael y blaid honno
Commands.Party.Members=[[GREEN]]Party Members: {0} Commands.Party.Members=[[GREEN]]Party Members: {0}
Commands.Party.None=[[RED]]You are not in a party. Commands.Party.None=[[RED]]You are not in a party.
Commands.Party.Quit=[[RED]]- Leave your current party Commands.Party.Quit=[[RED]]- Leave your current party
@ -378,7 +378,7 @@ mcMMO.NoInvites=[[RED]]You have no invites at this time
mcMMO.NoPermission=[[DARK_RED]]Insufficient permissions. mcMMO.NoPermission=[[DARK_RED]]Insufficient permissions.
mcMMO.NoSkillNote=[[DARK_GRAY]]If you don\'t have access to a skill it will not be shown here. mcMMO.NoSkillNote=[[DARK_GRAY]]If you don\'t have access to a skill it will not be shown here.
mcMMO.Website=[[GREEN]]http://forums.mcmmo.info[[BLUE]] - mcMMO Website mcMMO.Website=[[GREEN]]http://forums.mcmmo.info[[BLUE]] - mcMMO Website
Commands.Party.InParty=[[GWYRDD]]Parti: {0} Commands.Party.InParty=[[GREEN]]Parti: {0}
Party.Forbidden=[mcMMO] Parties not permitted on this world (See Permissions) Party.Forbidden=[mcMMO] Parties not permitted on this world (See Permissions)
Party.Help.0=[[RED]]Proper usage is /party <party-name> to join or /party q to quit Party.Help.0=[[RED]]Proper usage is /party <party-name> to join or /party q to quit
Party.Help.1=[[RED]]To join a passworded party, use /party <party-name> <password> Party.Help.1=[[RED]]To join a passworded party, use /party <party-name> <password>
@ -386,22 +386,22 @@ Party.Help.2=[[RED]]Consult /party ? for more information
Party.Help.3=[[RED]]Use /party <party-name> to join or /party q to quit Party.Help.3=[[RED]]Use /party <party-name> to join or /party q to quit
Party.Help.4=[[RED]]To lock or unlock your party, use /party <lock/unlock> Party.Help.4=[[RED]]To lock or unlock your party, use /party <lock/unlock>
Party.Help.5=[[RED]]To password protect your party, use /party password <password> Party.Help.5=[[RED]]To password protect your party, use /party password <password>
Party.Help.6=[[COCH]] I gicio chwaraewr o\'ch plaid, <player> cic defnydd / parti Party.Help.6=[[RED]] I gicio chwaraewr o\'ch plaid, <player> cic defnydd / parti
Party.Help.7=[[RED]]To transfer ownership of your party, use /party owner <player> Party.Help.7=[[RED]]To transfer ownership of your party, use /party owner <player>
Party.InformedOnJoin={0} [[GREEN]] has joined your party Party.InformedOnJoin={0} [[GREEN]] has joined your party
Party.InformedOnQuit={0} [[GWYRDD]] wedi gadael eich plaid Party.InformedOnQuit={0} [[GREEN]] wedi gadael eich plaid
Party.InvalidName=[[DARK_RED]]That is not a valid party name. Party.InvalidName=[[DARK_RED]]That is not a valid party name.
Party.IsLocked=[[RED]]This party is already locked! Party.IsLocked=[[RED]]This party is already locked!
Party.IsntLocked=[[RED]]This party is not locked! Party.IsntLocked=[[RED]]This party is not locked!
Party.Locked=[[RED]]Party is locked, only party leader may invite. Party.Locked=[[RED]]Party is locked, only party leader may invite.
Party.NotInYourParty=[[DARK_RED]]{0} is not in your party Party.NotInYourParty=[[DARK_RED]]{0} is not in your party
Party.NotOwner=[[DARK_RED]]You are not the party owner Party.NotOwner=[[DARK_RED]]You are not the party owner
Party.PasswordSet=[[GWYRDD]] Blaid cyfrinair wedi ei osod i {0} Party.PasswordSet=[[GREEN]] Blaid cyfrinair wedi ei osod i {0}
Party.Player.Invalid=[[COCH]] Nid yw hynny\'n chwaraewr ddilys. Party.Player.Invalid=[[RED]] Nid yw hynny\'n chwaraewr ddilys.
Party.Teleport.Dead=[[COCH]] Ni allwch teleport y chwaraewr yn farw. Party.Teleport.Dead=[[RED]] Ni allwch teleport y chwaraewr yn farw.
Party.Teleport.Hurt=[[RED]]You\'ve been hurt in the last {0} seconds and cannnot teleport. Party.Teleport.Hurt=[[RED]]You\'ve been hurt in the last {0} seconds and cannnot teleport.
Party.Teleport.Player=[[GREEN]]You have teleported to {0}. Party.Teleport.Player=[[GREEN]]You have teleported to {0}.
Party.Teleport.Target=[[GWYRDD]] {0} wedi teleported i chi. Party.Teleport.Target=[[GREEN]] {0} wedi teleported i chi.
Party.Unlocked=[[GRAY]] Blaid yn cael ei gloi Party.Unlocked=[[GRAY]] Blaid yn cael ei gloi
Commands.XPGain.Acrobatics=Falling Commands.XPGain.Acrobatics=Falling
Commands.XPGain.Archery=Attacking Monsters Commands.XPGain.Archery=Attacking Monsters
@ -415,7 +415,7 @@ Commands.XPGain.Swords=Angenfilod ymosod
Commands.XPGain.Taming=Anifeiliaid Taming, neu ymladd \u00e2\'ch bleiddiaid Commands.XPGain.Taming=Anifeiliaid Taming, neu ymladd \u00e2\'ch bleiddiaid
Commands.XPGain.Unarmed=Attacking Monsters Commands.XPGain.Unarmed=Attacking Monsters
Commands.XPGain.Woodcutting=Chopping down trees Commands.XPGain.Woodcutting=Chopping down trees
Commands.XPGain=[[DARK_GRAY]] Cael Profiad: [[GWYN]] {0} Commands.XPGain=[[DARK_GRAY]] Cael Profiad: [[WHITE]] {0}
Commands.xplock.locked=[[GOLD]]Your XP BAR is now locked to {0}! Commands.xplock.locked=[[GOLD]]Your XP BAR is now locked to {0}!
Commands.xplock.unlocked=[[GOLD]]Your XP BAR is now [[GREEN]]UNLOCKED[[GOLD]]! Commands.xplock.unlocked=[[GOLD]]Your XP BAR is now [[GREEN]]UNLOCKED[[GOLD]]!
Commands.xprate.over=[[RED]]mcMMO XP Rate Event is OVER!! Commands.xprate.over=[[RED]]mcMMO XP Rate Event is OVER!!
@ -424,17 +424,17 @@ Commands.xprate.proper.1=[[RED]]Proper usage to restore the XP rate to default i
Commands.xprate.proper.2=[[RED]]Please specify true or false to indicate if this is an xp event or not Commands.xprate.proper.2=[[RED]]Please specify true or false to indicate if this is an xp event or not
Commands.xprate.started.0=[[GOLD]]XP EVENT FOR mcMMO HAS STARTED! Commands.xprate.started.0=[[GOLD]]XP EVENT FOR mcMMO HAS STARTED!
Commands.xprate.started.1=[[GOLD]]mcMMO XP RATE IS NOW {0}x! Commands.xprate.started.1=[[GOLD]]mcMMO XP RATE IS NOW {0}x!
XPRate.Event=[[AUR]] mcMMO ar hyn o bryd mewn digwyddiad gyfradd XP! Gyfradd yn XP {0} x! XPRate.Event=[[GOLD]] mcMMO ar hyn o bryd mewn digwyddiad gyfradd XP! Gyfradd yn XP {0} x!
Effects.Effects=EFFEITHIAU Effects.Effects=EFFEITHIAU
Effects.Level=[[DARK_GRAY]]LVL: [[GREEN]]{0} [[DARK_AQUA]]XP[[YELLOW]]([[GOLD]]{1}[[YELLOW]]/[[GOLD]]{2}[[YELLOW]]) Effects.Level=[[DARK_GRAY]]LVL: [[GREEN]]{0} [[DARK_AQUA]]XP[[YELLOW]]([[GOLD]]{1}[[YELLOW]]/[[GOLD]]{2}[[YELLOW]])
Effects.Template=[[DARK_AQUA]]{0}: [[GREEN]]{1} Effects.Template=[[DARK_AQUA]]{0}: [[GREEN]]{1}
Guides.Acrobatics=[[DARK_AQUA]]About Acrobatics:\n[[YELLOW]]Acrobatics is the art of moving gracefully in mcMMO.\n[[YELLOW]]It provides combat bonuses and environment damage bonuses.\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]To gain XP in this skill you need to perform a dodge\n[[YELLOW]]in combat or survive falls from heights that damage you.\n\n[[DARK_AQUA]]How does Rolling work?\n[[YELLOW]]You have a passive chance when you take fall damage\n[[YELLOW]]to negate the damage done. You can hold the sneak button to\n[[YELLOW]]double your chances during the fall.\n[[YELLOW]]This triggers a Graceful Roll instead of a standard one.\n[[YELLOW]]Graceful Rolls are like regular rolls but are twice as likely to\n[[YELLOW]]occur and provide more damage safety than regular rolls.\n[[YELLOW]]Rolling chance is tied to your skill level\n[[DARK_AQUA]]How does Dodge work?\n[[YELLOW]]Dodge is a passive chance when you are\n[[YELLOW]]injured in combat to halve the damage taken.\n[[YELLOW]]It is tied to your skill level. Guides.Acrobatics=[[DARK_AQUA]]About Acrobatics:\n[[YELLOW]]Acrobatics is the art of moving gracefully in mcMMO.\n[[YELLOW]]It provides combat bonuses and environment damage bonuses.\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]To gain XP in this skill you need to perform a dodge\n[[YELLOW]]in combat or survive falls from heights that damage you.\n\n[[DARK_AQUA]]How does Rolling work?\n[[YELLOW]]You have a passive chance when you take fall damage\n[[YELLOW]]to negate the damage done. You can hold the sneak button to\n[[YELLOW]]double your chances during the fall.\n[[YELLOW]]This triggers a Graceful Roll instead of a standard one.\n[[YELLOW]]Graceful Rolls are like regular rolls but are twice as likely to\n[[YELLOW]]occur and provide more damage safety than regular rolls.\n[[YELLOW]]Rolling chance is tied to your skill level\n[[DARK_AQUA]]How does Dodge work?\n[[YELLOW]]Dodge is a passive chance when you are\n[[YELLOW]]injured in combat to halve the damage taken.\n[[YELLOW]]It is tied to your skill level.
Guides.Archery=Canllaw yn dod yn fuan ... Guides.Archery=Canllaw yn dod yn fuan ...
Guides.Axes=Guide coming soon... Guides.Axes=Guide coming soon...
Guides.Excavation=[[DARK_AQUA]] Amdanom Cloddio:\n[[MELYN]] Cloddio yn y weithred o gloddio hyd faw i ddod o hyd drysorau.\n[[MELYN]] Trwy gloddio y tir y byddwch yn dod o hyd i drysorau.\n[[MELYN]] Po fwyaf y byddwch yn gwneud hyn y trysorau mwy gallwch ddod o hyd.\n[[DARK_AQUA]] Profiad Ennill:\n[[MELYN]] I ennill XP yn y sgil mae\'n rhaid i chi gloddio \u00e2 rhaw mewn llaw.\n[[MELYN]] Dim ond rhai deunyddiau yn cael ei godi am drysorau ac XP.\n[[DARK_AQUA]] Deunyddiau Cyt\u00fbn:\n[[MELYN]] Tywod Soul Glaswellt, Baw, Tywod, Clay, Gravel, myseliwm,\n[[DARK_AQUA]] Sut i ddefnyddio Torri\'r Drill Giga:\n[[MELYN]] Gyda rhaw yn llaw dde glicio i yn barod i\'ch offeryn.\n[[MELYN]] Unwaith yn y cyflwr hwn sydd gennych am 4 eiliad i wneud\n[[MELYN]] cysylltiad \u00e2 gwaith cloddio deunyddiau sy\'n gydnaws bydd hyn yn\n[[MELYN]] Activate Torri\'r Drill Giga.\n[[DARK_AQUA]] Beth yw Torri\'r Drill Giga?\n[[MELYN]] Drill Giga Torri\'r yn gallu gyda cooldown\n[[MELYN]] ynghlwm wrth sgiliau Cloddio. Mae\'n deirgwaith eich cyfle\n[[MELYN]] o ddod o hyd i drysorau ac yn galluogi toriad sydyn\n[[MELYN]] ar ddeunyddiau Cloddio.\n[[DARK_AQUA]] Sut mae Drysor Hunter gweithio?\n[[MELYN]] Bob trysor posibl ar gyfer cloddio wedi ei hun\n[[MELYN]] sgiliau lefel ofynnol iddo ollwng, o ganlyniad, mae\'n\n[[MELYN]] anodd dweud faint y mae\'n ei helpu chi.\n[[MELYN]] Dim ond yn cadw mewn cof bod yr uwch eich sgiliau Cloddio\n[[MELYN]] yw, y trysorau yn fwy y gellir ei weld.\n[[MELYN]] A hefyd yn cadw mewn cof bod pob math o Cloddio\n[[MELYN]] deunydd gydnaws ei restr unigryw ei hun o drysorau.\n[[MELYN]] Mewn geiriau eraill y byddwch yn dod o hyd i drysorau gwahanol yn Baw\n[[MELYN]] nag y byddech yn Gravel.\n[[DARK_AQUA]] Nodiadau am Cloddio:\n[[] MELYN] diferion Cloddio yn hollol customizeable\n[[MELYN]] Felly canlyniadau yn amrywio gweinydd \u00e2\'r gweinydd. Guides.Excavation=[[DARK_AQUA]] Amdanom Cloddio:\n[[YELLOW]] Cloddio yn y weithred o gloddio hyd faw i ddod o hyd drysorau.\n[[YELLOW]] Trwy gloddio y tir y byddwch yn dod o hyd i drysorau.\n[[YELLOW]] Po fwyaf y byddwch yn gwneud hyn y trysorau mwy gallwch ddod o hyd.\n[[DARK_AQUA]] Profiad Ennill:\n[[YELLOW]] I ennill XP yn y sgil mae\'n rhaid i chi gloddio \u00e2 rhaw mewn llaw.\n[[YELLOW]] Dim ond rhai deunyddiau yn cael ei godi am drysorau ac XP.\n[[DARK_AQUA]] Deunyddiau Cyt\u00fbn:\n[[YELLOW]] Tywod Soul Glaswellt, Baw, Tywod, Clay, Gravel, myseliwm,\n[[DARK_AQUA]] Sut i ddefnyddio Torri\'r Drill Giga:\n[[YELLOW]] Gyda rhaw yn llaw dde glicio i yn barod i\'ch offeryn.\n[[YELLOW]] Unwaith yn y cyflwr hwn sydd gennych am 4 eiliad i wneud\n[[YELLOW]] cysylltiad \u00e2 gwaith cloddio deunyddiau sy\'n gydnaws bydd hyn yn\n[[YELLOW]] Activate Torri\'r Drill Giga.\n[[DARK_AQUA]] Beth yw Torri\'r Drill Giga?\n[[YELLOW]] Drill Giga Torri\'r yn gallu gyda cooldown\n[[YELLOW]] ynghlwm wrth sgiliau Cloddio. Mae\'n deirgwaith eich cyfle\n[[YELLOW]] o ddod o hyd i drysorau ac yn galluogi toriad sydyn\n[[YELLOW]] ar ddeunyddiau Cloddio.\n[[DARK_AQUA]] Sut mae Drysor Hunter gweithio?\n[[YELLOW]] Bob trysor posibl ar gyfer cloddio wedi ei hun\n[[YELLOW]] sgiliau lefel ofynnol iddo ollwng, o ganlyniad, mae\'n\n[[YELLOW]] anodd dweud faint y mae\'n ei helpu chi.\n[[YELLOW]] Dim ond yn cadw mewn cof bod yr uwch eich sgiliau Cloddio\n[[YELLOW]] yw, y trysorau yn fwy y gellir ei weld.\n[[YELLOW]] A hefyd yn cadw mewn cof bod pob math o Cloddio\n[[YELLOW]] deunydd gydnaws ei restr unigryw ei hun o drysorau.\n[[YELLOW]] Mewn geiriau eraill y byddwch yn dod o hyd i drysorau gwahanol yn Baw\n[[YELLOW]] nag y byddech yn Gravel.\n[[DARK_AQUA]] Nodiadau am Cloddio:\n[[] YELLOW] diferion Cloddio yn hollol customizeable\n[[YELLOW]] Felly canlyniadau yn amrywio gweinydd \u00e2\'r gweinydd.
Guides.Fishing=Guide coming soon... Guides.Fishing=Guide coming soon...
Guides.Herbalism=Guide coming soon... Guides.Herbalism=Guide coming soon...
Guides.Mining=[[TYWYLL_AQUA]] Amdanom Mwyngloddio\n[[MELYN]] Mwyngloddio yn cynnwys cerrig a mwyngloddio mwynau.\u00a0Mae\'n darparu taliadau bonws\n[[MELYN]] i faint o ddeunyddiau gollwng wrth gloddio.\n\n[[TYWYLL_AQUA]] profiad a gafwyd\n[[MELYN]] I ennill XP yn y sgil, rhaid i chi gloddio gyda pickaxe mewn llaw.\n[[MELYN]] Dim ond rhai blociau wobr XP.\n\n[[TYWYLL_AQUA]] Deunyddiau Cyd-fynd\n[[MELYN]] Cerrig, Mwyn Glo, Haearn Mwyn, Mwyn Aur, Diemwnt Mwyn, Redstone Mwyn,\n[[MELYN]] Lapis Mwyn, Obsidian, Mossy cobl Cerrig, Ender Cerrig,\n[[MELYN]], carreg Glow ac Uffern Cerrig.\n\n[[TYWYLL_AQUA]] Sut i ddefnyddio Torri\'r Super\n[[MELYN]] Gyda pickaxe yn eich llaw, dde chlecia at barod eich offeryn.\n[[MELYN]] Unwaith yn y cyflwr hwn, mae gennych tua 4 eiliad i gysylltu\n[[MELYN]] gyda deunyddiau Mwyngloddio cydnaws, a fydd yn activate Super\n[[MELYN]] Torri\'r.\n\n[[TYWYLL_AQUA]] Beth yw Super Torri\'r?\n[[MELYN]] Super Torri\'r yn gallu gyda cooldown ynghlwm wrth y Mwyngloddio\n[[MELYN]] sgiliau.\u00a0Mae\'n treblu\'r eich cyfle o eitemau ychwanegol ollwng a\n[[MELYN]] yn galluogi egwyl yn syth ar ddeunyddiau Mwyngloddio.\n\n[[TYWYLL_AQUA]] Sut i ddefnyddio Mwyngloddio Blast\n[[MELYN]] Gyda ffrwydrwr mewn llaw, sy\'n dur fflint at ball,\n[[MELYN]] de-gliciwch ar TNT o bellter.\u00a0Bydd hyn yn achosi i\'r TNT\n[[MELYN]] i ffrwydro ar unwaith.\n\n[[TYWYLL_AQUA]] Sut mae Mwyngloddio Chwyth?\n[[MELYN]] Mwyngloddio Blast yn gallu gyda cooldown ynghlwm wrth y Mwyngloddio\n[[MELYN]] sgiliau.\u00a0Mae\'n rhoi taliadau bonws wrth cloddio \u00e2 TNT ac yn caniat\u00e1u i chi\n[[MELYN]] i anghysbell ffrwydro TNT.\u00a0Mae tair rhan i Blast Mwyngloddio.\n[[MELYN]] Mae\'r rhan gyntaf yn Bomiau Bigger, sy\'n cynyddu\'r radiws chwyth.\n[[MELYN]] Yr ail yw Dymchweliadau Arbenigol, sy\'n lleihau difrod\n[[MELYN]] o ffrwydradau TNT.\u00a0Mae\'r drydedd ran yn syml yn cynyddu\'r\n[[MELYN]] swm y mwynau gostwng o TNT a lleihau\'r\n[[MELYN]] malurion gollwng. Guides.Mining=[[DARK_AQUA]] Amdanom Mwyngloddio\n[[YELLOW]] Mwyngloddio yn cynnwys cerrig a mwyngloddio mwynau.\u00a0Mae\'n darparu taliadau bonws\n[[YELLOW]] i faint o ddeunyddiau gollwng wrth gloddio.\n\n[[DARK_AQUA]] profiad a gafwyd\n[[YELLOW]] I ennill XP yn y sgil, rhaid i chi gloddio gyda pickaxe mewn llaw.\n[[YELLOW]] Dim ond rhai blociau wobr XP.\n\n[[DARK_AQUA]] Deunyddiau Cyd-fynd\n[[YELLOW]] Cerrig, Mwyn Glo, Haearn Mwyn, Mwyn Aur, Diemwnt Mwyn, Redstone Mwyn,\n[[YELLOW]] Lapis Mwyn, Obsidian, Mossy cobl Cerrig, Ender Cerrig,\n[[YELLOW]], carreg Glow ac Uffern Cerrig.\n\n[[DARK_AQUA]] Sut i ddefnyddio Torri\'r Super\n[[YELLOW]] Gyda pickaxe yn eich llaw, dde chlecia at barod eich offeryn.\n[[YELLOW]] Unwaith yn y cyflwr hwn, mae gennych tua 4 eiliad i gysylltu\n[[YELLOW]] gyda deunyddiau Mwyngloddio cydnaws, a fydd yn activate Super\n[[YELLOW]] Torri\'r.\n\n[[DARK_AQUA]] Beth yw Super Torri\'r?\n[[YELLOW]] Super Torri\'r yn gallu gyda cooldown ynghlwm wrth y Mwyngloddio\n[[YELLOW]] sgiliau.\u00a0Mae\'n treblu\'r eich cyfle o eitemau ychwanegol ollwng a\n[[YELLOW]] yn galluogi egwyl yn syth ar ddeunyddiau Mwyngloddio.\n\n[[DARK_AQUA]] Sut i ddefnyddio Mwyngloddio Blast\n[[YELLOW]] Gyda ffrwydrwr mewn llaw, sy\'n dur fflint at ball,\n[[YELLOW]] de-gliciwch ar TNT o bellter.\u00a0Bydd hyn yn achosi i\'r TNT\n[[YELLOW]] i ffrwydro ar unwaith.\n\n[[DARK_AQUA]] Sut mae Mwyngloddio Chwyth?\n[[YELLOW]] Mwyngloddio Blast yn gallu gyda cooldown ynghlwm wrth y Mwyngloddio\n[[YELLOW]] sgiliau.\u00a0Mae\'n rhoi taliadau bonws wrth cloddio \u00e2 TNT ac yn caniat\u00e1u i chi\n[[YELLOW]] i anghysbell ffrwydro TNT.\u00a0Mae tair rhan i Blast Mwyngloddio.\n[[YELLOW]] Mae\'r rhan gyntaf yn Bomiau Bigger, sy\'n cynyddu\'r radiws chwyth.\n[[YELLOW]] Yr ail yw Dymchweliadau Arbenigol, sy\'n lleihau difrod\n[[YELLOW]] o ffrwydradau TNT.\u00a0Mae\'r drydedd ran yn syml yn cynyddu\'r\n[[YELLOW]] swm y mwynau gostwng o TNT a lleihau\'r\n[[YELLOW]] malurion gollwng.
Guides.Repair=Guide coming soon... Guides.Repair=Guide coming soon...
Guides.Swords=Canllaw yn dod yn fuan ... Guides.Swords=Canllaw yn dod yn fuan ...
Guides.Taming=Canllaw yn dod yn fuan ... Guides.Taming=Canllaw yn dod yn fuan ...
@ -447,15 +447,15 @@ Inspect.TooFar=[[RED]]You are too far away to inspect that player!
Item.ChimaeraWing.Fail=**CHIMAERA WING FAILED!** Item.ChimaeraWing.Fail=**CHIMAERA WING FAILED!**
Item.ChimaeraWing.Pass=**CHIMAERA ADAIN** Item.ChimaeraWing.Pass=**CHIMAERA ADAIN**
Item.Injured.Wait=You were injured recently and must wait to use this. [[YELLOW]]({0}s) Item.Injured.Wait=You were injured recently and must wait to use this. [[YELLOW]]({0}s)
Skills.Disarmed=[[TYWYLL_COCH]] Rydych wedi cael eich diarfogi! Skills.Disarmed=[[DARK_RED]] Rydych wedi cael eich diarfogi!
Skills.Header=[[RED]]-----[][[GREEN]]{0}[[RED]][]----- Skills.Header=[[RED]]-----[][[GREEN]]{0}[[RED]][]-----
Skills.NeedMore=[[TYWYLL_COCH]] y bydd angen mwy o Skills.NeedMore=[[DARK_RED]] y bydd angen mwy o
Skills.Stats=[[YELLOW]]{0}[[GREEN]]{1}[[DARK_AQUA]] XP([[GRAY]]{2}[[DARK_AQUA]]/[[GRAY]]{3}[[DARK_AQUA]]) Skills.Stats=[[YELLOW]]{0}[[GREEN]]{1}[[DARK_AQUA]] XP([[GRAY]]{2}[[DARK_AQUA]]/[[GRAY]]{3}[[DARK_AQUA]])
Skills.TooTired=[[COCH]] Yr ydych yn rhy flinedig i ddefnyddio\'r gallu eto. Skills.TooTired=[[RED]] Yr ydych yn rhy flinedig i ddefnyddio\'r gallu eto.
Stats.Header.Combat=[[AUR]] - = GWRTHSEFYLL SGILIAU = - Stats.Header.Combat=[[GOLD]] - = GWRTHSEFYLL SGILIAU = -
Stats.Header.Gathering=[[AUR]] -= CASGLU SGILIAU = = - Stats.Header.Gathering=[[GOLD]] -= CASGLU SGILIAU = = -
Stats.Header.Misc=[[GOLD]]-=MISC SKILLS=- Stats.Header.Misc=[[GOLD]]-=MISC SKILLS=-
Stats.Own.Stats=[[GWYRDD]][mcMMO] Ystadegau Stats.Own.Stats=[[GREEN]][mcMMO] Ystadegau
Perks.xp.name=Experience Perks.xp.name=Experience
Perks.xp.desc=Receive {0}x XP. Perks.xp.desc=Receive {0}x XP.
Perks.lucky.name=Luck Perks.lucky.name=Luck

Some files were not shown because too many files have changed in this diff Show More