mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-20 10:43:12 +01:00
Compare commits
138 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5af856a2a0 | ||
|
|
ea9c6f4d44 | ||
|
|
631b2342b9 | ||
|
|
189ae6fcdb | ||
|
|
7d70edc0ff | ||
|
|
9bfbf85b4b | ||
|
|
ab50b32f60 | ||
|
|
fc4709fe27 | ||
|
|
2cf789d7bf | ||
|
|
8aad439e99 | ||
|
|
0f1f124eb5 | ||
|
|
bb06e193bc | ||
|
|
4377716474 | ||
|
|
cab9850fe3 | ||
|
|
5ae15bfb71 | ||
|
|
1ca57df0c0 | ||
|
|
86cfa5dcb2 | ||
|
|
3c42dd69d5 | ||
|
|
39620f1aab | ||
|
|
60cbf7b8b9 | ||
|
|
a630022bf0 | ||
|
|
cd53ba04b0 | ||
|
|
b55e9c5c0d | ||
|
|
6887ddd570 | ||
|
|
f2be996e3d | ||
|
|
664c9d9953 | ||
|
|
0fa39c4ace | ||
|
|
9e604aed5e | ||
|
|
6afcce4b7c | ||
|
|
3da8955f8a | ||
|
|
49bb7ecba9 | ||
|
|
99e58039a2 | ||
|
|
d2edbe207d | ||
|
|
05d16e7c15 | ||
|
|
253d0ea4c8 | ||
|
|
397c2cc488 | ||
|
|
4f0c55460d | ||
|
|
8f2c424657 | ||
|
|
b10f599a87 | ||
|
|
c1cdba4395 | ||
|
|
bc725f46e8 | ||
|
|
6b99d3e5f1 | ||
|
|
92cc494087 | ||
|
|
3bb7b05d80 | ||
|
|
ed65842e3d | ||
|
|
be4abefd55 | ||
|
|
9e7209ff47 | ||
|
|
71d47eacaa | ||
|
|
ebc87f46f7 | ||
|
|
558e4f4dd0 | ||
|
|
3109ee9c2a | ||
|
|
bb5d003430 | ||
|
|
058cc3aac9 | ||
|
|
43ff0fa41a | ||
|
|
ab8f1a4ea6 | ||
|
|
9ef1c3b5bf | ||
|
|
ea2615aeae | ||
|
|
0a927768f5 | ||
|
|
1470feb958 | ||
|
|
5a54d6e0c5 | ||
|
|
dc6a2b654e | ||
|
|
a3da6b7df5 | ||
|
|
2c417d28c5 | ||
|
|
71e09423fe | ||
|
|
0070333b35 | ||
|
|
49bb3e0a3c | ||
|
|
787ee0220a | ||
|
|
0093f769f0 | ||
|
|
46d0b50c52 | ||
|
|
3e0cc358d0 | ||
|
|
0a8d34a21f | ||
|
|
def65282dd | ||
|
|
4359dc764f | ||
|
|
28c590f079 | ||
|
|
989f12e65b | ||
|
|
ce8ddded92 | ||
|
|
5d55af8183 | ||
|
|
358c333c70 | ||
|
|
d391d12ab5 | ||
|
|
f5a559efa6 | ||
|
|
0c8b944b12 | ||
|
|
7ff02e51f5 | ||
|
|
a40d3f5f9c | ||
|
|
3eb8f6a1a4 | ||
|
|
132388fe3f | ||
|
|
0d14918946 | ||
|
|
7c3b6b9fb3 | ||
|
|
37b5991dcc | ||
|
|
09044016cd | ||
|
|
577badf4d8 | ||
|
|
de1539ac1d | ||
|
|
6e8cfe5ec9 | ||
|
|
9dfcbf1797 | ||
|
|
74b7aa5340 | ||
|
|
0441b062bd | ||
|
|
24bdd10f7f | ||
|
|
8669582e8f | ||
|
|
d0f66ece98 | ||
|
|
1107e9f36a | ||
|
|
95c15df184 | ||
|
|
c3e1cf8681 | ||
|
|
d393e4d124 | ||
|
|
bce418bee8 | ||
|
|
052e3cd997 | ||
|
|
9eb5535c75 | ||
|
|
e9e7d462f7 | ||
|
|
88ab232ccd | ||
|
|
714f829f3e | ||
|
|
7a549ce211 | ||
|
|
63bdc16e2f | ||
|
|
7e9aada919 | ||
|
|
4805097a0c | ||
|
|
86e4a4344b | ||
|
|
9f3e7ba11c | ||
|
|
3301fc3d9d | ||
|
|
653e06dd03 | ||
|
|
a8aed1bf02 | ||
|
|
d10ff590ec | ||
|
|
b86cfb595c | ||
|
|
6733eb93f2 | ||
|
|
e822515403 | ||
|
|
b6a1188bc7 | ||
|
|
d401a69560 | ||
|
|
798cc3bbb3 | ||
|
|
e1644d3c08 | ||
|
|
36a706b7b6 | ||
|
|
36d6221b3b | ||
|
|
99bff1a4f9 | ||
|
|
7dc1a2ba72 | ||
|
|
4d99fe7230 | ||
|
|
dc9acbc3c9 | ||
|
|
d121358ad2 | ||
|
|
0295314dce | ||
|
|
5da59e6f0a | ||
|
|
07296f14d7 | ||
|
|
0a8a843f6e | ||
|
|
3bc317e7b2 | ||
|
|
a83812d11a |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -36,4 +36,7 @@
|
||||
/src/main/resources/mcMMO
|
||||
|
||||
# Other Libraries
|
||||
*.jar
|
||||
*.jar
|
||||
|
||||
# Atlassian Stuff
|
||||
/atlassian-ide-plugin.xml
|
||||
@@ -6,6 +6,47 @@ Key:
|
||||
= Fix
|
||||
! Change
|
||||
- Removal
|
||||
|
||||
Version 1.3.03
|
||||
+ Added Ocelots to Taming XP tables
|
||||
+ Added ability to summon Ocelots with Call of the Wild
|
||||
+ Added offline user functionality to mmoedit
|
||||
+ Added bookshelves to list of blocks that don't trigger abilities.
|
||||
+ Added 'mcmmo.repair.arcanebypass' permission node to bypass Arcane Repair and keep your enchantments
|
||||
+ Added config option to disable Herbalism's instant wheat replanting
|
||||
+ Added LOTS of new permissions nodes. *CHECK PLUGIN.YML FOR UPDATES*
|
||||
+ Added Italian locale file - thanks Luxius96!
|
||||
+ Added ability to inspect Ocelots with Beast Lore
|
||||
+ Added console functionality to mctop
|
||||
= Fixed Green Terra not awarding Triple Drops
|
||||
= Fixed ClassCastException from Taming preventDamage checks
|
||||
= Fixed issue with Blast Mining not seeing TNT for detonation due to snow
|
||||
= Fixed issue with block interaction returning NPEs
|
||||
= Fixed issue where every block broken had a mining check applied
|
||||
= Fixed issue where every block broken had a herbalism check applied
|
||||
= Fixed issue where blocks weren't being removed from the watchlist
|
||||
= Fixed exploit where you could use /ptp to teleport to anyone
|
||||
= Fixed bug where Green Terra didn't work on Stone Brick
|
||||
= Fixed bug where Tree Feller could be used without permissions
|
||||
= Fixed exploit where falling sand & gravel weren't tracked
|
||||
= Fixed exploit where Acrobatics could be leveled via Dodge on party members.
|
||||
= Fixed exploit where you could gain combat XP on animals summoned by Call of the Wild
|
||||
! Changed mcMMO to save profiles only when the profile is about to be discarded rather than on player quit
|
||||
! Changed MySQL to try to reconnect every 60 seconds rather than infinitely which caused server hangs
|
||||
! Changed mcMMO to be better about saving player information on server shutdown
|
||||
! Changed PTP to prevent teleporting if you've been hurt in the last 30 seconds (configurable)
|
||||
! Changed Chimera Wing failure check to use the maxWorldHeight.
|
||||
! Changed inspect failed message to say inspect rather than whois
|
||||
! Changed Call of the Wild to activate on left-click rather than right-click
|
||||
! Changed Blast Mining to track based on Entity ID vs. Location
|
||||
! Changed mmoedit to save a profile when used (this will make mctop update)
|
||||
! Changed a few Runnable tasks to have their own classes
|
||||
! Changed parties so that a player will leave their existing party if they enter a world where they don't have party permissions.
|
||||
! Changed Call of the Wild to summon animals already tamed.
|
||||
! Changed mob spawner tracking to use new Metadata API
|
||||
! Changed block watch list to use new Metadata API
|
||||
! Changed around a few config options, including the ones for mySQL. *YOU NEED TO REDO YOUR CONFIG FILE*
|
||||
- Removed 'true/false' debug message from Inspect command
|
||||
|
||||
Version 1.3.02
|
||||
+ Added in game guides for Mining, Excavation, and Acrobatics. Simply type /skillname ? to access them
|
||||
|
||||
4
pom.xml
4
pom.xml
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>1.3.02</version>
|
||||
<version>1.3.03</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||
<issueManagement>
|
||||
@@ -110,7 +110,7 @@
|
||||
<checksumPolicy>fail</checksumPolicy>
|
||||
</snapshots>
|
||||
<id>spout-repo</id>
|
||||
<url>http://nexus.getspout.org/content/groups/public/</url>
|
||||
<url>http://nexus.spout.org/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
|
||||
119
src/main/java/com/gmail/nossr50/BlockChecks.java
Normal file
119
src/main/java/com/gmail/nossr50/BlockChecks.java
Normal file
@@ -0,0 +1,119 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
|
||||
public class BlockChecks {
|
||||
|
||||
/**
|
||||
* Checks to see if a block type awards XP.
|
||||
*
|
||||
* @param material The type of Block to check
|
||||
* @return true if the block type awards XP, false otherwise
|
||||
*/
|
||||
public static boolean shouldBeWatched(Material material) {
|
||||
switch (material) {
|
||||
case BROWN_MUSHROOM:
|
||||
case CACTUS:
|
||||
case CLAY:
|
||||
case COAL_ORE:
|
||||
case DIAMOND_ORE:
|
||||
case DIRT:
|
||||
case ENDER_STONE:
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case GLOWSTONE:
|
||||
case GOLD_ORE:
|
||||
case GRASS:
|
||||
case GRAVEL:
|
||||
case IRON_ORE:
|
||||
case JACK_O_LANTERN:
|
||||
case LAPIS_ORE:
|
||||
case LOG:
|
||||
case MELON_BLOCK:
|
||||
case MOSSY_COBBLESTONE:
|
||||
case MYCEL:
|
||||
case NETHERRACK:
|
||||
case OBSIDIAN:
|
||||
case PUMPKIN:
|
||||
case RED_MUSHROOM:
|
||||
case RED_ROSE:
|
||||
case REDSTONE_ORE:
|
||||
case SAND:
|
||||
case SANDSTONE:
|
||||
case SOUL_SAND:
|
||||
case STONE:
|
||||
case SUGAR_CANE_BLOCK:
|
||||
case VINE:
|
||||
case WATER_LILY:
|
||||
case YELLOW_FLOWER:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a block should allow for the activation of abilities.
|
||||
*
|
||||
* @param material The type of Block to check
|
||||
* @return true if the block should allow ability activation, false otherwise
|
||||
*/
|
||||
public static boolean abilityBlockCheck(Material material) {
|
||||
switch (material) {
|
||||
case BED_BLOCK:
|
||||
case BREWING_STAND:
|
||||
case BOOKSHELF:
|
||||
case BURNING_FURNACE:
|
||||
case CAKE_BLOCK:
|
||||
case CHEST:
|
||||
case DISPENSER:
|
||||
case ENCHANTMENT_TABLE:
|
||||
case FENCE_GATE:
|
||||
case FURNACE:
|
||||
case IRON_DOOR_BLOCK:
|
||||
case JUKEBOX:
|
||||
case LEVER:
|
||||
case NOTE_BLOCK:
|
||||
case STONE_BUTTON:
|
||||
case TRAP_DOOR:
|
||||
case WALL_SIGN:
|
||||
case WOODEN_DOOR:
|
||||
case WORKBENCH:
|
||||
return false;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (Material.getMaterial(LoadProperties.anvilID).equals(material)) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a block type is an ore.
|
||||
*
|
||||
* @param material The type of Block to check
|
||||
* @return true if the Block is an ore, false otherwise
|
||||
*/
|
||||
public static boolean isOre(Material material) {
|
||||
switch (material) {
|
||||
case COAL_ORE:
|
||||
case DIAMOND_ORE:
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case GOLD_ORE:
|
||||
case IRON_ORE:
|
||||
case LAPIS_ORE:
|
||||
case REDSTONE_ORE:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,15 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.Animals;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
@@ -30,6 +22,8 @@ import com.gmail.nossr50.events.FakeEntityDamageByEntityEvent;
|
||||
import com.gmail.nossr50.events.FakeEntityDamageEvent;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.runnables.GainXp;
|
||||
import com.gmail.nossr50.runnables.mcBleedTimer;
|
||||
import com.gmail.nossr50.skills.Acrobatics;
|
||||
import com.gmail.nossr50.skills.Archery;
|
||||
import com.gmail.nossr50.skills.Axes;
|
||||
@@ -38,398 +32,437 @@ import com.gmail.nossr50.skills.Swords;
|
||||
import com.gmail.nossr50.skills.Taming;
|
||||
import com.gmail.nossr50.skills.Unarmed;
|
||||
|
||||
public class Combat
|
||||
{
|
||||
public static void combatChecks(EntityDamageByEntityEvent event, mcMMO pluginx)
|
||||
{
|
||||
if(event.getDamage() == 0 || event.getEntity().isDead())
|
||||
return;
|
||||
|
||||
//Declare Things
|
||||
Entity damager = event.getDamager();
|
||||
LivingEntity target = (LivingEntity) event.getEntity();
|
||||
int damage = event.getDamage();
|
||||
public class Combat {
|
||||
|
||||
/*
|
||||
* PLAYER VERSUS ENTITIES
|
||||
*/
|
||||
if(damager instanceof Player)
|
||||
{
|
||||
Player attacker = (Player) event.getDamager();
|
||||
ItemStack itemInHand = attacker.getItemInHand();
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
|
||||
//If there are any abilities to activate
|
||||
combatAbilityChecks(attacker, PPa);
|
||||
|
||||
//Damage modifiers and proc checks
|
||||
if(m.isSwords(itemInHand) && mcPermissions.getInstance().swords(attacker))
|
||||
{
|
||||
if(!pluginx.misc.bleedTracker.contains(target)) //Bleed
|
||||
Swords.bleedCheck(attacker, target, pluginx);
|
||||
|
||||
if (PPa.getSerratedStrikesMode())
|
||||
Swords.applySerratedStrikes(attacker, event, pluginx);
|
||||
|
||||
if(target instanceof Player)
|
||||
PvPExperienceGain(attacker, PPa, (Player) target, damage, SkillType.SWORDS);
|
||||
else if(!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
||||
PvEExperienceGain(attacker, PPa, target, damage, SkillType.SWORDS);
|
||||
}
|
||||
else if(m.isAxes(itemInHand) && mcPermissions.getInstance().axes(attacker))
|
||||
{
|
||||
Axes.axesBonus(attacker, event);
|
||||
|
||||
Axes.axeCriticalCheck(attacker, event, pluginx); //Critical hit
|
||||
|
||||
//Impact
|
||||
Axes.impact(attacker, target, event);
|
||||
|
||||
if (PPa.getSkullSplitterMode())
|
||||
Axes.applyAoeDamage(attacker, event, pluginx);
|
||||
|
||||
if(target instanceof Player)
|
||||
PvPExperienceGain(attacker, PPa, (Player) target, event.getDamage(), SkillType.AXES);
|
||||
else if(!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
||||
PvEExperienceGain(attacker, PPa, target, event.getDamage(), SkillType.AXES);
|
||||
}
|
||||
else if(itemInHand.getTypeId() == 0 && mcPermissions.getInstance().unarmed(attacker)) //Unarmed
|
||||
{
|
||||
Unarmed.unarmedBonus(attacker, event);
|
||||
if(PPa.getBerserkMode())
|
||||
event.setDamage(event.getDamage() + (event.getDamage() / 2));
|
||||
|
||||
if(target instanceof Player)
|
||||
Unarmed.disarmProcCheck(attacker, (Player) target); //Disarm
|
||||
|
||||
if(target instanceof Player)
|
||||
PvPExperienceGain(attacker, PPa, (Player) target, event.getDamage(), SkillType.UNARMED);
|
||||
else if(!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
||||
PvEExperienceGain(attacker, PPa, target, event.getDamage(), SkillType.UNARMED);
|
||||
}
|
||||
|
||||
//Player use bone on wolf.
|
||||
else if(target instanceof Wolf)
|
||||
{
|
||||
Wolf wolf = (Wolf) target;
|
||||
|
||||
if(itemInHand.getTypeId() == 352 && mcPermissions.getInstance().taming(attacker))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
if(wolf.isTamed())
|
||||
attacker.sendMessage(mcLocale.getString("Combat.BeastLore")+" "+
|
||||
mcLocale.getString("Combat.BeastLoreOwner", new Object[] {Taming.getOwnerName(wolf)})+" "+
|
||||
mcLocale.getString("Combat.BeastLoreHealthWolfTamed", new Object[] {wolf.getHealth()}));
|
||||
else
|
||||
attacker.sendMessage(mcLocale.getString("Combat.BeastLore")+" "+
|
||||
mcLocale.getString("Combat.BeastLoreHealthWolf", new Object[] {wolf.getHealth()}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* TAMING (WOLVES VERSUS ENTITIES)
|
||||
*/
|
||||
else if(damager instanceof Wolf)
|
||||
{
|
||||
Wolf wolf = (Wolf) damager;
|
||||
|
||||
if (wolf.isTamed() && (wolf.getOwner() instanceof Player))
|
||||
{
|
||||
Player master = (Player) wolf.getOwner();
|
||||
PlayerProfile PPo = Users.getProfile(master);
|
||||
if(mcPermissions.getInstance().taming(master))
|
||||
{
|
||||
//Fast Food Service
|
||||
Taming.fastFoodService(PPo, wolf, event);
|
||||
|
||||
//Sharpened Claws
|
||||
Taming.sharpenedClaws(PPo, event);
|
||||
|
||||
//Gore
|
||||
Taming.gore(PPo, event, master, pluginx);
|
||||
|
||||
//Reward XP
|
||||
Taming.rewardXp(event, pluginx, master);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Another offensive check for Archery
|
||||
else if(damager instanceof Arrow)
|
||||
archeryCheck((EntityDamageByEntityEvent)event, pluginx);
|
||||
|
||||
/*
|
||||
* DEFENSIVE CHECKS
|
||||
*/
|
||||
if(target instanceof Player)
|
||||
{
|
||||
Swords.counterAttackChecks(event);
|
||||
Acrobatics.dodgeChecks(event);
|
||||
}
|
||||
|
||||
/*
|
||||
* DEFENSIVE CHECKS FOR WOLVES
|
||||
*/
|
||||
//else if(target instanceof Wolf)
|
||||
//{
|
||||
// Wolf wolf = (Wolf) target;
|
||||
// if(wolf.isTamed() && (wolf.getOwner() instanceof Player))
|
||||
// Taming.preventDamage(event, pluginx);
|
||||
//}
|
||||
}
|
||||
|
||||
public static void combatAbilityChecks(Player attacker, PlayerProfile PPa)
|
||||
{
|
||||
//Check to see if any abilities need to be activated
|
||||
if(PPa.getAxePreparationMode())
|
||||
Skills.abilityCheck(attacker, SkillType.AXES);
|
||||
if(PPa.getSwordsPreparationMode())
|
||||
Skills.abilityCheck(attacker, SkillType.SWORDS);
|
||||
if(PPa.getFistsPreparationMode())
|
||||
Skills.abilityCheck(attacker, SkillType.UNARMED);
|
||||
}
|
||||
|
||||
public static void archeryCheck(EntityDamageByEntityEvent event, mcMMO pluginx)
|
||||
{
|
||||
Arrow arrow = (Arrow)event.getDamager();
|
||||
Entity y = arrow.getShooter();
|
||||
Entity x = event.getEntity();
|
||||
if(x instanceof Player)
|
||||
{
|
||||
Player defender = (Player)x;
|
||||
PlayerProfile PPd = Users.getProfile(defender);
|
||||
if(PPd == null)
|
||||
Users.addUser(defender);
|
||||
if(mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getTypeId() == 0)
|
||||
{
|
||||
if(defender != null && PPd.getSkillLevel(SkillType.UNARMED) >= 1000)
|
||||
{
|
||||
if(Math.random() * 1000 <= 500)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
defender.sendMessage(mcLocale.getString("Combat.ArrowDeflect")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
} else if(defender != null && Math.random() * 1000 <= (PPd.getSkillLevel(SkillType.UNARMED) / 2))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
defender.sendMessage(mcLocale.getString("Combat.ArrowDeflect")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If attacker is player
|
||||
*/
|
||||
if(y instanceof Player)
|
||||
{
|
||||
Player attacker = (Player)y;
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
int damage = event.getDamage();
|
||||
if(mcPermissions.getInstance().archery(attacker) && damage > 0)
|
||||
{
|
||||
Archery.trackArrows(pluginx, x, PPa);
|
||||
|
||||
/*
|
||||
* IGNITION
|
||||
*/
|
||||
Archery.ignitionCheck(x, attacker);
|
||||
/*
|
||||
* Defender is Monster
|
||||
*/
|
||||
if(!pluginx.misc.mobSpawnerList.contains(x.getEntityId()))
|
||||
{
|
||||
int xp = getXp(x, damage);
|
||||
PPa.addXP(SkillType.ARCHERY, xp*10, attacker);
|
||||
}
|
||||
/*
|
||||
* Attacker is Player
|
||||
*/
|
||||
if(x instanceof Player){
|
||||
Player defender = (Player)x;
|
||||
PlayerProfile PPd = Users.getProfile(defender);
|
||||
/*
|
||||
* Stuff for the daze proc
|
||||
*/
|
||||
if(PPa.inParty() && PPd.inParty())
|
||||
{
|
||||
if(Party.getInstance().inSameParty(defender, attacker))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* PVP XP
|
||||
*/
|
||||
if(LoadProperties.pvpxp && ((PPd.getLastLogin()+5)*1000) < System.currentTimeMillis() && !attacker.getName().equals(defender.getName()))
|
||||
{
|
||||
int xp = (int) ((damage * 2) * 10);
|
||||
PPa.addXP(SkillType.ARCHERY, xp, attacker);
|
||||
}
|
||||
/*
|
||||
* DAZE PROC
|
||||
*/
|
||||
Archery.dazeCheck(defender, attacker);
|
||||
}
|
||||
}
|
||||
Skills.XpCheckSkill(SkillType.ARCHERY, attacker);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to damage target for value dmg with reason CUSTOM
|
||||
*
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param dmg Amount of damage to attempt to do
|
||||
*/
|
||||
public static void dealDamage(LivingEntity target, int dmg){
|
||||
dealDamage(target, dmg, EntityDamageEvent.DamageCause.CUSTOM);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to damage target for value dmg with reason cause
|
||||
*
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param dmg Amount of damage to attempt to do
|
||||
* @param cause DamageCause to pass to damage event
|
||||
*/
|
||||
public static void dealDamage(LivingEntity target, int dmg, DamageCause cause) {
|
||||
if(LoadProperties.eventCallback) {
|
||||
EntityDamageEvent ede = (EntityDamageEvent) new FakeEntityDamageEvent(target, cause, dmg);
|
||||
Bukkit.getPluginManager().callEvent(ede);
|
||||
if(ede.isCancelled()) return;
|
||||
|
||||
target.damage(ede.getDamage());
|
||||
} else {
|
||||
target.damage(dmg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to damage target for value dmg with reason ENTITY_ATTACK with damager attacker
|
||||
*
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param dmg Amount of damage to attempt to do
|
||||
* @param attacker Player to pass to event as damager
|
||||
*/
|
||||
public static void dealDamage(LivingEntity target, int dmg, Player attacker) {
|
||||
if(LoadProperties.eventCallback) {
|
||||
EntityDamageEvent ede = (EntityDamageByEntityEvent) new FakeEntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg);
|
||||
Bukkit.getPluginManager().callEvent(ede);
|
||||
if(ede.isCancelled()) return;
|
||||
/**
|
||||
* Apply combat modifiers and process and XP gain.
|
||||
*
|
||||
* @param event The event to run the combat checks on.
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void combatChecks(EntityDamageByEntityEvent event, mcMMO plugin) {
|
||||
if (event.getDamage() == 0 || event.getEntity().isDead()) {
|
||||
return;
|
||||
}
|
||||
|
||||
target.damage(ede.getDamage());
|
||||
} else {
|
||||
target.damage(dmg);
|
||||
}
|
||||
}
|
||||
|
||||
private static void PvPExperienceGain(Player attacker, PlayerProfile PPa, Player defender, int damage, SkillType skillType)
|
||||
{
|
||||
if (!LoadProperties.pvpxp)
|
||||
return;
|
||||
|
||||
PlayerProfile PPd = Users.getProfile(defender);
|
||||
|
||||
if(System.currentTimeMillis() >= (PPd.getRespawnATS()*1000) + 5000
|
||||
&& ((PPd.getLastLogin()+5)*1000) < System.currentTimeMillis()
|
||||
&& defender.getHealth() >= 1)
|
||||
{
|
||||
//Prevent a ridiculous amount of XP being granted by capping it at the remaining health of the mob
|
||||
int hpLeft = defender.getHealth(), xpinc = 0;
|
||||
|
||||
if(hpLeft < damage)
|
||||
{
|
||||
if(hpLeft > 0)
|
||||
xpinc = hpLeft;
|
||||
else
|
||||
xpinc = 0;
|
||||
} else
|
||||
xpinc = damage;
|
||||
|
||||
int xp = (int) (xpinc * 2 * LoadProperties.pvpxprewardmodifier);
|
||||
PPa.addXP(skillType, xp*10, attacker);
|
||||
Skills.XpCheckSkill(skillType, attacker);
|
||||
}
|
||||
}
|
||||
|
||||
private static void PvEExperienceGain(Player attacker, PlayerProfile PPa, LivingEntity target, int damage, SkillType skillType)
|
||||
{
|
||||
int xp = getXp(target, damage);
|
||||
PPa.addXP(skillType, xp*10, attacker);
|
||||
Skills.XpCheckSkill(skillType, attacker);
|
||||
}
|
||||
|
||||
public static int getXp(Entity entity, int damage)
|
||||
{
|
||||
int xp = 0;
|
||||
if(entity instanceof LivingEntity)
|
||||
{
|
||||
LivingEntity le = (LivingEntity) entity;
|
||||
//Prevent a ridiculous amount of XP being granted by capping it at the remaining health of the entity
|
||||
int hpLeft = le.getHealth();
|
||||
int xpinc = 0;
|
||||
|
||||
if(hpLeft < damage)
|
||||
{
|
||||
if(hpLeft > 0)
|
||||
xpinc = hpLeft;
|
||||
else
|
||||
xpinc = 0;
|
||||
}
|
||||
else
|
||||
xpinc = damage;
|
||||
|
||||
if(entity instanceof Animals)
|
||||
xp = (int) (xpinc * LoadProperties.animalXP);
|
||||
else
|
||||
{
|
||||
EntityType type = entity.getType();
|
||||
switch(type){
|
||||
case BLAZE:
|
||||
xp = (int) (xpinc * LoadProperties.blazeXP);
|
||||
break;
|
||||
case CAVE_SPIDER:
|
||||
xp = (int) (xpinc * LoadProperties.cavespiderXP);
|
||||
break;
|
||||
case CREEPER:
|
||||
xp = (int) (xpinc * LoadProperties.creeperXP);
|
||||
break;
|
||||
case ENDER_DRAGON:
|
||||
xp = (int) (xpinc * LoadProperties.enderdragonXP);
|
||||
break;
|
||||
case ENDERMAN:
|
||||
xp = (int) (xpinc * LoadProperties.endermanXP);
|
||||
break;
|
||||
case GHAST:
|
||||
xp = (int) (xpinc * LoadProperties.ghastXP);
|
||||
break;
|
||||
case MAGMA_CUBE:
|
||||
xp = (int) (xpinc * LoadProperties.magmacubeXP);
|
||||
break;
|
||||
case PIG_ZOMBIE:
|
||||
xp = (int) (xpinc * LoadProperties.pigzombieXP);
|
||||
break;
|
||||
case SILVERFISH:
|
||||
xp = (int) (xpinc * LoadProperties.silverfishXP);
|
||||
break;
|
||||
case SKELETON:
|
||||
xp = (int) (xpinc * LoadProperties.skeletonXP);
|
||||
break;
|
||||
case SLIME:
|
||||
xp = (int) (xpinc * LoadProperties.slimeXP);
|
||||
break;
|
||||
case SPIDER:
|
||||
xp = (int) (xpinc * LoadProperties.spiderXP);
|
||||
break;
|
||||
case ZOMBIE:
|
||||
xp = (int) (xpinc * LoadProperties.zombieXP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return xp;
|
||||
}
|
||||
Entity damager = event.getDamager();
|
||||
LivingEntity target = (LivingEntity) event.getEntity();
|
||||
EntityType damagerType = damager.getType();
|
||||
EntityType targetType = target.getType();
|
||||
|
||||
switch (damagerType) {
|
||||
case PLAYER:
|
||||
Player attacker = (Player) event.getDamager();
|
||||
ItemStack itemInHand = attacker.getItemInHand();
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
|
||||
combatAbilityChecks(attacker);
|
||||
|
||||
if (ItemChecks.isSword(itemInHand) && mcPermissions.getInstance().swords(attacker)) {
|
||||
if (!mcBleedTimer.contains(target) && mcPermissions.getInstance().swordsBleed(attacker)) {
|
||||
Swords.bleedCheck(attacker, target, plugin);
|
||||
}
|
||||
|
||||
if (PPa.getSerratedStrikesMode()) {
|
||||
applyAbilityAoE(attacker, target, event.getDamage(), plugin, SkillType.SWORDS);
|
||||
}
|
||||
|
||||
startGainXp(attacker, PPa, target, SkillType.SWORDS, plugin);
|
||||
}
|
||||
else if (ItemChecks.isAxe(itemInHand) && mcPermissions.getInstance().axes(attacker)) {
|
||||
if (mcPermissions.getInstance().axeBonus(attacker)) {
|
||||
Axes.axesBonus(attacker, event);
|
||||
}
|
||||
|
||||
if (mcPermissions.getInstance().criticalHit(attacker)) {
|
||||
Axes.axeCriticalCheck(attacker, event);
|
||||
}
|
||||
|
||||
if (mcPermissions.getInstance().impact(attacker)) {
|
||||
Axes.impact(attacker, target, event);
|
||||
}
|
||||
|
||||
if (PPa.getSkullSplitterMode()) {
|
||||
applyAbilityAoE(attacker, target, event.getDamage(), plugin, SkillType.AXES);
|
||||
}
|
||||
|
||||
startGainXp(attacker, PPa, target, SkillType.AXES, plugin);
|
||||
}
|
||||
else if (itemInHand.getType().equals(Material.AIR) && mcPermissions.getInstance().unarmed(attacker)) {
|
||||
if (mcPermissions.getInstance().unarmedBonus(attacker)) {
|
||||
Unarmed.unarmedBonus(PPa, event);
|
||||
}
|
||||
|
||||
if (PPa.getBerserkMode() && mcPermissions.getInstance().berserk(attacker)) {
|
||||
event.setDamage((int) (event.getDamage() * 1.5));
|
||||
}
|
||||
|
||||
if (targetType.equals(EntityType.PLAYER) && mcPermissions.getInstance().disarm(attacker)) {
|
||||
Unarmed.disarmProcCheck(PPa, (Player) target);
|
||||
}
|
||||
|
||||
startGainXp(attacker, PPa, target, SkillType.UNARMED, plugin);
|
||||
}
|
||||
else if (itemInHand.getType().equals(Material.BONE) && mcPermissions.getInstance().beastLore(attacker)) {
|
||||
Taming.beastLore(event, target, attacker);
|
||||
}
|
||||
break;
|
||||
|
||||
case WOLF:
|
||||
Wolf wolf = (Wolf) damager;
|
||||
|
||||
if (wolf.isTamed() && wolf.getOwner() instanceof Player) {
|
||||
Player master = (Player) wolf.getOwner();
|
||||
PlayerProfile PPo = Users.getProfile(master);
|
||||
|
||||
if (mcPermissions.getInstance().taming(master)) {
|
||||
if (mcPermissions.getInstance().fastFoodService(master)) {
|
||||
Taming.fastFoodService(PPo, wolf, event);
|
||||
}
|
||||
|
||||
if (mcPermissions.getInstance().sharpenedclaws(master)) {
|
||||
Taming.sharpenedClaws(PPo, event);
|
||||
}
|
||||
|
||||
if (mcPermissions.getInstance().gore(master)) {
|
||||
Taming.gore(PPo, event, master, plugin);
|
||||
}
|
||||
|
||||
startGainXp(master, PPo, target, SkillType.TAMING, plugin);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ARROW:
|
||||
archeryCheck((EntityDamageByEntityEvent) event, plugin);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (targetType.equals(EntityType.PLAYER)) {
|
||||
Swords.counterAttackChecks(event);
|
||||
Acrobatics.dodgeChecks(event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process combat abilities based on weapon preparation modes.
|
||||
*
|
||||
* @param attacker The player attacking
|
||||
*/
|
||||
public static void combatAbilityChecks(Player attacker) {
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
|
||||
if (PPa.getAxePreparationMode()) {
|
||||
Skills.abilityCheck(attacker, SkillType.AXES);
|
||||
}
|
||||
else if (PPa.getSwordsPreparationMode()) {
|
||||
Skills.abilityCheck(attacker, SkillType.SWORDS);
|
||||
}
|
||||
else if (PPa.getFistsPreparationMode()) {
|
||||
Skills.abilityCheck(attacker, SkillType.UNARMED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process archery abilities.
|
||||
*
|
||||
* @param event The event to run the archery checks on.
|
||||
* @param pluginx mcMMO plugin instance
|
||||
*/
|
||||
public static void archeryCheck(EntityDamageByEntityEvent event, mcMMO pluginx) {
|
||||
Arrow arrow = (Arrow) event.getDamager();
|
||||
LivingEntity shooter = arrow.getShooter();
|
||||
LivingEntity target = (LivingEntity) event.getEntity();
|
||||
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
|
||||
if (mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getType().equals(Material.AIR)) {
|
||||
Unarmed.deflectCheck(defender, event);
|
||||
}
|
||||
}
|
||||
|
||||
if (shooter instanceof Player) {
|
||||
Player attacker = (Player) shooter;
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
int damage = event.getDamage();
|
||||
|
||||
if (mcPermissions.getInstance().archery(attacker) && damage > 0) {
|
||||
if (mcPermissions.getInstance().trackArrows(attacker)) {
|
||||
Archery.trackArrows(pluginx, target, PPa);
|
||||
}
|
||||
|
||||
if (mcPermissions.getInstance().ignition(attacker)) {
|
||||
Archery.ignitionCheck(target, attacker);
|
||||
}
|
||||
|
||||
startGainXp(attacker, PPa, target, SkillType.ARCHERY, pluginx);
|
||||
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
PlayerProfile PPd = Users.getProfile(defender);
|
||||
|
||||
if (PPa.inParty() && PPd.inParty() && Party.getInstance().inSameParty(defender, attacker)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Archery.dazeCheck(defender, attacker);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to damage target for value dmg with reason CUSTOM
|
||||
*
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param dmg Amount of damage to attempt to do
|
||||
*/
|
||||
public static void dealDamage(LivingEntity target, int dmg) {
|
||||
dealDamage(target, dmg, EntityDamageEvent.DamageCause.CUSTOM);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to damage target for value dmg with reason cause
|
||||
*
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param dmg Amount of damage to attempt to do
|
||||
* @param cause DamageCause to pass to damage event
|
||||
*/
|
||||
private static void dealDamage(LivingEntity target, int dmg, DamageCause cause) {
|
||||
if (LoadProperties.eventCallback) {
|
||||
EntityDamageEvent ede = (EntityDamageEvent) new FakeEntityDamageEvent(target, cause, dmg);
|
||||
Bukkit.getPluginManager().callEvent(ede);
|
||||
|
||||
if (ede.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
target.damage(ede.getDamage());
|
||||
}
|
||||
else {
|
||||
target.damage(dmg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to damage target for value dmg with reason ENTITY_ATTACK with damager attacker
|
||||
*
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param dmg Amount of damage to attempt to do
|
||||
* @param attacker Player to pass to event as damager
|
||||
*/
|
||||
private static void dealDamage(LivingEntity target, int dmg, Player attacker) {
|
||||
if (LoadProperties.eventCallback) {
|
||||
EntityDamageEvent ede = (EntityDamageByEntityEvent) new FakeEntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg);
|
||||
Bukkit.getPluginManager().callEvent(ede);
|
||||
|
||||
if (ede.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
target.damage(ede.getDamage());
|
||||
}
|
||||
else {
|
||||
target.damage(dmg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply Area-of-Effect ability actions.
|
||||
*
|
||||
* @param attacker The attacking player
|
||||
* @param target The defending entity
|
||||
* @param damage The initial damage amount
|
||||
* @param plugin mcMMO plugin instance
|
||||
* @param type The type of skill being used
|
||||
*/
|
||||
private static void applyAbilityAoE(Player attacker, LivingEntity target, int damage, mcMMO plugin, SkillType type) {
|
||||
int numberOfTargets = m.getTier(attacker.getItemInHand()); //The higher the weapon tier, the more targets you hit
|
||||
int damageAmount = 0;
|
||||
|
||||
if (type.equals(SkillType.AXES)) {
|
||||
damageAmount = damage / 2;
|
||||
}
|
||||
else if (type.equals(SkillType.SWORDS)) {
|
||||
damageAmount = damage / 4;
|
||||
}
|
||||
|
||||
if (damageAmount < 1) {
|
||||
damageAmount = 1;
|
||||
}
|
||||
|
||||
for (Entity entity : target.getNearbyEntities(2.5, 2.5, 2.5)) {
|
||||
EntityType entityType = entity.getType();
|
||||
|
||||
if (entityType.equals(EntityType.WOLF)) {
|
||||
Wolf wolf = (Wolf) entity;
|
||||
AnimalTamer tamer = wolf.getOwner();
|
||||
|
||||
if (tamer instanceof Player) {
|
||||
Player owner = (Player) tamer;
|
||||
|
||||
if (owner.equals(attacker) || Party.getInstance().inSameParty(attacker, owner)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity instanceof LivingEntity && numberOfTargets >= 1) {
|
||||
if (entityType.equals(EntityType.PLAYER)) {
|
||||
Player defender = (Player) entity;
|
||||
PlayerProfile PP = Users.getProfile(defender);
|
||||
|
||||
//Reasons why the target shouldn't be hit
|
||||
if (PP.getGodMode()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (defender.getName().equals(attacker.getName())) { //Is this even possible?
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Party.getInstance().inSameParty(attacker, defender)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (defender.isDead()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//Apply effect to players only if PVP is enabled
|
||||
if (target.getWorld().getPVP()) {
|
||||
String message = "";
|
||||
|
||||
if (type.equals(SkillType.AXES)) {
|
||||
message = mcLocale.getString("Axes.HitByCleave");
|
||||
}
|
||||
else if (type.equals(SkillType.SWORDS)) {
|
||||
message = mcLocale.getString("Swords.HitBySerratedStrikes");
|
||||
}
|
||||
|
||||
dealDamage(defender, damageAmount, attacker);
|
||||
defender.sendMessage(message);
|
||||
|
||||
if (type.equals(SkillType.SWORDS)) {
|
||||
PP.addBleedTicks(5);
|
||||
}
|
||||
|
||||
numberOfTargets--;
|
||||
}
|
||||
}
|
||||
else {
|
||||
LivingEntity livingEntity = (LivingEntity) entity;
|
||||
|
||||
if (type.equals(SkillType.SWORDS)) {
|
||||
mcBleedTimer.add(livingEntity);
|
||||
}
|
||||
|
||||
dealDamage(livingEntity, damageAmount, attacker);
|
||||
numberOfTargets--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the task that gives combat XP.
|
||||
*
|
||||
* @param attacker The attacking player
|
||||
* @param PP The player's PlayerProfile
|
||||
* @param target The defending entity
|
||||
* @param skillType The skill being used
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void startGainXp(Player attacker, PlayerProfile PP, LivingEntity target, SkillType skillType, mcMMO pluginx) {
|
||||
double baseXP = 0;
|
||||
|
||||
if (target instanceof Player) {
|
||||
if (!LoadProperties.pvpxp) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player defender = (Player) target;
|
||||
PlayerProfile PPd = Users.getProfile(defender);
|
||||
|
||||
if (System.currentTimeMillis() >= (PPd.getRespawnATS() * 1000) + 5000 && ((PPd.getLastLogin() + 5) * 1000) < System.currentTimeMillis() && defender.getHealth() >= 1) {
|
||||
baseXP = 20 * LoadProperties.pvpxprewardmodifier;
|
||||
}
|
||||
}
|
||||
else if (!target.hasMetadata("mcmmoFromMobSpawner")) {
|
||||
if (target instanceof Animals && !target.hasMetadata("mcmmoSummoned")) {
|
||||
baseXP = LoadProperties.animalXP;
|
||||
}
|
||||
else {
|
||||
EntityType type = target.getType();
|
||||
|
||||
switch (type) {
|
||||
case BLAZE:
|
||||
baseXP = LoadProperties.blazeXP;
|
||||
break;
|
||||
|
||||
case CAVE_SPIDER:
|
||||
baseXP = LoadProperties.cavespiderXP;
|
||||
break;
|
||||
|
||||
case CREEPER:
|
||||
baseXP = LoadProperties.creeperXP;
|
||||
break;
|
||||
|
||||
case ENDER_DRAGON:
|
||||
baseXP = LoadProperties.enderdragonXP;
|
||||
break;
|
||||
|
||||
case ENDERMAN:
|
||||
baseXP = LoadProperties.endermanXP;
|
||||
break;
|
||||
|
||||
case GHAST:
|
||||
baseXP = LoadProperties.ghastXP;
|
||||
break;
|
||||
|
||||
case MAGMA_CUBE:
|
||||
baseXP = LoadProperties.magmacubeXP;
|
||||
break;
|
||||
|
||||
case PIG_ZOMBIE:
|
||||
baseXP = LoadProperties.pigzombieXP;
|
||||
break;
|
||||
|
||||
case SILVERFISH:
|
||||
baseXP = LoadProperties.silverfishXP;
|
||||
break;
|
||||
|
||||
case SKELETON:
|
||||
baseXP = LoadProperties.skeletonXP;
|
||||
break;
|
||||
|
||||
case SLIME:
|
||||
baseXP = LoadProperties.slimeXP;
|
||||
break;
|
||||
|
||||
case SPIDER:
|
||||
baseXP = LoadProperties.spiderXP;
|
||||
break;
|
||||
|
||||
case ZOMBIE:
|
||||
baseXP = LoadProperties.zombieXP;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
baseXP *= 10;
|
||||
}
|
||||
|
||||
if (baseXP != 0) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(pluginx, new GainXp(attacker, PP, skillType, baseXP, target), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,170 +1,142 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.DatabaseUpdate;
|
||||
|
||||
public class Database {
|
||||
|
||||
private mcMMO plugin;
|
||||
private String connectionString = "jdbc:mysql://" + LoadProperties.MySQLserverName + ":" + LoadProperties.MySQLport + "/" + LoadProperties.MySQLdbName + "?user=" + LoadProperties.MySQLuserName + "&password=" + LoadProperties.MySQLdbPass;
|
||||
private boolean isConnected = false;
|
||||
private Connection conn = null;
|
||||
|
||||
public void connect()
|
||||
{
|
||||
try
|
||||
{
|
||||
System.out.println("[mcMMO] Attempting connection to MySQL...");
|
||||
conn = DriverManager.getConnection(connectionString);
|
||||
isConnected = true;
|
||||
System.out.println("[mcMMO] Connection to MySQL established!");
|
||||
} catch (SQLException ex)
|
||||
{
|
||||
isConnected = false;
|
||||
ex.printStackTrace();
|
||||
System.out.println("SQLException: " + ex.getMessage());
|
||||
System.out.println("SQLState: " + ex.getSQLState());
|
||||
System.out.println("VendorError: " + ex.getErrorCode());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isConnected()
|
||||
{
|
||||
return isConnected;
|
||||
}
|
||||
private String connectionString = "jdbc:mysql://" + LoadProperties.MySQLserverName + ":" + LoadProperties.MySQLport + "/" + LoadProperties.MySQLdbName + "?user=" + LoadProperties.MySQLuserName + "&password=" + LoadProperties.MySQLdbPass;
|
||||
private Connection conn = null;
|
||||
private mcMMO plugin = null;
|
||||
private long reconnectTimestamp = 0;
|
||||
|
||||
public Database(mcMMO instance) {
|
||||
connect(); //Connect to MySQL
|
||||
this.plugin = instance;
|
||||
// Load the driver instance
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
DriverManager.getConnection(connectionString);
|
||||
} catch (ClassNotFoundException e) {
|
||||
plugin.getServer().getLogger().warning(e.getLocalizedMessage());
|
||||
} catch (SQLException e) {
|
||||
plugin.getServer().getLogger().warning(e.getLocalizedMessage());
|
||||
System.out.println("SQLException: " + e.getMessage());
|
||||
System.out.println("SQLState: " + e.getSQLState());
|
||||
System.out.println("VendorError: " + e.getErrorCode());
|
||||
}
|
||||
}
|
||||
|
||||
//Create the DB structure
|
||||
public void createStructure() {
|
||||
Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "huds` (`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`hudtype` varchar(50) NOT NULL DEFAULT '',"
|
||||
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "users` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT,"
|
||||
+ "`user` varchar(40) NOT NULL,"
|
||||
+ "`lastlogin` int(32) unsigned NOT NULL,"
|
||||
+ "`party` varchar(100) NOT NULL DEFAULT '',"
|
||||
+ "PRIMARY KEY (`id`),"
|
||||
+ "UNIQUE KEY `user` (`user`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
|
||||
Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "cooldowns` (`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`mining` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`woodcutting` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`repair` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`unarmed` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`herbalism` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`excavation` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`archery` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`swords` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`axes` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`acrobatics` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`blast_mining` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "skills` (`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "experience` (`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
|
||||
Write("DROP TABLE IF EXISTS `"+LoadProperties.MySQLtablePrefix+"skills2`");
|
||||
Write("DROP TABLE IF EXISTS `"+LoadProperties.MySQLtablePrefix+"experience2`");
|
||||
Write("DROP TABLE IF EXISTS `"+LoadProperties.MySQLtablePrefix+"spawn`");
|
||||
|
||||
checkDatabaseStructure();
|
||||
checkDatabaseStructureForBlastMining();
|
||||
}
|
||||
public Database(mcMMO instance) {
|
||||
plugin = instance;
|
||||
connect(); //Connect to MySQL
|
||||
|
||||
public void checkDatabaseStructure()
|
||||
{
|
||||
String sql = "SELECT * FROM `"+LoadProperties.MySQLtablePrefix+"experience` ORDER BY `"+LoadProperties.MySQLtablePrefix+"experience`.`fishing` ASC LIMIT 0 , 30";
|
||||
|
||||
ResultSet rs = null;
|
||||
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
|
||||
try {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
if (stmt.executeQuery() != null) {
|
||||
stmt.executeQuery();
|
||||
rs = stmt.getResultSet();
|
||||
while (rs.next()) {
|
||||
ArrayList<String> Col = new ArrayList<String>();
|
||||
for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
|
||||
Col.add(rs.getString(i));
|
||||
}
|
||||
Rows.put(rs.getRow(), Col);
|
||||
}
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
System.out.println("Updating mcMMO MySQL tables for Fishing...");
|
||||
Write("ALTER TABLE `"+LoadProperties.MySQLtablePrefix + "skills` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
|
||||
Write("ALTER TABLE `"+LoadProperties.MySQLtablePrefix + "experience` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
|
||||
}
|
||||
}
|
||||
|
||||
public void checkDatabaseStructureForBlastMining()
|
||||
{
|
||||
String sql = "SELECT * FROM `"+LoadProperties.MySQLtablePrefix+"cooldowns` ORDER BY `"+LoadProperties.MySQLtablePrefix+"cooldowns`.`blast_mining` ASC LIMIT 0 , 30";
|
||||
|
||||
// Load the driver instance
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
DriverManager.getConnection(connectionString);
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
Bukkit.getLogger().warning(e.getLocalizedMessage());
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
Bukkit.getLogger().warning(ex.getLocalizedMessage());
|
||||
printErrors(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to connect to the mySQL database.
|
||||
*/
|
||||
public void connect() {
|
||||
try {
|
||||
System.out.println("[mcMMO] Attempting connection to MySQL...");
|
||||
Properties conProperties = new Properties();
|
||||
conProperties.put("autoReconnect", "false");
|
||||
conProperties.put("maxReconnects", "0");
|
||||
conn = DriverManager.getConnection(connectionString, conProperties);
|
||||
System.out.println("[mcMMO] Connection to MySQL was a success!");
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
System.out.println("[mcMMO] Connection to MySQL failed!");
|
||||
ex.printStackTrace();
|
||||
printErrors(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to create the database structure.
|
||||
*/
|
||||
public void createStructure() {
|
||||
write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "huds` (`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`hudtype` varchar(50) NOT NULL DEFAULT '',"
|
||||
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "users` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT,"
|
||||
+ "`user` varchar(40) NOT NULL,"
|
||||
+ "`lastlogin` int(32) unsigned NOT NULL,"
|
||||
+ "`party` varchar(100) NOT NULL DEFAULT '',"
|
||||
+ "PRIMARY KEY (`id`),"
|
||||
+ "UNIQUE KEY `user` (`user`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
|
||||
write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "cooldowns` (`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`mining` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`woodcutting` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`repair` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`unarmed` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`herbalism` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`excavation` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`archery` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`swords` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`axes` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`acrobatics` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`blast_mining` int(32) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "skills` (`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "experience` (`user_id` int(10) unsigned NOT NULL,"
|
||||
+ "`taming` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`mining` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`repair` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`unarmed` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`herbalism` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`excavation` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`archery` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`swords` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`axes` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
+ "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
|
||||
checkDatabaseStructure(DatabaseUpdate.FISHING);
|
||||
checkDatabaseStructure(DatabaseUpdate.BLAST_MINING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check database structure for missing values.
|
||||
*
|
||||
* @param update Type of data to check updates for
|
||||
*/
|
||||
public void checkDatabaseStructure(DatabaseUpdate update) {
|
||||
String sql = null;
|
||||
ResultSet rs = null;
|
||||
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
|
||||
|
||||
switch (update) {
|
||||
case BLAST_MINING:
|
||||
sql = "SELECT * FROM `"+LoadProperties.MySQLtablePrefix+"cooldowns` ORDER BY `"+LoadProperties.MySQLtablePrefix+"cooldowns`.`blast_mining` ASC LIMIT 0 , 30";
|
||||
break;
|
||||
case FISHING:
|
||||
sql = "SELECT * FROM `"+LoadProperties.MySQLtablePrefix+"experience` ORDER BY `"+LoadProperties.MySQLtablePrefix+"experience`.`fishing` ASC LIMIT 0 , 30";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
if (stmt.executeQuery() != null) {
|
||||
@@ -178,111 +150,153 @@ public class Database {
|
||||
Rows.put(rs.getRow(), Col);
|
||||
}
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
System.out.println("Updating mcMMO MySQL tables for Blast Mining...");
|
||||
Write("ALTER TABLE `"+LoadProperties.MySQLtablePrefix + "cooldowns` ADD `blast_mining` int(32) NOT NULL DEFAULT '0' ;");
|
||||
}
|
||||
}
|
||||
|
||||
// write query
|
||||
public boolean Write(String sql) {
|
||||
if(conn != null)
|
||||
{
|
||||
try {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
stmt.executeUpdate();
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
System.out.println("SQLException: " + ex.getMessage());
|
||||
System.out.println("SQLState: " + ex.getSQLState());
|
||||
System.out.println("VendorError: " + ex.getErrorCode());
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
isConnected = false;
|
||||
connect(); //Attempt to reconnect
|
||||
if(isConnected = true)
|
||||
{
|
||||
Write(sql); //Try the same operation again now that we are connected
|
||||
} else {
|
||||
System.out.println("[mcMMO] Unable to connect to MySQL! Make sure the SQL server is online!");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get Int
|
||||
// only return first row / first field
|
||||
public Integer GetInt(String sql) {
|
||||
ResultSet rs = null;
|
||||
Integer result = 0;
|
||||
if(conn != null)
|
||||
{
|
||||
try {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
stmt = conn.prepareStatement(sql);
|
||||
if (stmt.executeQuery() != null) {
|
||||
stmt.executeQuery();
|
||||
rs = stmt.getResultSet();
|
||||
if (rs.next()) {
|
||||
result = rs.getInt(1);
|
||||
} else {
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
System.out.println("SQLException: " + ex.getMessage());
|
||||
System.out.println("SQLState: " + ex.getSQLState());
|
||||
System.out.println("VendorError: " + ex.getErrorCode());
|
||||
}
|
||||
} else {
|
||||
isConnected = false;
|
||||
connect(); //Attempt to reconnect
|
||||
if(isConnected = true)
|
||||
{
|
||||
GetInt(sql); //Try the same operation again now that we are connected
|
||||
} else {
|
||||
System.out.println("[mcMMO] Unable to connect to MySQL! Make sure the SQL server is online!");
|
||||
catch (SQLException ex) {
|
||||
if (update.equals(DatabaseUpdate.BLAST_MINING)) {
|
||||
System.out.println("Updating mcMMO MySQL tables for Blast Mining...");
|
||||
write("ALTER TABLE `"+LoadProperties.MySQLtablePrefix + "cooldowns` ADD `blast_mining` int(32) NOT NULL DEFAULT '0' ;");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// read query
|
||||
public HashMap<Integer, ArrayList<String>> Read(String sql) {
|
||||
ResultSet rs = null;
|
||||
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
|
||||
if(conn != null)
|
||||
{
|
||||
try {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
if (stmt.executeQuery() != null) {
|
||||
stmt.executeQuery();
|
||||
rs = stmt.getResultSet();
|
||||
while (rs.next()) {
|
||||
ArrayList<String> Col = new ArrayList<String>();
|
||||
for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
|
||||
Col.add(rs.getString(i));
|
||||
}
|
||||
Rows.put(rs.getRow(), Col);
|
||||
}
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
System.out.println("SQLException: " + ex.getMessage());
|
||||
System.out.println("SQLState: " + ex.getSQLState());
|
||||
System.out.println("VendorError: " + ex.getErrorCode());
|
||||
}
|
||||
} else {
|
||||
isConnected = false;
|
||||
connect(); //Attempt to reconnect
|
||||
if(isConnected = true)
|
||||
{
|
||||
Read(sql); //Attempt the same operation again now that we are connected
|
||||
} else {
|
||||
System.out.println("[mcMMO] Unable to connect to MySQL! Make sure the SQL server is online!");
|
||||
else if (update.equals(DatabaseUpdate.FISHING)) {
|
||||
System.out.println("Updating mcMMO MySQL tables for Fishing...");
|
||||
write("ALTER TABLE `"+LoadProperties.MySQLtablePrefix + "skills` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
|
||||
write("ALTER TABLE `"+LoadProperties.MySQLtablePrefix + "experience` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;");
|
||||
}
|
||||
}
|
||||
return Rows;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to write the SQL query.
|
||||
*
|
||||
* @param sql Query to write.
|
||||
* @return true if the query was successfully written, false otherwise.
|
||||
*/
|
||||
public boolean write(String sql) {
|
||||
if (isConnected()) {
|
||||
try {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
stmt.executeUpdate();
|
||||
return true;
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
attemptReconnect();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Integer. Only return first row / first field.
|
||||
*
|
||||
* @param sql SQL query to execute
|
||||
* @return the value in the first row / first field
|
||||
*/
|
||||
public Integer getInt(String sql) {
|
||||
ResultSet rs = null;
|
||||
Integer result = 0;
|
||||
|
||||
if (isConnected()) {
|
||||
try {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
stmt = conn.prepareStatement(sql);
|
||||
if (stmt.executeQuery() != null) {
|
||||
stmt.executeQuery();
|
||||
rs = stmt.getResultSet();
|
||||
if (rs.next()) {
|
||||
result = rs.getInt(1);
|
||||
}
|
||||
else {
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
attemptReconnect();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get connection status
|
||||
*
|
||||
* @return the boolean value for whether or not we are connected
|
||||
*/
|
||||
public boolean isConnected() {
|
||||
if(conn == null)
|
||||
return false;
|
||||
|
||||
try {
|
||||
return conn.isValid(3);
|
||||
} catch (SQLException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules a Sync Delayed Task with the Bukkit Scheduler to attempt reconnection after a minute has elapsed
|
||||
* This will check for a connection being present or not to prevent unneeded reconnection attempts
|
||||
*/
|
||||
public void attemptReconnect() {
|
||||
if(reconnectTimestamp+60000 < System.currentTimeMillis()) //Only reconnect if another attempt hasn't been made recently
|
||||
{
|
||||
System.out.println("[mcMMO] Connection to MySQL was lost! Attempting to reconnect in 60 seconds...");
|
||||
reconnectTimestamp = System.currentTimeMillis();
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin,
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
if (!isConnected()) {
|
||||
connect();
|
||||
}
|
||||
}
|
||||
}, 20*60);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read SQL query.
|
||||
*
|
||||
* @param sql SQL query to read
|
||||
* @return the rows in this SQL query
|
||||
*/
|
||||
public HashMap<Integer, ArrayList<String>> read(String sql) {
|
||||
ResultSet rs = null;
|
||||
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
|
||||
|
||||
if (isConnected()) {
|
||||
try {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
if (stmt.executeQuery() != null) {
|
||||
stmt.executeQuery();
|
||||
rs = stmt.getResultSet();
|
||||
while (rs.next()) {
|
||||
ArrayList<String> Col = new ArrayList<String>();
|
||||
for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
|
||||
Col.add(rs.getString(i));
|
||||
}
|
||||
Rows.put(rs.getRow(), Col);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
printErrors(ex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
attemptReconnect();
|
||||
}
|
||||
return Rows;
|
||||
}
|
||||
|
||||
private static void printErrors(SQLException ex) {
|
||||
System.out.println("SQLException: " + ex.getMessage());
|
||||
System.out.println("SQLState: " + ex.getSQLState());
|
||||
System.out.println("VendorError: " + ex.getErrorCode());
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,10 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
@@ -28,54 +12,53 @@ import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
|
||||
public class Item {
|
||||
|
||||
public static void itemchecks(Player player, Plugin plugin)
|
||||
{
|
||||
ItemStack inhand = player.getItemInHand();
|
||||
if(LoadProperties.chimaeraWingEnable && inhand.getTypeId() == LoadProperties.chimaeraId)
|
||||
chimaerawing(player, plugin);
|
||||
}
|
||||
|
||||
public static void chimaerawing(Player player, Plugin plugin)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
ItemStack is = player.getItemInHand();
|
||||
Block block = player.getLocation().getBlock();
|
||||
int chimaeraID = LoadProperties.chimaeraId;
|
||||
int itemsUsed = LoadProperties.feathersConsumedByChimaeraWing;
|
||||
if(mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == chimaeraID)
|
||||
{
|
||||
if(Skills.cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= itemsUsed)
|
||||
{
|
||||
Block derp = player.getLocation().getBlock();
|
||||
int y = derp.getY();
|
||||
player.setItemInHand(new ItemStack(chimaeraID, is.getAmount() - itemsUsed));
|
||||
|
||||
while(y < 127)
|
||||
{
|
||||
y++;
|
||||
if(player != null)
|
||||
{
|
||||
if(player.getLocation().getWorld().getBlockAt(block.getX(), y, block.getZ()).getType() != Material.AIR)
|
||||
{
|
||||
player.sendMessage(mcLocale.getString("Item.ChimaeraWingFail")); //$NON-NLS-1$
|
||||
player.teleport(player.getLocation().getWorld().getBlockAt(block.getX(), (y - 1), block.getZ()).getLocation());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(player.getBedSpawnLocation() != null && player.getBedSpawnLocation().getBlock().getType().equals(Material.BED_BLOCK))
|
||||
player.teleport(player.getBedSpawnLocation());
|
||||
else
|
||||
player.teleport(player.getWorld().getSpawnLocation());
|
||||
|
||||
player.sendMessage(mcLocale.getString("Item.ChimaeraWingPass")); //$NON-NLS-1$
|
||||
}
|
||||
else if (!Skills.cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= itemsUsed)
|
||||
player.sendMessage(mcLocale.getString("Item.InjuredWait", new Object[] {Skills.calculateTimeLeft(player, PP.getRecentlyHurt(), 60)})); //$NON-NLS-1$
|
||||
else if (is.getTypeId() == LoadProperties.chimaeraId && is.getAmount() <= itemsUsed)
|
||||
player.sendMessage(mcLocale.getString("Item.NeedFeathers")); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for item usage.
|
||||
*
|
||||
* @param player Player whose item usage to check
|
||||
*/
|
||||
public static void itemchecks(Player player) {
|
||||
ItemStack inhand = player.getItemInHand();
|
||||
|
||||
if (LoadProperties.chimaeraWingEnable && inhand.getTypeId() == LoadProperties.chimaeraId) {
|
||||
chimaerawing(player);
|
||||
}
|
||||
}
|
||||
|
||||
private static void chimaerawing(Player player) {
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
ItemStack is = player.getItemInHand();
|
||||
Block block = player.getLocation().getBlock();
|
||||
int amount = is.getAmount();
|
||||
|
||||
if (mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == LoadProperties.chimaeraId) {
|
||||
if (Skills.cooldownOver(PP.getRecentlyHurt(), 60) && amount >= LoadProperties.feathersConsumedByChimaeraWing) {
|
||||
player.setItemInHand(new ItemStack(LoadProperties.chimaeraId, amount - LoadProperties.feathersConsumedByChimaeraWing));
|
||||
|
||||
for (int y = 0; block.getY() + y < player.getWorld().getMaxHeight(); y++) {
|
||||
if (!block.getRelative(0, y, 0).getType().equals(Material.AIR)) {
|
||||
player.sendMessage(mcLocale.getString("Item.ChimaeraWingFail"));
|
||||
player.teleport(block.getRelative(0, y - 1, 0).getLocation());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (player.getBedSpawnLocation() != null && player.getBedSpawnLocation().getBlock().getType().equals(Material.BED_BLOCK)) {
|
||||
player.teleport(player.getBedSpawnLocation());
|
||||
}
|
||||
else {
|
||||
player.teleport(player.getWorld().getSpawnLocation());
|
||||
}
|
||||
|
||||
player.sendMessage(mcLocale.getString("Item.ChimaeraWingPass"));
|
||||
}
|
||||
else if (!Skills.cooldownOver(PP.getRecentlyHurt(), 60) && is.getAmount() >= LoadProperties.feathersConsumedByChimaeraWing) {
|
||||
player.sendMessage(mcLocale.getString("Item.InjuredWait", new Object[] {Skills.calculateTimeLeft(PP.getRecentlyHurt(), 60)}));
|
||||
}
|
||||
else if (is.getAmount() <= LoadProperties.feathersConsumedByChimaeraWing) {
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(LoadProperties.chimaeraId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
380
src/main/java/com/gmail/nossr50/ItemChecks.java
Normal file
380
src/main/java/com/gmail/nossr50/ItemChecks.java
Normal file
@@ -0,0 +1,380 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ItemChecks {
|
||||
|
||||
/**
|
||||
* Checks if the item is a sword.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is a sword, false otherwise
|
||||
*/
|
||||
public static boolean isSword(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case DIAMOND_SWORD:
|
||||
case GOLD_SWORD:
|
||||
case IRON_SWORD:
|
||||
case STONE_SWORD:
|
||||
case WOOD_SWORD:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the item is a hoe.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is a hoe, false otherwise
|
||||
*/
|
||||
public static boolean isHoe(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case DIAMOND_HOE:
|
||||
case GOLD_HOE:
|
||||
case IRON_HOE:
|
||||
case STONE_HOE:
|
||||
case WOOD_HOE:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the item is a shovel.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is a shovel, false otherwise
|
||||
*/
|
||||
public static boolean isShovel(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case DIAMOND_SPADE:
|
||||
case GOLD_SPADE:
|
||||
case IRON_SPADE:
|
||||
case STONE_SPADE:
|
||||
case WOOD_SPADE:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the item is an axe.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is an axe, false otherwise
|
||||
*/
|
||||
public static boolean isAxe(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case DIAMOND_AXE:
|
||||
case GOLD_AXE:
|
||||
case IRON_AXE:
|
||||
case STONE_AXE:
|
||||
case WOOD_AXE:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the item is a pickaxe.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is a pickaxe, false otherwise
|
||||
*/
|
||||
public static boolean isMiningPick(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case DIAMOND_PICKAXE:
|
||||
case GOLD_PICKAXE:
|
||||
case IRON_PICKAXE:
|
||||
case STONE_PICKAXE:
|
||||
case WOOD_PICKAXE:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the item is a helmet.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is a helmet, false otherwise
|
||||
*/
|
||||
public static boolean isHelmet(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case DIAMOND_HELMET:
|
||||
case GOLD_HELMET:
|
||||
case IRON_HELMET:
|
||||
case LEATHER_HELMET:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the item is a chestplate.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is a chestplate, false otherwise
|
||||
*/
|
||||
public static boolean isChestplate(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case DIAMOND_CHESTPLATE:
|
||||
case GOLD_CHESTPLATE:
|
||||
case IRON_CHESTPLATE:
|
||||
case LEATHER_CHESTPLATE:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the item is a pair of pants.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is a pair of pants, false otherwise
|
||||
*/
|
||||
public static boolean isPants(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case DIAMOND_LEGGINGS:
|
||||
case GOLD_LEGGINGS:
|
||||
case IRON_LEGGINGS:
|
||||
case LEATHER_LEGGINGS:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the item is a pair of boots.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is a pair of boots, false otherwise
|
||||
*/
|
||||
public static boolean isBoots(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case DIAMOND_BOOTS:
|
||||
case GOLD_BOOTS:
|
||||
case IRON_BOOTS:
|
||||
case LEATHER_BOOTS:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if an item is a wearable armor piece.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is armor, false otherwise
|
||||
*/
|
||||
public static boolean isArmor(ItemStack is) {
|
||||
return isLeatherArmor(is) || isGoldArmor(is) || isIronArmor(is) || isDiamondArmor(is);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if an item is a leather armor piece.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is leather armor, false otherwise
|
||||
*/
|
||||
public static boolean isLeatherArmor(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case LEATHER_BOOTS:
|
||||
case LEATHER_CHESTPLATE:
|
||||
case LEATHER_HELMET:
|
||||
case LEATHER_LEGGINGS:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if an item is a gold armor piece.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is gold armor, false otherwise
|
||||
*/
|
||||
public static boolean isGoldArmor(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case GOLD_BOOTS:
|
||||
case GOLD_CHESTPLATE:
|
||||
case GOLD_HELMET:
|
||||
case GOLD_LEGGINGS:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if an item is an iron armor piece.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is iron armor, false otherwise
|
||||
*/
|
||||
public static boolean isIronArmor(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case IRON_BOOTS:
|
||||
case IRON_CHESTPLATE:
|
||||
case IRON_HELMET:
|
||||
case IRON_LEGGINGS:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if an item is a diamond armor piece.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is diamond armor, false otherwise
|
||||
*/
|
||||
public static boolean isDiamondArmor(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case DIAMOND_BOOTS:
|
||||
case DIAMOND_CHESTPLATE:
|
||||
case DIAMOND_HELMET:
|
||||
case DIAMOND_LEGGINGS:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if an item is a tool.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is a tool, false otherwise
|
||||
*/
|
||||
public static boolean isTool(ItemStack is) {
|
||||
return isStoneTool(is) || isWoodTool(is) || isGoldTool(is) || isIronTool(is) || isDiamondTool(is) || is.getType().equals(Material.BOW);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if an item is a stone tool.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is a stone tool, false otherwise
|
||||
*/
|
||||
public static boolean isStoneTool(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case STONE_AXE:
|
||||
case STONE_HOE:
|
||||
case STONE_PICKAXE:
|
||||
case STONE_SPADE:
|
||||
case STONE_SWORD:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if an item is a wooden tool.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is a wooden tool, false otherwise
|
||||
*/
|
||||
public static boolean isWoodTool(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case WOOD_AXE:
|
||||
case WOOD_HOE:
|
||||
case WOOD_PICKAXE:
|
||||
case WOOD_SPADE:
|
||||
case WOOD_SWORD:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if an item is a gold tool.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is a stone tool, false otherwise
|
||||
*/
|
||||
public static boolean isGoldTool(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case GOLD_AXE:
|
||||
case GOLD_HOE:
|
||||
case GOLD_PICKAXE:
|
||||
case GOLD_SPADE:
|
||||
case GOLD_SWORD:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if an item is an iron tool.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is an iron tool, false otherwise
|
||||
*/
|
||||
public static boolean isIronTool(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case IRON_AXE:
|
||||
case IRON_HOE:
|
||||
case IRON_PICKAXE:
|
||||
case IRON_SPADE:
|
||||
case IRON_SWORD:
|
||||
case SHEARS:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if an item is a diamond tool.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is a diamond tool, false otherwise
|
||||
*/
|
||||
public static boolean isDiamondTool(ItemStack is) {
|
||||
switch (is.getType()) {
|
||||
case DIAMOND_AXE:
|
||||
case DIAMOND_HOE:
|
||||
case DIAMOND_PICKAXE:
|
||||
case DIAMOND_SPADE:
|
||||
case DIAMOND_SWORD:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -22,254 +6,286 @@ import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerStat;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.datatypes.Tree;
|
||||
|
||||
public class Leaderboard
|
||||
{
|
||||
static String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users"; //$NON-NLS-1$
|
||||
protected static final Logger log = Logger.getLogger("Minecraft"); //$NON-NLS-1$
|
||||
|
||||
/*
|
||||
* Read from the file
|
||||
*/
|
||||
public static void makeLeaderboards()
|
||||
{
|
||||
//Make Trees
|
||||
Tree Mining = new Tree();
|
||||
Tree WoodCutting = new Tree();
|
||||
Tree Herbalism = new Tree();
|
||||
Tree Excavation = new Tree();
|
||||
Tree Acrobatics = new Tree();
|
||||
Tree Repair = new Tree();
|
||||
Tree Swords = new Tree();
|
||||
Tree Axes = new Tree();
|
||||
Tree Archery = new Tree();
|
||||
Tree Unarmed = new Tree();
|
||||
Tree Taming = new Tree();
|
||||
Tree Fishing = new Tree();
|
||||
Tree PowerLevel = new Tree();
|
||||
|
||||
//Add Data To Trees
|
||||
try {
|
||||
//Open the user file
|
||||
FileReader file = new FileReader(location);
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
String line = ""; //$NON-NLS-1$
|
||||
ArrayList<String> players = new ArrayList<String>();
|
||||
while((line = in.readLine()) != null)
|
||||
{
|
||||
String[] character = line.split(":"); //$NON-NLS-1$
|
||||
String p = character[0];
|
||||
|
||||
//Prevent the same player from being added multiple times
|
||||
if(players.contains(p))
|
||||
continue;
|
||||
else
|
||||
players.add(p);
|
||||
public class Leaderboard {
|
||||
static String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
|
||||
|
||||
int Plvl = 0;
|
||||
|
||||
if(character.length > 1 && m.isInt(character[1]))
|
||||
{
|
||||
Mining.add(p, Integer.valueOf(character[1]));
|
||||
Plvl += Integer.valueOf(character[1]);
|
||||
}
|
||||
if(character.length > 5 && m.isInt(character[5])){
|
||||
WoodCutting.add(p, Integer.valueOf(character[5]));
|
||||
Plvl += Integer.valueOf(character[5]);
|
||||
}
|
||||
if(character.length > 7 && m.isInt(character[7])){
|
||||
Repair.add(p, Integer.valueOf(character[7]));
|
||||
Plvl += Integer.valueOf(character[7]);
|
||||
}
|
||||
if(character.length > 8 && m.isInt(character[8])){
|
||||
Unarmed.add(p, Integer.valueOf(character[8]));
|
||||
Plvl += Integer.valueOf(character[8]);
|
||||
}
|
||||
if(character.length > 9 && m.isInt(character[9])){
|
||||
Herbalism.add(p, Integer.valueOf(character[9]));
|
||||
Plvl += Integer.valueOf(character[9]);
|
||||
}
|
||||
if(character.length > 10 && m.isInt(character[10])){
|
||||
Excavation.add(p, Integer.valueOf(character[10]));
|
||||
Plvl += Integer.valueOf(character[10]);
|
||||
}
|
||||
if(character.length > 11 && m.isInt(character[11])){
|
||||
Archery.add(p, Integer.valueOf(character[11]));
|
||||
Plvl += Integer.valueOf(character[11]);
|
||||
}
|
||||
if(character.length > 12 && m.isInt(character[12])){
|
||||
Swords.add(p, Integer.valueOf(character[12]));
|
||||
Plvl += Integer.valueOf(character[12]);
|
||||
}
|
||||
if(character.length > 13 && m.isInt(character[13])){
|
||||
Axes.add(p, Integer.valueOf(character[13]));
|
||||
Plvl += Integer.valueOf(character[13]);
|
||||
}
|
||||
if(character.length > 14 && m.isInt(character[14])){
|
||||
Acrobatics.add(p, Integer.valueOf(character[14]));
|
||||
Plvl += Integer.valueOf(character[14]);
|
||||
}
|
||||
if(character.length > 24 && m.isInt(character[24])){
|
||||
Taming.add(p, Integer.valueOf(character[24]));
|
||||
Plvl += Integer.valueOf(character[24]);
|
||||
}
|
||||
if(character.length > 34 && m.isInt(character[34]))
|
||||
{
|
||||
Fishing.add(p, Integer.valueOf(character[34]));
|
||||
Plvl += Integer.valueOf(character[34]);
|
||||
}
|
||||
|
||||
PowerLevel.add(p, Plvl);
|
||||
}
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Exception while reading " //$NON-NLS-1$
|
||||
+ location + " (Are you sure you formatted it correctly?)", e); //$NON-NLS-1$
|
||||
/**
|
||||
* Create the leaderboards.
|
||||
*/
|
||||
public static void makeLeaderboards() {
|
||||
//Make Trees
|
||||
Tree Mining = new Tree();
|
||||
Tree WoodCutting = new Tree();
|
||||
Tree Herbalism = new Tree();
|
||||
Tree Excavation = new Tree();
|
||||
Tree Acrobatics = new Tree();
|
||||
Tree Repair = new Tree();
|
||||
Tree Swords = new Tree();
|
||||
Tree Axes = new Tree();
|
||||
Tree Archery = new Tree();
|
||||
Tree Unarmed = new Tree();
|
||||
Tree Taming = new Tree();
|
||||
Tree Fishing = new Tree();
|
||||
Tree PowerLevel = new Tree();
|
||||
|
||||
//Add Data To Trees
|
||||
try {
|
||||
FileReader file = new FileReader(location);
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
String line = "";
|
||||
ArrayList<String> players = new ArrayList<String>();
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
String[] character = line.split(":");
|
||||
String p = character[0];
|
||||
int powerLevel = 0;
|
||||
|
||||
//Prevent the same player from being added multiple times
|
||||
if (players.contains(p)) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
players.add(p);
|
||||
}
|
||||
|
||||
if (character.length > 1 && m.isInt(character[1])) {
|
||||
Mining.add(p, Integer.valueOf(character[1]));
|
||||
powerLevel += Integer.valueOf(character[1]);
|
||||
}
|
||||
|
||||
if (character.length > 5 && m.isInt(character[5])) {
|
||||
WoodCutting.add(p, Integer.valueOf(character[5]));
|
||||
powerLevel += Integer.valueOf(character[5]);
|
||||
}
|
||||
|
||||
if (character.length > 7 && m.isInt(character[7])) {
|
||||
Repair.add(p, Integer.valueOf(character[7]));
|
||||
powerLevel += Integer.valueOf(character[7]);
|
||||
}
|
||||
|
||||
if (character.length > 8 && m.isInt(character[8])) {
|
||||
Unarmed.add(p, Integer.valueOf(character[8]));
|
||||
powerLevel += Integer.valueOf(character[8]);
|
||||
}
|
||||
|
||||
if (character.length > 9 && m.isInt(character[9])) {
|
||||
Herbalism.add(p, Integer.valueOf(character[9]));
|
||||
powerLevel += Integer.valueOf(character[9]);
|
||||
}
|
||||
|
||||
if (character.length > 10 && m.isInt(character[10])) {
|
||||
Excavation.add(p, Integer.valueOf(character[10]));
|
||||
powerLevel += Integer.valueOf(character[10]);
|
||||
}
|
||||
|
||||
if (character.length > 11 && m.isInt(character[11])) {
|
||||
Archery.add(p, Integer.valueOf(character[11]));
|
||||
powerLevel += Integer.valueOf(character[11]);
|
||||
}
|
||||
|
||||
if (character.length > 12 && m.isInt(character[12])) {
|
||||
Swords.add(p, Integer.valueOf(character[12]));
|
||||
powerLevel += Integer.valueOf(character[12]);
|
||||
}
|
||||
|
||||
if (character.length > 13 && m.isInt(character[13])) {
|
||||
Axes.add(p, Integer.valueOf(character[13]));
|
||||
powerLevel += Integer.valueOf(character[13]);
|
||||
}
|
||||
|
||||
if (character.length > 14 && m.isInt(character[14])) {
|
||||
Acrobatics.add(p, Integer.valueOf(character[14]));
|
||||
powerLevel += Integer.valueOf(character[14]);
|
||||
}
|
||||
|
||||
if (character.length > 24 && m.isInt(character[24])) {
|
||||
Taming.add(p, Integer.valueOf(character[24]));
|
||||
powerLevel += Integer.valueOf(character[24]);
|
||||
}
|
||||
|
||||
if (character.length > 34 && m.isInt(character[34])) {
|
||||
Fishing.add(p, Integer.valueOf(character[34]));
|
||||
powerLevel += Integer.valueOf(character[34]);
|
||||
}
|
||||
|
||||
PowerLevel.add(p, powerLevel);
|
||||
}
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Bukkit.getLogger().severe(("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString()));
|
||||
}
|
||||
|
||||
//Write the leader board files
|
||||
leaderWrite(Mining.inOrder(), SkillType.MINING); //$NON-NLS-1$
|
||||
leaderWrite(WoodCutting.inOrder(), SkillType.WOODCUTTING); //$NON-NLS-1$
|
||||
leaderWrite(Repair.inOrder(), SkillType.REPAIR); //$NON-NLS-1$
|
||||
leaderWrite(Unarmed.inOrder(), SkillType.UNARMED); //$NON-NLS-1$
|
||||
leaderWrite(Herbalism.inOrder(), SkillType.HERBALISM); //$NON-NLS-1$
|
||||
leaderWrite(Excavation.inOrder(), SkillType.EXCAVATION); //$NON-NLS-1$
|
||||
leaderWrite(Archery.inOrder(), SkillType.ARCHERY); //$NON-NLS-1$
|
||||
leaderWrite(Swords.inOrder(), SkillType.SWORDS); //$NON-NLS-1$
|
||||
leaderWrite(Axes.inOrder(), SkillType.AXES); //$NON-NLS-1$
|
||||
leaderWrite(Acrobatics.inOrder(), SkillType.ACROBATICS); //$NON-NLS-1$
|
||||
leaderWrite(Taming.inOrder(), SkillType.TAMING); //$NON-NLS-1$
|
||||
leaderWrite(Fishing.inOrder(), SkillType.FISHING); //$NON-NLS-1$
|
||||
leaderWrite(PowerLevel.inOrder(), SkillType.ALL); //$NON-NLS-1$
|
||||
}
|
||||
public static void leaderWrite(PlayerStat[] ps, SkillType skillType)
|
||||
{
|
||||
String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + skillType + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
//CHECK IF THE FILE EXISTS
|
||||
File theDir = new File(theLocation);
|
||||
if(!theDir.exists())
|
||||
{
|
||||
//properties = new PropertiesFile(location);
|
||||
FileWriter writer = null;
|
||||
try {
|
||||
writer = new FileWriter(theLocation);
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Exception while creating " + theLocation, e); //$NON-NLS-1$
|
||||
} finally {
|
||||
try {
|
||||
if (writer != null) {
|
||||
writer.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.log(Level.SEVERE, "Exception while closing writer for " + theLocation, e); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
FileReader file = new FileReader(theLocation);
|
||||
|
||||
//HERP
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
StringBuilder writer = new StringBuilder();
|
||||
|
||||
for(PlayerStat p : ps)
|
||||
{
|
||||
if(p.name.equals("$mcMMO_DummyInfo")) //$NON-NLS-1$
|
||||
continue;
|
||||
if(p.statVal == 0)
|
||||
continue;
|
||||
writer.append(p.name + ":" + p.statVal); //$NON-NLS-1$
|
||||
writer.append("\r\n"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
in.close();
|
||||
//Write the new file
|
||||
FileWriter out = new FileWriter(theLocation);
|
||||
out.write(writer.toString());
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)", e); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
//Create/open the file
|
||||
//Loop through backward writing each player
|
||||
//Close the file
|
||||
}
|
||||
|
||||
public static String[] retrieveInfo(String skillName, int pagenumber)
|
||||
{
|
||||
String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + skillName + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
try {
|
||||
FileReader file = new FileReader(theLocation);
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
|
||||
int destination = (pagenumber - 1) * 10; //How many lines to skip through
|
||||
int x = 0; //how many lines we've gone through
|
||||
int y = 0; //going through the lines
|
||||
String line = ""; //$NON-NLS-1$
|
||||
String[] info = new String[10]; //what to return
|
||||
while((line = in.readLine()) != null && y < 10)
|
||||
{
|
||||
x++;
|
||||
if(x >= destination && y < 10){
|
||||
info[y] = line.toString();
|
||||
y++;
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
return info;
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Exception while reading " //$NON-NLS-1$
|
||||
+ theLocation + " (Are you sure you formatted it correctly?)", e); //$NON-NLS-1$
|
||||
leaderWrite(Mining.inOrder(), SkillType.MINING);
|
||||
leaderWrite(WoodCutting.inOrder(), SkillType.WOODCUTTING);
|
||||
leaderWrite(Repair.inOrder(), SkillType.REPAIR);
|
||||
leaderWrite(Unarmed.inOrder(), SkillType.UNARMED);
|
||||
leaderWrite(Herbalism.inOrder(), SkillType.HERBALISM);
|
||||
leaderWrite(Excavation.inOrder(), SkillType.EXCAVATION);
|
||||
leaderWrite(Archery.inOrder(), SkillType.ARCHERY);
|
||||
leaderWrite(Swords.inOrder(), SkillType.SWORDS);
|
||||
leaderWrite(Axes.inOrder(), SkillType.AXES);
|
||||
leaderWrite(Acrobatics.inOrder(), SkillType.ACROBATICS);
|
||||
leaderWrite(Taming.inOrder(), SkillType.TAMING);
|
||||
leaderWrite(Fishing.inOrder(), SkillType.FISHING);
|
||||
leaderWrite(PowerLevel.inOrder(), SkillType.ALL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to the leaderboards.
|
||||
*
|
||||
* @param ps Stats to write to the leaderboard
|
||||
* @param skillType Skill type to write the leaderboard of
|
||||
*/
|
||||
private static void leaderWrite(PlayerStat[] ps, SkillType skillType) {
|
||||
String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + skillType + ".mcmmo";
|
||||
File theDir = new File(theLocation);
|
||||
|
||||
//CHECK IF THE FILE EXISTS
|
||||
if (!theDir.exists()) {
|
||||
FileWriter writer = null;
|
||||
|
||||
try {
|
||||
writer = new FileWriter(theLocation);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Bukkit.getLogger().severe(("Exception while creating " + theLocation + e.toString()));
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
if (writer != null) {
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
Bukkit.getLogger().severe("Exception while closing writer for " + theLocation + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
FileReader file = new FileReader(theLocation);
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
StringBuilder writer = new StringBuilder();
|
||||
|
||||
for (PlayerStat p : ps) {
|
||||
if (p.name.equals("$mcMMO_DummyInfo")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (p.statVal == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
writer.append(p.name + ":" + p.statVal);
|
||||
writer.append("\r\n");
|
||||
}
|
||||
|
||||
in.close();
|
||||
FileWriter out = new FileWriter(theLocation);
|
||||
out.write(writer.toString());
|
||||
out.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Bukkit.getLogger().severe("Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve leaderboard info.
|
||||
*
|
||||
* @param skillName Skill to retrieve info on.
|
||||
* @param pagenumber Which page in the leaderboards to retrieve
|
||||
* @return the requested leaderboard information
|
||||
*/
|
||||
public static String[] retrieveInfo(String skillName, int pagenumber) {
|
||||
String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + skillName + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
try {
|
||||
FileReader file = new FileReader(theLocation);
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
int destination = (pagenumber - 1) * 10; //How many lines to skip through
|
||||
int x = 0; //how many lines we've gone through
|
||||
int y = 0; //going through the lines
|
||||
String line = "";
|
||||
String[] info = new String[10]; //what to return
|
||||
|
||||
while ((line = in.readLine()) != null && y < 10) {
|
||||
x++;
|
||||
|
||||
if (x >= destination && y < 10) {
|
||||
info[y] = line.toString();
|
||||
y++;
|
||||
}
|
||||
}
|
||||
|
||||
in.close();
|
||||
return info;
|
||||
}
|
||||
catch (Exception e) {
|
||||
Bukkit.getLogger().severe("Exception while reading " + theLocation + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
|
||||
return null; //Shouldn't get here
|
||||
}
|
||||
public static void updateLeaderboard(PlayerStat ps, SkillType skillType)
|
||||
{
|
||||
if(LoadProperties.useMySQL)
|
||||
return;
|
||||
String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + skillType + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
try {
|
||||
//Open the file
|
||||
FileReader file = new FileReader(theLocation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the leaderboards.
|
||||
*
|
||||
* @param ps Stats to update the leaderboard with.
|
||||
* @param skillType Skill whose leaderboard is being updated.
|
||||
*/
|
||||
public static void updateLeaderboard(PlayerStat ps, SkillType skillType) {
|
||||
if (LoadProperties.useMySQL) {
|
||||
return;
|
||||
}
|
||||
|
||||
String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + skillType + ".mcmmo";
|
||||
|
||||
try {
|
||||
FileReader file = new FileReader(theLocation);
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
StringBuilder writer = new StringBuilder();
|
||||
String line = ""; //$NON-NLS-1$
|
||||
Boolean inserted = false;
|
||||
//While not at the end of the file
|
||||
while((line = in.readLine()) != null)
|
||||
{
|
||||
//Insert the player into the line before it finds a smaller one
|
||||
if(Integer.valueOf(line.split(":")[1]) < ps.statVal && !inserted) //$NON-NLS-1$
|
||||
{
|
||||
writer.append(ps.name + ":" + ps.statVal).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
inserted = true;
|
||||
}
|
||||
//Write anything that isn't the player already in the file so we remove the duplicate
|
||||
if(!line.split(":")[0].equalsIgnoreCase(ps.name)) //$NON-NLS-1$
|
||||
{
|
||||
writer.append(line).append("\r\n"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
if(!inserted)
|
||||
{
|
||||
writer.append(ps.name + ":" + ps.statVal).append("\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
in.close();
|
||||
//Write the new file
|
||||
String line = "";
|
||||
Boolean inserted = false;
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
|
||||
//Insert the player into the line before it finds a smaller one
|
||||
if (Integer.valueOf(line.split(":")[1]) < ps.statVal && !inserted) {
|
||||
writer.append(ps.name + ":" + ps.statVal).append("\r\n");
|
||||
inserted = true;
|
||||
}
|
||||
|
||||
//Write anything that isn't the player already in the file so we remove the duplicate
|
||||
if (!line.split(":")[0].equalsIgnoreCase(ps.name)) {
|
||||
writer.append(line).append("\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
if(!inserted) {
|
||||
writer.append(ps.name + ":" + ps.statVal).append("\r\n");
|
||||
}
|
||||
|
||||
in.close();
|
||||
|
||||
//Write the new file
|
||||
FileWriter out = new FileWriter(theLocation);
|
||||
out.write(writer.toString());
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)", e); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
Bukkit.getLogger().severe("Exception while writing to " + theLocation + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,3 @@
|
||||
/*
|
||||
* Copyright 2011 Tyler Blair. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and contributors and should not be interpreted as representing official policies,
|
||||
* either expressed or implied, of anybody else.
|
||||
*/
|
||||
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
@@ -1,130 +1,142 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Logger;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
|
||||
|
||||
public class Users {
|
||||
private static volatile Users instance;
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
|
||||
String directory = "plugins/mcMMO/FlatFileStuff/";
|
||||
String directoryb = "plugins/mcMMO/FlatFileStuff/Leaderboards/";
|
||||
|
||||
//public static ArrayList<PlayerProfile> players;
|
||||
public static HashMap<Player, PlayerProfile> players = new HashMap<Player, PlayerProfile>();
|
||||
private Properties properties = new Properties();
|
||||
|
||||
//To load
|
||||
public void load() throws IOException {
|
||||
properties.load(new FileInputStream(location));
|
||||
}
|
||||
//To save
|
||||
public void save()
|
||||
{
|
||||
try
|
||||
{
|
||||
properties.store(new FileOutputStream(location), null);
|
||||
}catch(IOException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
public void loadUsers()
|
||||
{
|
||||
new File(directory).mkdir();
|
||||
new File(directoryb).mkdir();
|
||||
File theDir = new File(location);
|
||||
if(!theDir.exists())
|
||||
{
|
||||
try {
|
||||
FileWriter writer = new FileWriter(theDir);
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void addUser(Player player)
|
||||
{
|
||||
if(!players.containsKey(player))
|
||||
players.put(player, new PlayerProfile(player.getName()));
|
||||
}
|
||||
public static void clearUsers()
|
||||
{
|
||||
players.clear();
|
||||
}
|
||||
public static HashMap<Player, PlayerProfile> getProfiles(){
|
||||
return players;
|
||||
}
|
||||
|
||||
public static void removeUser(Player player)
|
||||
{
|
||||
//Only remove PlayerProfile if user is offline and we have it in memory
|
||||
if(!player.isOnline() && players.containsKey(player))
|
||||
{
|
||||
players.get(player).save();
|
||||
players.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeUserByName(String playerName)
|
||||
{
|
||||
Player target = null;
|
||||
for(Player player : players.keySet())
|
||||
{
|
||||
PlayerProfile PP = players.get(player);
|
||||
if(PP.getPlayerName().equals(playerName))
|
||||
{
|
||||
target = player;
|
||||
public static HashMap<String, PlayerProfile> players = new HashMap<String, PlayerProfile>();
|
||||
|
||||
/**
|
||||
* Load users.
|
||||
*/
|
||||
public void loadUsers() {
|
||||
new File(directory).mkdir();
|
||||
new File(directoryb).mkdir();
|
||||
File theDir = new File(location);
|
||||
|
||||
if (!theDir.exists()) {
|
||||
try {
|
||||
FileWriter writer = new FileWriter(theDir);
|
||||
writer.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
players.remove(target);
|
||||
}
|
||||
|
||||
public static PlayerProfile getProfile(Player player){
|
||||
if(players.get(player) != null)
|
||||
return players.get(player);
|
||||
else
|
||||
{
|
||||
players.put(player, new PlayerProfile(player.getName()));
|
||||
return players.get(player);
|
||||
}
|
||||
/**
|
||||
* Add a new user.
|
||||
*
|
||||
* @param player The player to create a user record for
|
||||
*/
|
||||
public static void addUser(Player player) {
|
||||
if (!players.containsKey(player.getName().toLowerCase())) {
|
||||
players.put(player.getName().toLowerCase(), new PlayerProfile(player.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all users.
|
||||
*/
|
||||
public static void clearUsers() {
|
||||
players.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all PlayerProfiles.
|
||||
*
|
||||
* @return a HashMap containing the PlayerProfile of everyone in the database
|
||||
*/
|
||||
public static HashMap<String, PlayerProfile> getProfiles() {
|
||||
return players;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a user from the database.
|
||||
*
|
||||
* @param player The player to remove
|
||||
*/
|
||||
public static void removeUser(Player player) {
|
||||
|
||||
//Only remove PlayerProfile if user is offline and we have it in memory
|
||||
if (!player.isOnline() && players.containsKey(player.getName().toLowerCase())) {
|
||||
players.get(player.getName().toLowerCase()).save();
|
||||
players.remove(player.getName().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a user from the DB by name.
|
||||
*
|
||||
* @param playerName The name of the player to remove
|
||||
*/
|
||||
public static void removeUserByName(String playerName) {
|
||||
players.remove(playerName.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the profile of an online player.
|
||||
*
|
||||
* @param player The player whose profile to retrieve
|
||||
* @return the player's profile
|
||||
*/
|
||||
public static PlayerProfile getProfile(Player player) {
|
||||
if(players.get(player.getName().toLowerCase()) != null) {
|
||||
return players.get(player.getName().toLowerCase());
|
||||
}
|
||||
else {
|
||||
players.put(player.getName().toLowerCase(), new PlayerProfile(player.getName()));
|
||||
return players.get(player.getName().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
public static PlayerProfile getOfflineProfile(String playerName){
|
||||
/**
|
||||
* Get the profile of an online player.
|
||||
*
|
||||
* @param player The player whose profile to retrieve
|
||||
* @return the player's profile
|
||||
*/
|
||||
public static PlayerProfile getProfile(String playerName) {
|
||||
if(players.get(playerName.toLowerCase()) != null) {
|
||||
return players.get(playerName.toLowerCase());
|
||||
}
|
||||
else {
|
||||
players.put(playerName.toLowerCase(), new PlayerProfile(playerName));
|
||||
return players.get(playerName.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the profile of an offline player.
|
||||
*
|
||||
* @param playerName Name of the player whose profile to retrieve
|
||||
* @return the player's profile
|
||||
*/
|
||||
public static PlayerProfile getOfflineProfile(String playerName) {
|
||||
return new PlayerProfile(playerName, false);
|
||||
}
|
||||
|
||||
public static Users getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new Users();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Get an instance of this class.
|
||||
*
|
||||
* @return an instance of this class
|
||||
*/
|
||||
public static Users getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new Users();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class InspectCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
if (args.length < 1) {
|
||||
sender.sendMessage(ChatColor.RED + "Proper usage is /whois <playername>");
|
||||
sender.sendMessage(ChatColor.RED + "Proper usage is /inspect <playername>");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class InspectCommand implements CommandExecutor {
|
||||
if (mcPermissions.getInstance().repair(target))
|
||||
sender.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillLevel(SkillType.REPAIR), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getXpToLevel(SkillType.REPAIR)));
|
||||
|
||||
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") + ChatColor.GREEN + (m.getPowerLevel(target)));
|
||||
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") + ChatColor.GREEN + (m.getPowerLevel(target, PPt)));
|
||||
} else {
|
||||
if(sender instanceof Player && !player.isOp())
|
||||
{
|
||||
@@ -100,8 +100,6 @@ public class InspectCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
System.out.println(PPt.isLoaded());
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "mcMMO Stats for Offline Player " + ChatColor.YELLOW + args[0]);
|
||||
|
||||
sender.sendMessage(ChatColor.GOLD + "-=GATHERING SKILLS=-");
|
||||
|
||||
@@ -71,7 +71,7 @@ public class McstatsCommand implements CommandExecutor {
|
||||
if (mcPermissions.getInstance().repair(player))
|
||||
player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR)));
|
||||
}
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") + ChatColor.GREEN + (m.getPowerLevel(player)));
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") + ChatColor.GREEN + (m.getPowerLevel(player, PP)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -8,23 +8,18 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
|
||||
public class MmoeditCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public MmoeditCommand(mcMMO instance) {
|
||||
this.plugin = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
player = (Player) sender;
|
||||
}
|
||||
|
||||
@@ -33,46 +28,88 @@ public class MmoeditCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
if (args.length < 2) {
|
||||
if (!(sender instanceof Player))
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
System.out.println("Usage is /mmoedit playername skillname newvalue");
|
||||
return true;
|
||||
} else if (args.length == 3) {
|
||||
if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) {
|
||||
} else if (args.length == 3)
|
||||
{
|
||||
PlayerProfile PPt = null;
|
||||
|
||||
if(Users.players.containsKey(args[0].toLowerCase())) {
|
||||
PPt = Users.players.get(args[0].toLowerCase());
|
||||
}
|
||||
|
||||
if(PPt == null)
|
||||
Users.getOfflineProfile(args[0]); //Only grab offline profile if the above failed
|
||||
|
||||
if(!PPt.isLoaded())
|
||||
{
|
||||
sender.sendMessage("Player does not exist in the database!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m.isInt(args[2]) && Skills.isSkill(args[1]))
|
||||
{
|
||||
int newvalue = Integer.valueOf(args[2]);
|
||||
Users.getProfile(plugin.getServer().getPlayer(args[0])).modifyskill(Skills.getSkillType(args[1]), newvalue);
|
||||
System.out.println(args[1] + " has been modified for " + plugin.getServer().getPlayer(args[0]).getName() + ".");
|
||||
Users.getOfflineProfile(args[0]).modifyskill(Skills.getSkillType(args[1]), newvalue);
|
||||
System.out.println(args[1] + " has been modified for " + args[0] + ".");
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
System.out.println("Usage is /mmoedit playername skillname newvalue");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (!mcPermissions.getInstance().mmoedit(player)) {
|
||||
if (!mcPermissions.getInstance().mmoedit(player))
|
||||
{
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
if (args.length < 2) {
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Usage is /mmoedit playername skillname newvalue");
|
||||
return true;
|
||||
}
|
||||
if (args.length == 3) {
|
||||
if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) {
|
||||
if (args.length == 3)
|
||||
{
|
||||
PlayerProfile PPt = null;
|
||||
|
||||
if(Users.players.containsKey(args[0].toLowerCase())) {
|
||||
PPt = Users.players.get(args[0].toLowerCase());
|
||||
}
|
||||
|
||||
if(PPt == null)
|
||||
Users.getOfflineProfile(args[0]); //Only grab offline profile if the above failed
|
||||
|
||||
if(!PPt.isLoaded())
|
||||
{
|
||||
sender.sendMessage("Player does not exist in the database!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m.isInt(args[2]) && Skills.isSkill(args[1]))
|
||||
{
|
||||
int newvalue = Integer.valueOf(args[2]);
|
||||
Users.getProfile(plugin.getServer().getPlayer(args[0])).modifyskill(Skills.getSkillType(args[1]), newvalue);
|
||||
player.sendMessage(ChatColor.RED + args[1] + " has been modified.");
|
||||
PPt.modifyskill(Skills.getSkillType(args[1]), newvalue);
|
||||
player.sendMessage(ChatColor.RED + args[1] + " has been modified for "+args[0]);
|
||||
}
|
||||
} else if (args.length == 2) {
|
||||
if (m.isInt(args[1]) && Skills.isSkill(args[0])) {
|
||||
} else if (args.length == 2)
|
||||
{
|
||||
if (m.isInt(args[1]) && Skills.isSkill(args[0]))
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int newvalue = Integer.valueOf(args[1]);
|
||||
PP.modifyskill(Skills.getSkillType(args[0]), newvalue);
|
||||
player.sendMessage(ChatColor.RED + args[0] + " has been modified.");
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Usage is /mmoedit playername skillname newvalue");
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,10 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.runnables.SQLConversionTask;
|
||||
|
||||
public class MmoupdateCommand implements CommandExecutor {
|
||||
@Override
|
||||
@@ -28,7 +29,7 @@ public class MmoupdateCommand implements CommandExecutor {
|
||||
}
|
||||
player.sendMessage(ChatColor.GRAY + "Starting conversion...");
|
||||
Users.clearUsers();
|
||||
m.convertToMySQL();
|
||||
convertToMySQL();
|
||||
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
|
||||
Users.addUser(x);
|
||||
}
|
||||
@@ -36,4 +37,15 @@ public class MmoupdateCommand implements CommandExecutor {
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert FlatFile data to MySQL data.
|
||||
*/
|
||||
private void convertToMySQL() {
|
||||
if (!LoadProperties.useMySQL) {
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().scheduleAsyncDelayedTask(Bukkit.getPluginManager().getPlugin("mcMMO"), new SQLConversionTask(), 1);
|
||||
}
|
||||
}
|
||||
@@ -38,30 +38,30 @@ public class McremoveCommand implements CommandExecutor {
|
||||
//If the server is using MySQL
|
||||
if(LoadProperties.useMySQL)
|
||||
{
|
||||
int userId = mcMMO.database.GetInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'");
|
||||
int userId = mcMMO.database.getInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'");
|
||||
|
||||
//Remove user from tables
|
||||
mcMMO.database.Write("DELETE FROM "
|
||||
mcMMO.database.write("DELETE FROM "
|
||||
+LoadProperties.MySQLdbName+"."
|
||||
+LoadProperties.MySQLtablePrefix+"users WHERE "
|
||||
+LoadProperties.MySQLtablePrefix+"users.id="+userId);
|
||||
|
||||
mcMMO.database.Write("DELETE FROM "
|
||||
mcMMO.database.write("DELETE FROM "
|
||||
+LoadProperties.MySQLdbName+"."
|
||||
+LoadProperties.MySQLtablePrefix+"cooldowns WHERE "
|
||||
+LoadProperties.MySQLtablePrefix+"cooldowns.user_id="+userId);
|
||||
|
||||
mcMMO.database.Write("DELETE FROM "
|
||||
mcMMO.database.write("DELETE FROM "
|
||||
+LoadProperties.MySQLdbName+"."
|
||||
+LoadProperties.MySQLtablePrefix+"huds WHERE "
|
||||
+LoadProperties.MySQLtablePrefix+"huds.user_id="+userId);
|
||||
|
||||
mcMMO.database.Write("DELETE FROM "
|
||||
mcMMO.database.write("DELETE FROM "
|
||||
+LoadProperties.MySQLdbName+"."
|
||||
+LoadProperties.MySQLtablePrefix+"skills WHERE "
|
||||
+LoadProperties.MySQLtablePrefix+"skills.user_id="+userId);
|
||||
|
||||
mcMMO.database.Write("DELETE FROM "
|
||||
mcMMO.database.write("DELETE FROM "
|
||||
+LoadProperties.MySQLdbName+"."
|
||||
+LoadProperties.MySQLtablePrefix+"experience WHERE "
|
||||
+LoadProperties.MySQLtablePrefix+"experience.user_id="+userId);
|
||||
|
||||
@@ -7,8 +7,6 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Leaderboard;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@@ -21,13 +19,6 @@ public class MctopCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (LoadProperties.useMySQL == false) {
|
||||
/*
|
||||
* POWER LEVEL INFO RETRIEVAL
|
||||
@@ -35,7 +26,7 @@ public class MctopCommand implements CommandExecutor {
|
||||
if (args.length == 0) {
|
||||
int p = 1;
|
||||
String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p);
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
|
||||
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
|
||||
int n = 1 * p; // Position
|
||||
for (String x : info) {
|
||||
if (x != null) {
|
||||
@@ -44,7 +35,7 @@ public class MctopCommand implements CommandExecutor {
|
||||
digit = "0" + String.valueOf(n);
|
||||
String[] splitx = x.split(":");
|
||||
// Format: 1. Playername - skill value
|
||||
player.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
|
||||
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
@@ -64,7 +55,7 @@ public class MctopCommand implements CommandExecutor {
|
||||
pt = 10;
|
||||
}
|
||||
String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p);
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
|
||||
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
|
||||
int n = 1 * pt; // Position
|
||||
for (String x : info) {
|
||||
if (x != null) {
|
||||
@@ -73,7 +64,7 @@ public class MctopCommand implements CommandExecutor {
|
||||
digit = "0" + String.valueOf(n);
|
||||
String[] splitx = x.split(":");
|
||||
// Format: 1. Playername - skill value
|
||||
player.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
|
||||
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
@@ -100,7 +91,7 @@ public class MctopCommand implements CommandExecutor {
|
||||
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
|
||||
|
||||
String[] info = Leaderboard.retrieveInfo(args[0].toUpperCase(), p);
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized }));
|
||||
sender.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized }));
|
||||
int n = 1 * pt; // Position
|
||||
for (String x : info) {
|
||||
if (x != null) {
|
||||
@@ -109,7 +100,7 @@ public class MctopCommand implements CommandExecutor {
|
||||
digit = "0" + String.valueOf(n);
|
||||
String[] splitx = x.split(":");
|
||||
// Format: 1. Playername - skill value
|
||||
player.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
|
||||
sender.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +119,7 @@ public class MctopCommand implements CommandExecutor {
|
||||
String remainder = args[0].substring(1); // Get remainder of word.
|
||||
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
|
||||
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized }));
|
||||
sender.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized }));
|
||||
if (args.length >= 2 && m.isInt(args[1])) {
|
||||
int n = 1; // For the page number
|
||||
int n2 = Integer.valueOf(args[1]);
|
||||
@@ -138,28 +129,28 @@ public class MctopCommand implements CommandExecutor {
|
||||
n = n * (n2 - 1);
|
||||
}
|
||||
// If a page number is specified
|
||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT " + lowercase + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + lowercase + " > 0 ORDER BY `" + LoadProperties.MySQLtablePrefix + "skills`.`" + lowercase + "` DESC ");
|
||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + lowercase + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + lowercase + " > 0 ORDER BY `" + LoadProperties.MySQLtablePrefix + "skills`.`" + lowercase + "` DESC ");
|
||||
|
||||
for (int i = n; i <= n + 10; i++) {
|
||||
if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||
if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||
break;
|
||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||
player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
|
||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||
sender.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// If no page number is specified
|
||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT " + lowercase + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + lowercase + " > 0 ORDER BY `" + LoadProperties.MySQLtablePrefix + "skills`.`" + lowercase + "` DESC ");
|
||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + lowercase + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + lowercase + " > 0 ORDER BY `" + LoadProperties.MySQLtablePrefix + "skills`.`" + lowercase + "` DESC ");
|
||||
for (int i = 1; i <= 10; i++) { // i<=userslist.size()
|
||||
if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||
if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||
break;
|
||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||
player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
|
||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||
sender.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (args.length >= 0) {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
|
||||
sender.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
|
||||
if (args.length >= 1 && m.isInt(args[0])) {
|
||||
int n = 1; // For the page number
|
||||
int n2 = Integer.valueOf(args[0]);
|
||||
@@ -169,21 +160,21 @@ public class MctopCommand implements CommandExecutor {
|
||||
n = n * (n2 - 1);
|
||||
}
|
||||
// If a page number is specified
|
||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT " + powerlevel + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + powerlevel + " > 0 ORDER BY " + powerlevel + " DESC ");
|
||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + powerlevel + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + powerlevel + " > 0 ORDER BY " + powerlevel + " DESC ");
|
||||
for (int i = n; i <= n + 10; i++) {
|
||||
if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||
if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||
break;
|
||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||
player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
|
||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||
sender.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT " + powerlevel + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + powerlevel + " > 0 ORDER BY " + powerlevel + " DESC ");
|
||||
HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.read("SELECT " + powerlevel + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + powerlevel + " > 0 ORDER BY " + powerlevel + " DESC ");
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||
if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
|
||||
break;
|
||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||
player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
|
||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||
sender.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0));
|
||||
// System.out.println(username.get(1).get(0));
|
||||
// System.out.println("Mining : " + userslist.get(i).get(0) + ", User id : " + userslist.get(i).get(1));
|
||||
}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -17,11 +14,8 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class ACommand implements CommandExecutor {
|
||||
private Logger log;
|
||||
|
||||
public ACommand() {
|
||||
this.log = Logger.getLogger("Minecraft");
|
||||
}
|
||||
public ACommand() {}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -35,7 +29,7 @@ public class ACommand implements CommandExecutor {
|
||||
|
||||
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + "*Console*" + ChatColor.AQUA + "} ";
|
||||
|
||||
log.log(Level.INFO, "[A]<*Console*> " + aMessage);
|
||||
Bukkit.getLogger().info("[A]<*Console*> " + aMessage);
|
||||
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
|
||||
@@ -64,7 +58,7 @@ public class ACommand implements CommandExecutor {
|
||||
|
||||
String name = (LoadProperties.aDisplayNames) ? player.getDisplayName() : player.getName();
|
||||
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + name + ChatColor.AQUA + "} ";
|
||||
log.log(Level.INFO, "[A]<" + name + "> " + aMessage);
|
||||
Bukkit.getLogger().info("[A]<" + name + "> " + aMessage);
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
|
||||
herp.sendMessage(aPrefix + aMessage);
|
||||
@@ -83,10 +77,8 @@ public class ACommand implements CommandExecutor {
|
||||
|
||||
if (PP.getAdminChatMode()) {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOn"));
|
||||
// player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.GREEN + "On");
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOff"));
|
||||
// player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.RED + "Off");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -18,11 +15,7 @@ import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public class PCommand implements CommandExecutor {
|
||||
private Logger log;
|
||||
|
||||
public PCommand() {
|
||||
this.log = Logger.getLogger("Minecraft");
|
||||
}
|
||||
public PCommand() {}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -38,7 +31,7 @@ public class PCommand implements CommandExecutor {
|
||||
|
||||
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + "*Console*" + ChatColor.GREEN + ") ";
|
||||
|
||||
log.log(Level.INFO, "[P](" + args[0] + ")" + "<*Console*> " + pMessage);
|
||||
Bukkit.getLogger().info("[P](" + args[0] + ")" + "<*Console*> " + pMessage);
|
||||
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (Users.getProfile(herp).inParty()) {
|
||||
@@ -61,6 +54,11 @@ public class PCommand implements CommandExecutor {
|
||||
// Not a toggle, a message
|
||||
|
||||
if (args.length >= 1) {
|
||||
if(!PP.inParty()) {
|
||||
player.sendMessage("You're not in a party."); //TODO: Use mcLocale
|
||||
return true;
|
||||
}
|
||||
|
||||
String pMessage = args[0];
|
||||
for (int i = 1; i <= args.length - 1; i++) {
|
||||
pMessage = pMessage + " " + args[i];
|
||||
@@ -68,7 +66,7 @@ public class PCommand implements CommandExecutor {
|
||||
|
||||
String name = (LoadProperties.pDisplayNames) ? player.getDisplayName() : player.getName();
|
||||
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + name + ChatColor.GREEN + ") ";
|
||||
log.log(Level.INFO, "[P](" + PP.getParty() + ")<" + name + "> " + pMessage);
|
||||
Bukkit.getLogger().info("[P](" + PP.getParty() + ")<" + name + "> " + pMessage);
|
||||
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (Users.getProfile(herp).inParty()) {
|
||||
@@ -86,10 +84,8 @@ public class PCommand implements CommandExecutor {
|
||||
PP.togglePartyChat();
|
||||
|
||||
if (PP.getPartyChatMode()) {
|
||||
// player.sendMessage(ChatColor.GREEN + "Party Chat Toggled On");
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.PartyChatOn"));
|
||||
} else {
|
||||
// player.sendMessage(ChatColor.GREEN + "Party Chat Toggled " + ChatColor.RED + "Off");
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.PartyChatOff"));
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,10 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public class PtpCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
@@ -34,10 +36,24 @@ public class PtpCommand implements CommandExecutor {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!Party.getInstance().isParty(PP.getParty()))
|
||||
{
|
||||
player.sendMessage(ChatColor.RED+"You are not in a party!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if(PP.getRecentlyHurt()+(LoadProperties.ptpCommandCooldown*1000) > System.currentTimeMillis())
|
||||
{
|
||||
player.sendMessage(ChatColor.RED+"You've been hurt in the last " + LoadProperties.ptpCommandCooldown + " seconds and cannnot teleport.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length < 1) {
|
||||
player.sendMessage(ChatColor.RED + "Usage is /ptp <playername>");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (plugin.getServer().getPlayer(args[0]) == null) {
|
||||
player.sendMessage("That is not a valid player");
|
||||
}
|
||||
@@ -49,6 +65,8 @@ public class PtpCommand implements CommandExecutor {
|
||||
player.teleport(target);
|
||||
player.sendMessage(ChatColor.GREEN + "You have teleported to " + target.getName());
|
||||
target.sendMessage(ChatColor.GREEN + player.getName() + " has teleported to you.");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + "That player is in a different party than you.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ArcheryCommand implements CommandExecutor {
|
||||
player.sendMessage(mcLocale.getString("m.ArcheryRetrieveChance", new Object[] { percentage }));
|
||||
player.sendMessage(mcLocale.getString("m.ArcheryIgnitionLength", new Object[] { (ignition / 20) }));
|
||||
|
||||
Page.grabGuidePageForSkill(SkillType.AXES, player, args);
|
||||
Page.grabGuidePageForSkill(SkillType.ARCHERY, player, args);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
55
src/main/java/com/gmail/nossr50/config/ConfigLoader.java
Normal file
55
src/main/java/com/gmail/nossr50/config/ConfigLoader.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
public abstract class ConfigLoader {
|
||||
|
||||
protected static File configFile;
|
||||
protected static File dataFolder;
|
||||
protected final mcMMO plugin;
|
||||
protected static FileConfiguration config;
|
||||
|
||||
public ConfigLoader(mcMMO plugin, String fileName){
|
||||
this.plugin = plugin;
|
||||
dataFolder = plugin.getDataFolder();
|
||||
configFile = new File(dataFolder, File.separator + fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load this config file.
|
||||
*/
|
||||
protected abstract void load();
|
||||
|
||||
/**
|
||||
* Save this config file.
|
||||
*/
|
||||
private static void saveConfig() {
|
||||
try {
|
||||
config.save(configFile);
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the defaults to this config file.
|
||||
*/
|
||||
protected void addDefaults() {
|
||||
|
||||
// Load from included config.yml
|
||||
config.options().copyDefaults(true);
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the keys from this config file.
|
||||
*/
|
||||
protected abstract void loadKeys();
|
||||
|
||||
}
|
||||
@@ -1,412 +1,479 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import com.gmail.nossr50.datatypes.HUDType;
|
||||
|
||||
public class LoadProperties {
|
||||
public static Boolean enableOnlyActivateWhenSneaking,
|
||||
enableAbilityMessages, enableAbilities, showDisplayName, showFaces,
|
||||
xplockEnable, xpbar, xpicon, partybar, xprateEnable, spoutEnabled,
|
||||
donateMessage, chimaeraWingEnable, xpGainsMobSpawners,
|
||||
mccEnable, mcmmoEnable, partyEnable, inviteEnable, acceptEnable,
|
||||
inspectEnable, mcstatsEnable, addxpEnable, ptpEnable, mmoeditEnable, mcremoveEnable,
|
||||
mcgodEnable, mcabilityEnable, mctopEnable,
|
||||
addlevelsEnable, mcrefreshEnable, aEnable, pEnable, enableMotd,
|
||||
enableCobbleToMossy, useMySQL, toolsLoseDurabilityFromAbilities,
|
||||
pvpxp, miningrequirespickaxe, excavationRequiresShovel,
|
||||
woodcuttingrequiresaxe, anvilmessages, mayDowngradeEnchants,
|
||||
mayLoseEnchants, fishingDrops, aDisplayNames, pDisplayNames, enableSmoothToMossy,
|
||||
enableDirtToGrass, statsTracking, eventCallback, herbalismHungerBonus,
|
||||
repairArmor, repairTools;
|
||||
public class LoadProperties extends ConfigLoader{
|
||||
|
||||
public static String MySQLtablePrefix, MySQLuserName,
|
||||
MySQLserverName, MySQLdbName, MySQLdbPass, nWood, nStone,
|
||||
nIron, nGold, nDiamond, locale, nString, nLeather;
|
||||
/*
|
||||
* GENERAL SETTINGS
|
||||
*/
|
||||
|
||||
public static int treeFellerThreshold, mjungle, mtameWolf, mtameOcelot,
|
||||
mfishing, xpbar_x, xpbar_y, xpicon_x, xpicon_y,
|
||||
chimaeraId, msandstone, mbase, moak, mbirch, mspruce, mmelon,
|
||||
mcactus, mmushroom, mflower, msugar, mpumpkin, mwheat, mgold,
|
||||
mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack,
|
||||
mglowstone, mcoal, mstone, MySQLport, xpGainMultiplier,
|
||||
superBreakerCooldown, blastMiningCooldown, greenTerraCooldown, gigaDrillBreakerCooldown,
|
||||
treeFellerCooldown, berserkCooldown, serratedStrikeCooldown,
|
||||
skullSplitterCooldown, abilityDurabilityLoss,
|
||||
feathersConsumedByChimaeraWing, bonesConsumedByCOTW,
|
||||
repairdiamondlevel, rWood, rStone, rIron, rGold, rDiamond, rString,
|
||||
rLeather, downgradeRank1, downgradeRank2, downgradeRank3,
|
||||
downgradeRank4, keepEnchantsRank1, keepEnchantsRank2,
|
||||
keepEnchantsRank3, keepEnchantsRank4, mnetherwart,
|
||||
mvines, mlilypad, mendstone, mmossstone,
|
||||
levelCapAcrobatics, levelCapArchery, levelCapAxes, levelCapExcavation,
|
||||
levelCapFishing, levelCapHerbalism, levelCapMining, levelCapRepair,
|
||||
levelCapSwords, levelCapTaming, levelCapUnarmed, levelCapWoodcutting,
|
||||
anvilID, saveInterval, fishingTier1, fishingTier2, fishingTier3, fishingTier4, fishingTier5,
|
||||
repairStoneLevel, repairIronLevel, repairGoldLevel, arcaneRank1, arcaneRank2, arcaneRank3, arcaneRank4,
|
||||
detonatorID;
|
||||
/* General Settings */
|
||||
public static String locale;
|
||||
public static Boolean enableMotd, statsTracking, eventCallback;
|
||||
public static int saveInterval;
|
||||
|
||||
public static double xpbackground_r, xpbackground_g, xpbackground_b,
|
||||
xpborder_r, xpborder_g, xpborder_b, fishing_r, fishing_g,
|
||||
fishing_b, acrobatics_r, acrobatics_g, acrobatics_b, archery_r,
|
||||
archery_g, archery_b, axes_r, axes_g, axes_b, excavation_r,
|
||||
excavation_g, excavation_b, herbalism_r, herbalism_g, herbalism_b,
|
||||
mining_r, mining_g, mining_b, repair_r, repair_g, repair_b,
|
||||
swords_r, swords_g, swords_b, taming_r, taming_g, taming_b,
|
||||
unarmed_r, unarmed_g, unarmed_b, woodcutting_r, woodcutting_g,
|
||||
woodcutting_b, pvpxprewardmodifier, tamingxpmodifier,
|
||||
miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier,
|
||||
fishingxpmodifier, unarmedxpmodifier, herbalismxpmodifier,
|
||||
excavationxpmodifier, archeryxpmodifier, swordsxpmodifier,
|
||||
axesxpmodifier, acrobaticsxpmodifier, animalXP, creeperXP, skeletonXP, spiderXP, ghastXP, slimeXP,
|
||||
zombieXP, pigzombieXP, endermanXP, cavespiderXP, silverfishXP, blazeXP, magmacubeXP, enderdragonXP;
|
||||
/* mySQL */
|
||||
public static Boolean useMySQL;
|
||||
public static String MySQLtablePrefix, MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass;
|
||||
public static int MySQLport;
|
||||
|
||||
public static HUDType defaulthud;
|
||||
protected static File configFile;
|
||||
protected static File dataFolder;
|
||||
protected final mcMMO plugin;
|
||||
protected static FileConfiguration config;
|
||||
/* Commands */
|
||||
public static Boolean xplockEnable, xprateEnable, mccEnable, mcmmoEnable,
|
||||
partyEnable, inviteEnable, acceptEnable, inspectEnable,
|
||||
mcstatsEnable, addxpEnable, ptpEnable, mmoeditEnable,
|
||||
mcremoveEnable, mcgodEnable, mcabilityEnable, mctopEnable,
|
||||
addlevelsEnable, mcrefreshEnable, aEnable, pEnable;
|
||||
public static Boolean aDisplayNames, pDisplayNames;
|
||||
public static int ptpCommandCooldown;
|
||||
public static Boolean donateMessage;
|
||||
|
||||
public LoadProperties(mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
dataFolder = plugin.getDataFolder();
|
||||
configFile = new File(dataFolder, File.separator + "config.yml");
|
||||
config = plugin.getConfig();
|
||||
}
|
||||
/* Tool Level Requirements */
|
||||
public static Boolean perLevelTools;
|
||||
public static int sAxe, sHoe, sShovel, sSword, sPickaxe;
|
||||
public static int iAxe, iHoe, iShovel, iSword, iPickaxe;
|
||||
public static int gAxe, gHoe, gShovel, gSword, gPickaxe;
|
||||
public static int dAxe, dHoe, dShovel, dSword, dPickaxe;
|
||||
|
||||
public void load() {
|
||||
// If not exist, copy from the jar
|
||||
if (!configFile.exists()) {
|
||||
dataFolder.mkdir();
|
||||
plugin.saveDefaultConfig();
|
||||
}
|
||||
addDefaults();
|
||||
loadKeys();
|
||||
}
|
||||
/* Items */
|
||||
public static Boolean chimaeraWingEnable;
|
||||
public static int chimaeraId, feathersConsumedByChimaeraWing;
|
||||
|
||||
private Boolean readBoolean(String root, Boolean def) {
|
||||
Boolean result = config.getBoolean(root, def);
|
||||
return result;
|
||||
}
|
||||
/*
|
||||
* ABILITY SETTINGS
|
||||
*/
|
||||
|
||||
private Double readDouble(String root, Double def) {
|
||||
Double result = config.getDouble(root, def);
|
||||
return result;
|
||||
}
|
||||
/* General Settings */
|
||||
public static Boolean enableOnlyActivateWhenSneaking, enableAbilityMessages, enableAbilities;
|
||||
|
||||
private Integer readInteger(String root, Integer def) {
|
||||
Integer result = config.getInt(root, def);
|
||||
return result;
|
||||
}
|
||||
/* Durability Settings */
|
||||
public static Boolean toolsLoseDurabilityFromAbilities;
|
||||
public static int abilityDurabilityLoss;
|
||||
|
||||
public static String readString(String root, String def) {
|
||||
String result = config.getString(root, def);
|
||||
return result;
|
||||
}
|
||||
/* Cooldowns */
|
||||
public static int superBreakerCooldown, blastMiningCooldown, greenTerraCooldown,
|
||||
gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown,
|
||||
serratedStrikeCooldown, skullSplitterCooldown;
|
||||
|
||||
private static void saveConfig() {
|
||||
try {
|
||||
config.save(configFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
/* Thresholds */
|
||||
public static int treeFellerThreshold;
|
||||
|
||||
private void addDefaults() {
|
||||
// Load from included config.yml
|
||||
config.options().copyDefaults(true);
|
||||
saveConfig();
|
||||
}
|
||||
/*
|
||||
* SKILL SETTINGS
|
||||
*/
|
||||
|
||||
private void loadKeys() {
|
||||
plugin.getLogger().info("Loading mcMMO config.yml File...");
|
||||
/* Tool Requirements */
|
||||
public static Boolean miningrequirespickaxe, excavationRequiresShovel, woodcuttingrequiresaxe;
|
||||
|
||||
// Setup default HUD
|
||||
String temp = readString("Spout.HUD.Default", "STANDARD");
|
||||
for (HUDType x : HUDType.values()) {
|
||||
if (x.toString().equalsIgnoreCase(temp))
|
||||
defaulthud = x;
|
||||
}
|
||||
/* Excavation */
|
||||
public static int mbase;
|
||||
|
||||
enableAbilityMessages = readBoolean("Abilities.Messages", true);
|
||||
enableAbilities = readBoolean("Abilities.Enabled", true);
|
||||
/* Fishing */
|
||||
public static Boolean fishingDrops;
|
||||
public static int fishingTier1, fishingTier2, fishingTier3, fishingTier4, fishingTier5;
|
||||
public static int mfishing;
|
||||
|
||||
donateMessage = readBoolean("Commands.mcmmo.Donate_Message", true);
|
||||
xpGainsMobSpawners = readBoolean("Experience.Gains.Mobspawners.Enabled", false);
|
||||
/* Herbalism */
|
||||
public static Boolean herbalismHungerBonus, wheatRegrowth;
|
||||
public static int mmelon, mcactus, mmushroom, mflower, msugar, mpumpkin, mwheat, mvines, mlilypad, mnetherwart;
|
||||
public static Boolean enableCobbleToMossy, enableSmoothToMossy, enableDirtToGrass;
|
||||
|
||||
bonesConsumedByCOTW = readInteger("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10);
|
||||
/* Mining */
|
||||
public static int msandstone, mgold, mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack, mglowstone, mcoal, mstone, mendstone, mmossstone;
|
||||
public static int detonatorID;
|
||||
|
||||
xpbar = readBoolean("Spout.XP.Bar.Enabled", true);
|
||||
xpicon = readBoolean("Spout.XP.Icon.Enabled", true);
|
||||
xpbar_x = readInteger("Spout.XP.Bar.X_POS", 95);
|
||||
xpbar_y = readInteger("Spout.XP.Bar.Y_POS", 6);
|
||||
xpicon_x = readInteger("Spout.XP.Icon.X_POS", 78);
|
||||
xpicon_y = readInteger("Spout.XP.Icon.Y_POS", 2);
|
||||
/* Repair */
|
||||
public static Boolean repairArmor, repairTools;
|
||||
public static Boolean anvilmessages;
|
||||
public static int rWood, rStone, rIron, rGold, rDiamond, rString, rLeather;
|
||||
public static int anvilID;
|
||||
public static int repairStoneLevel, repairIronLevel, repairGoldLevel, repairdiamondlevel;
|
||||
|
||||
showFaces = readBoolean("Spout.Party.HUD.Show_Faces", true);
|
||||
showDisplayName = readBoolean("Spout.Party.HUD.Show_Display_Name", false);
|
||||
partybar = readBoolean("Spout.Party.HUD.Enabled", true);
|
||||
/* Taming */
|
||||
public static int mtameWolf, mtameOcelot;
|
||||
public static int bonesConsumedByCOTW, fishConsumedByCOTW;
|
||||
|
||||
acrobatics_r = readDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3);
|
||||
acrobatics_g = readDouble("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3);
|
||||
acrobatics_b = readDouble("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75);
|
||||
archery_r = readDouble("Spout.HUD.Retro.Colors.Archery.RED", 0.3);
|
||||
archery_g = readDouble("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3);
|
||||
archery_b = readDouble("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75);
|
||||
axes_r = readDouble("Spout.HUD.Retro.Colors.Axes.RED", 0.3);
|
||||
axes_g = readDouble("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3);
|
||||
axes_b = readDouble("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75);
|
||||
excavation_r = readDouble("Spout.HUD.Retro.Colors.Excavation.RED", 0.3);
|
||||
excavation_g = readDouble("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3);
|
||||
excavation_b = readDouble("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75);
|
||||
herbalism_r = readDouble("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3);
|
||||
herbalism_g = readDouble("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3);
|
||||
herbalism_b = readDouble("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75);
|
||||
mining_r = readDouble("Spout.HUD.Retro.Colors.Mining.RED", 0.3);
|
||||
mining_g = readDouble("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3);
|
||||
mining_b = readDouble("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75);
|
||||
repair_r = readDouble("Spout.HUD.Retro.Colors.Repair.RED", 0.3);
|
||||
repair_g = readDouble("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3);
|
||||
repair_b = readDouble("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75);
|
||||
swords_r = readDouble("Spout.HUD.Retro.Colors.Swords.RED", 0.3);
|
||||
swords_g = readDouble("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3);
|
||||
swords_b = readDouble("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75);
|
||||
taming_r = readDouble("Spout.HUD.Retro.Colors.Taming.RED", 0.3);
|
||||
taming_g = readDouble("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3);
|
||||
taming_b = readDouble("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75);
|
||||
unarmed_r = readDouble("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3);
|
||||
unarmed_g = readDouble("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3);
|
||||
unarmed_b = readDouble("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75);
|
||||
woodcutting_r = readDouble("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3);
|
||||
woodcutting_g = readDouble("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3);
|
||||
woodcutting_b = readDouble("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75);
|
||||
fishing_r = readDouble("Spout.HUD.Retro.Colors.Fishing.RED", 0.3);
|
||||
fishing_g = readDouble("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3);
|
||||
fishing_b = readDouble("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75);
|
||||
/* Woodcutting */
|
||||
public static int moak, mbirch, mspruce, mjungle;
|
||||
|
||||
xpborder_r = readDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0);
|
||||
xpborder_g = readDouble("Spout.HUD.Retro.Colors.Border.GREEN", 0.0);
|
||||
xpborder_b = readDouble("Spout.HUD.Retro.Colors.Border.BLUE", 0.0);
|
||||
xpbackground_r = readDouble("Spout.HUD.Retro.Colors.Background.RED", 0.75);
|
||||
xpbackground_g = readDouble("Spout.HUD.Retro.Colors.Background.GREEN", 0.75);
|
||||
xpbackground_b = readDouble("Spout.HUD.Retro.Colors.Background.BLUE", 0.75);
|
||||
/* Arcane Forging */
|
||||
public static Boolean mayDowngradeEnchants, mayLoseEnchants;
|
||||
public static int arcaneRank1, arcaneRank2, arcaneRank3, arcaneRank4;
|
||||
public static int downgradeRank1, downgradeRank2, downgradeRank3, downgradeRank4;
|
||||
public static int keepEnchantsRank1, keepEnchantsRank2, keepEnchantsRank3, keepEnchantsRank4;
|
||||
|
||||
mbase = readInteger("Experience.Excavation.Base", 40);
|
||||
/* Level Caps */
|
||||
public static int levelCapAcrobatics, levelCapArchery, levelCapAxes, levelCapExcavation,
|
||||
levelCapFishing, levelCapHerbalism, levelCapMining, levelCapRepair,
|
||||
levelCapSwords, levelCapTaming, levelCapUnarmed, levelCapWoodcutting;
|
||||
|
||||
msugar = readInteger("Experience.Herbalism.Sugar_Cane", 30);
|
||||
mwheat = readInteger("Experience.Herbalism.Wheat", 50);
|
||||
mcactus = readInteger("Experience.Herbalism.Cactus", 30);
|
||||
mpumpkin = readInteger("Experience.Herbalism.Pumpkin", 20);
|
||||
mflower = readInteger("Experience.Herbalism.Flowers", 100);
|
||||
mmushroom = readInteger("Experience.Herbalism.Mushrooms", 150);
|
||||
mmelon = readInteger("Experience.Herbalism.Melon", 20);
|
||||
mnetherwart = readInteger("Experience.Herbalism.Nether_Wart", 50);
|
||||
mlilypad = readInteger("Experience.Herbalism.Lily_Pads", 100);
|
||||
mvines = readInteger("Experience.Herbalism.Vines", 10);
|
||||
herbalismHungerBonus = readBoolean("Skills.Herbalism.Hunger_Bonus", true);
|
||||
/*
|
||||
* XP SETTINGS
|
||||
*/
|
||||
|
||||
moak = readInteger("Experience.Woodcutting.Oak", 70);
|
||||
mbirch = readInteger("Experience.Woodcutting.Birch", 90);
|
||||
mspruce = readInteger("Experience.Woodcutting.Spruce", 80);
|
||||
mjungle = readInteger("Experience.Woodcutting.Jungle", 100);
|
||||
/* General Settings */
|
||||
public static Boolean xpGainsMobSpawners, pvpxp;
|
||||
public static int xpGainMultiplier;
|
||||
|
||||
mgold = readInteger("Experience.Mining.Gold", 250);
|
||||
mdiamond = readInteger("Experience.Mining.Diamond", 750);
|
||||
miron = readInteger("Experience.Mining.Iron", 250);
|
||||
mredstone = readInteger("Experience.Mining.Redstone", 150);
|
||||
mlapis = readInteger("Experience.Mining.Lapis", 400);
|
||||
mobsidian = readInteger("Experience.Mining.Obsidian", 150);
|
||||
mnetherrack = readInteger("Experience.Mining.Netherrack", 30);
|
||||
mglowstone = readInteger("Experience.Mining.Glowstone", 30);
|
||||
mcoal = readInteger("Experience.Mining.Coal", 100);
|
||||
mstone = readInteger("Experience.Mining.Stone", 30);
|
||||
msandstone = readInteger("Experience.Mining.Sandstone", 30);
|
||||
mendstone = readInteger("Experience.Mining.End_Stone", 150);
|
||||
mmossstone = readInteger("Experience.Mining.Moss_Stone", 30);
|
||||
|
||||
mtameWolf = readInteger("Experience.Taming.Animal_Taming.Wolf", 250);
|
||||
mtameOcelot = readInteger("Experience.Taming.Animal_Taming.Wolf", 500);
|
||||
/* Combat XP Multipliers */
|
||||
public static double pvpxprewardmodifier;
|
||||
public static double animalXP, creeperXP, skeletonXP, spiderXP, ghastXP, slimeXP,
|
||||
zombieXP, pigzombieXP, endermanXP, cavespiderXP, silverfishXP,
|
||||
blazeXP, magmacubeXP, enderdragonXP;
|
||||
|
||||
mfishing = readInteger("Experience.Fishing.Base", 800);
|
||||
/* XP Formula Multiplier */
|
||||
public static double tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier,
|
||||
fishingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier,
|
||||
archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
|
||||
|
||||
enableOnlyActivateWhenSneaking = readBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false);
|
||||
/*
|
||||
* SPOUT SETTINGS
|
||||
*/
|
||||
|
||||
greenTerraCooldown = readInteger("Abilities.Cooldowns.Green_Terra", 240);
|
||||
superBreakerCooldown = readInteger("Abilities.Cooldowns.Super_Breaker", 240);
|
||||
gigaDrillBreakerCooldown = readInteger("Abilities.Cooldowns.Giga_Drill_Breaker", 240);
|
||||
treeFellerThreshold = readInteger("Abilities.Limits.Tree_Feller_Threshold", 500);
|
||||
treeFellerCooldown = readInteger("Abilities.Cooldowns.Tree_Feller", 240);
|
||||
berserkCooldown = readInteger("Abilities.Cooldowns.Berserk", 240);
|
||||
serratedStrikeCooldown = readInteger("Abilities.Cooldowns.Serrated_Strikes", 240);
|
||||
skullSplitterCooldown = readInteger("Abilities.Cooldowns.Skull_Splitter", 240);
|
||||
blastMiningCooldown = readInteger("Abilities.Cooldowns.Blast_Mining", 60);
|
||||
public static Boolean spoutEnabled;
|
||||
|
||||
MySQLserverName = readString("MySQL.Server.Address", "localhost");
|
||||
if (readString("MySQL.Database.User.Password", null) != null)
|
||||
MySQLdbPass = readString("MySQL.Database.User.Password", null);
|
||||
else
|
||||
MySQLdbPass = "";
|
||||
/* Spout Party HUD */
|
||||
public static Boolean showDisplayName, showFaces, partybar;
|
||||
|
||||
MySQLdbName = readString("MySQL.Database.Name", "DatabaseName");
|
||||
MySQLuserName = readString("MySQL.Database.User.Name", "UserName");
|
||||
MySQLtablePrefix = readString("MySQL.Database.TablePrefix", "mcmmo_");
|
||||
MySQLport = readInteger("MySQL.Server.Port", 3306);
|
||||
useMySQL = readBoolean("MySQL.Enabled", false);
|
||||
/* Spout XP Bar */
|
||||
public static Boolean xpbar, xpicon;
|
||||
public static int xpbar_x, xpbar_y, xpicon_x, xpicon_y;
|
||||
|
||||
locale = readString("General.Locale", "en_us");
|
||||
enableMotd = readBoolean("General.MOTD.Enabled", true);
|
||||
saveInterval = readInteger("General.Save_Interval", 10);
|
||||
statsTracking = readBoolean("General.Stats_Tracking", true);
|
||||
eventCallback = readBoolean("General.Event_Callback", true);
|
||||
/* Spout HUD Colors */
|
||||
public static double xpbackground_r, xpbackground_g, xpbackground_b;
|
||||
public static double xpborder_r, xpborder_g, xpborder_b;
|
||||
public static double fishing_r, fishing_g, fishing_b;
|
||||
public static double acrobatics_r, acrobatics_g, acrobatics_b;
|
||||
public static double archery_r, archery_g, archery_b;
|
||||
public static double axes_r, axes_g, axes_b;
|
||||
public static double excavation_r, excavation_g, excavation_b;
|
||||
public static double herbalism_r, herbalism_g, herbalism_b;
|
||||
public static double mining_r, mining_g, mining_b;
|
||||
public static double repair_r, repair_g, repair_b;
|
||||
public static double swords_r, swords_g, swords_b;
|
||||
public static double taming_r, taming_g, taming_b;
|
||||
public static double unarmed_r, unarmed_g, unarmed_b;
|
||||
public static double woodcutting_r, woodcutting_g, woodcutting_b;
|
||||
|
||||
enableCobbleToMossy = readBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true);
|
||||
enableSmoothToMossy = readBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true);
|
||||
enableDirtToGrass = readBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true);
|
||||
/*
|
||||
* CONFIG LOADING
|
||||
*/
|
||||
|
||||
xpGainMultiplier = readInteger("Experience.Gains.Multiplier.Global", 1);
|
||||
toolsLoseDurabilityFromAbilities = readBoolean("Abilities.Tools.Durability_Loss_Enabled", true);
|
||||
abilityDurabilityLoss = readInteger("Abilities.Tools.Durability_Loss", 2);
|
||||
public static HUDType defaulthud;
|
||||
|
||||
feathersConsumedByChimaeraWing = readInteger("Items.Chimaera_Wing.Feather_Cost", 10);
|
||||
chimaeraId = readInteger("Items.Chimaera_Wing.Item_ID", 288);
|
||||
chimaeraWingEnable = readBoolean("Items.Chimaera_Wing.Enabled", true);
|
||||
public LoadProperties(mcMMO plugin) {
|
||||
super(plugin, "config.yml");
|
||||
config = plugin.getConfig();
|
||||
}
|
||||
|
||||
pvpxp = readBoolean("Experience.PVP.Rewards", true);
|
||||
pvpxprewardmodifier = readDouble("Experience.Gains.Multiplier.PVP", 1.0);
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
miningrequirespickaxe = readBoolean("Skills.Mining.Requires_Pickaxe", true);
|
||||
excavationRequiresShovel = readBoolean("Skills.Excavation.Requires_Shovel", true);
|
||||
woodcuttingrequiresaxe = readBoolean("Skills.Woodcutting.Requires_Axe", true);
|
||||
repairArmor = readBoolean("Skills.Repair.Can_Repair_Armor", true);
|
||||
repairTools = readBoolean("Skills.Repair.Can_Repair_Tools", true);
|
||||
repairdiamondlevel = readInteger("Skills.Repair.Diamond.Level_Required", 50);
|
||||
repairIronLevel = readInteger("Skills.Repair.Iron.Level_Required", 0);
|
||||
repairGoldLevel = readInteger("Skills.Repair.Gold.Level_Required", 0);
|
||||
repairStoneLevel = readInteger("Skills.Repair.Stone.Level_Required", 0);
|
||||
// If it doesn't exist, copy it from the .jar
|
||||
if (!configFile.exists()) {
|
||||
dataFolder.mkdir();
|
||||
plugin.saveDefaultConfig();
|
||||
}
|
||||
|
||||
tamingxpmodifier = readDouble("Experience.Formula.Multiplier.Taming", 1.0);
|
||||
miningxpmodifier = readDouble("Experience.Formula.Multiplier.Mining", 1.0);
|
||||
repairxpmodifier = readDouble("Experience.Formula.Multiplier.Repair", 1.0);
|
||||
woodcuttingxpmodifier = readDouble("Experience.Formula.Multiplier.Woodcutting", 1.0);
|
||||
unarmedxpmodifier = readDouble("Experience.Formula.Multiplier.Unarmed", 1.0);
|
||||
herbalismxpmodifier = readDouble("Experience.Formula.Multiplier.Herbalism", 1.0);
|
||||
excavationxpmodifier = readDouble("Experience.Formula.Multiplier.Excavation", 1.0);
|
||||
archeryxpmodifier = readDouble("Experience.Formula.Multiplier.Archery", 1.0);
|
||||
swordsxpmodifier = readDouble("Experience.Formula.Multiplier.Swords", 1.0);
|
||||
axesxpmodifier = readDouble("Experience.Formula.Multiplier.Axes", 1.0);
|
||||
acrobaticsxpmodifier = readDouble("Experience.Formula.Multiplier.Acrobatics", 1.0);
|
||||
fishingxpmodifier = readDouble("Experience.Forumla.Multiplier.Fishing", 1.0);
|
||||
addDefaults();
|
||||
loadKeys();
|
||||
}
|
||||
|
||||
anvilmessages = readBoolean("Skills.Repair.Anvil_Messages", true);
|
||||
anvilID = readInteger("Skills.Repair.Anvil_ID", 42);
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
plugin.getLogger().info("Loading mcMMO config.yml File...");
|
||||
|
||||
rGold = readInteger("Skills.Repair.Gold.ID", 266);
|
||||
nGold = readString("Skills.Repair.Gold.Name", "Gold Bars");
|
||||
rStone = readInteger("Skills.Repair.Stone.ID", 4);
|
||||
nStone = readString("Skills.Repair.Stone.Name", "Cobblestone");
|
||||
rWood = readInteger("Skills.Repair.Wood.ID", 5);
|
||||
nWood = readString("Skills.Repair.Wood.Name", "Wood Planks");
|
||||
rDiamond = readInteger("Skills.Repair.Diamond.ID", 264);
|
||||
nDiamond = readString("Skills.Repair.Diamond.Name", "Diamond");
|
||||
rIron = readInteger("Skills.Repair.Iron.ID", 265);
|
||||
nIron = readString("Skills.Repair.Iron.Name", "Iron Bars");
|
||||
rString = readInteger("Skills.Repair.String.ID", 287);
|
||||
nString = readString("Skills.Repair.String.Name", "String");
|
||||
rLeather = readInteger("Skills.Repair.Leather.ID", 334);
|
||||
nLeather = readString("Skills.Repair.Leather.Name", "Leather");
|
||||
|
||||
levelCapAcrobatics = readInteger("Skills.Acrobatics.Level_Cap", 0);
|
||||
levelCapArchery = readInteger("Skills.Archery.Level_Cap", 0);
|
||||
levelCapAxes = readInteger("Skills.Axes.Level_Cap", 0);
|
||||
levelCapExcavation = readInteger("Skills.Excavation.Level_Cap", 0);
|
||||
levelCapFishing = readInteger("Skills.Fishing.Level_Cap", 0);
|
||||
levelCapHerbalism = readInteger("Skills.Herbalism.Level_Cap", 0);
|
||||
levelCapMining = readInteger("Skills.Mining.Level_Cap", 0);
|
||||
levelCapRepair = readInteger("Skills.Repair.Level_Cap", 0);
|
||||
levelCapSwords = readInteger("Skills.Swords.Level_Cap", 0);
|
||||
levelCapTaming = readInteger("Skills.Taming.Level_Cap", 0);
|
||||
levelCapUnarmed = readInteger("Skills.Unarmed.Level_Cap", 0);
|
||||
levelCapWoodcutting = readInteger("Skills.Woodcutting.Level_Cap", 0);
|
||||
// Setup default HUD
|
||||
String temp = config.getString("Spout.HUD.Default", "STANDARD");
|
||||
for (HUDType x : HUDType.values()) {
|
||||
if (x.toString().equalsIgnoreCase(temp)) {
|
||||
defaulthud = x;
|
||||
}
|
||||
}
|
||||
|
||||
mayDowngradeEnchants = readBoolean("Arcane_Forging.Downgrades.Enabled", true);
|
||||
downgradeRank1 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_1", 75);
|
||||
downgradeRank2 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_2", 50);
|
||||
downgradeRank3 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_3", 25);
|
||||
downgradeRank4 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_4", 15);
|
||||
mayLoseEnchants = readBoolean("Arcane_Forging.May_Lose_Enchants", true);
|
||||
keepEnchantsRank1 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10);
|
||||
keepEnchantsRank2 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20);
|
||||
keepEnchantsRank3 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30);
|
||||
keepEnchantsRank4 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40);
|
||||
arcaneRank1 = readInteger("Arcane_Forging.Rank_Levels.Rank_1", 100);
|
||||
arcaneRank2 = readInteger("Arcane_Forging.Rank_Levels.Rank_2", 250);
|
||||
arcaneRank3 = readInteger("Arcane_Forging.Rank_Levels.Rank_3", 500);
|
||||
arcaneRank4 = readInteger("Arcane_Forging.Rank_Levels.Rank_4", 750);
|
||||
enableAbilityMessages = config.getBoolean("Abilities.Messages", true);
|
||||
enableAbilities = config.getBoolean("Abilities.Enabled", true);
|
||||
|
||||
fishingDrops = readBoolean("Fishing.Drops_Enabled", true);
|
||||
fishingTier1 = readInteger("Fishing.Tier_Levels.Tier1", 0);
|
||||
fishingTier2 = readInteger("Fishing.Tier_Levels.Tier2", 200);
|
||||
fishingTier3 = readInteger("Fishing.Tier_Levels.Tier3", 400);
|
||||
fishingTier4 = readInteger("Fishing.Tier_Levels.Tier4", 600);
|
||||
fishingTier5 = readInteger("Fishing.Tier_Levels.Tier5", 800);
|
||||
donateMessage = config.getBoolean("Commands.mcmmo.Donate_Message", true);
|
||||
xpGainsMobSpawners = config.getBoolean("Experience.Gains.Mobspawners.Enabled", false);
|
||||
|
||||
xplockEnable = readBoolean("Commands.xplock.Enabled", true);
|
||||
xprateEnable = readBoolean("Commands.xprate.Enabled", true);
|
||||
mctopEnable = readBoolean("Commands.mctop.Enabled", true);
|
||||
addxpEnable = readBoolean("Commands.addxp.Enabled", true);
|
||||
addlevelsEnable = readBoolean("Commands.addlevels.Enabled", true);
|
||||
mcabilityEnable = readBoolean("Commands.mcability.Enabled", true);
|
||||
mcrefreshEnable = readBoolean("Commands.mcrefresh.Enabled", true);
|
||||
mcmmoEnable = readBoolean("Commands.mcmmo.Enabled", true);
|
||||
mccEnable = readBoolean("Commands.mcc.Enabled", true);
|
||||
mcgodEnable = readBoolean("Commands.mcgod.Enabled", true);
|
||||
mcstatsEnable = readBoolean("Commands.mcstats.Enabled", true);
|
||||
mmoeditEnable = readBoolean("Commands.mmoedit.Enabled", true);
|
||||
mcremoveEnable = readBoolean("Commands.mcremove.Enable", true);
|
||||
ptpEnable = readBoolean("Commands.ptp.Enabled", true);
|
||||
partyEnable = readBoolean("Commands.party.Enabled", true);
|
||||
inspectEnable = readBoolean("Commands.inspect.Enabled", true);
|
||||
inviteEnable = readBoolean("Commands.invite.Enabled", true);
|
||||
acceptEnable = readBoolean("Commands.accept.Enabled", true);
|
||||
aEnable = readBoolean("Commands.a.Enabled", true);
|
||||
pEnable = readBoolean("Commands.p.Enabled", true);
|
||||
|
||||
aDisplayNames = readBoolean("Commands.a.Display_Names", true);
|
||||
pDisplayNames = readBoolean("Commands.p.Display_Names", true);
|
||||
|
||||
animalXP = readDouble("Experience.Combat.Multiplier.Animals", 1.0);
|
||||
creeperXP = readDouble("Experience.Combat.Multiplier.Creeper", 4.0);
|
||||
skeletonXP = readDouble("Experience.Combat.Multiplier.Skeleton", 2.0);
|
||||
spiderXP = readDouble("Experience.Combat.Multiplier.Spider", 3.0);
|
||||
ghastXP = readDouble("Experience.Combat.Multiplier.Ghast", 3.0);
|
||||
slimeXP = readDouble("Experience.Combat.Multiplier.Slime", 2.0);
|
||||
zombieXP = readDouble("Experience.Combat.Multiplier.Zombie", 2.0);
|
||||
pigzombieXP = readDouble("Experience.Combat.Multiplier.Pig_Zombie", 3.0);
|
||||
endermanXP = readDouble("Experience.Combat.Multiplier.Enderman", 2.0);
|
||||
cavespiderXP = readDouble("Experience.Combat.Multiplier.Cave_Spider", 3.0);
|
||||
silverfishXP = readDouble("Experience.Combat.Multiplier.Silverfish", 3.0);
|
||||
blazeXP = readDouble("Experience.Combat.Multiplier.Blaze", 3.0);
|
||||
magmacubeXP = readDouble("Experience.Combat.Multiplier.Magma_Cube", 2.0);
|
||||
enderdragonXP = readDouble("Experience.Combat.Multiplier.Ender_Dragon", 8.0);
|
||||
|
||||
detonatorID = readInteger("Skills.Mining.Detonator_ID", 259);
|
||||
}
|
||||
bonesConsumedByCOTW = config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10);
|
||||
fishConsumedByCOTW = config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10);
|
||||
|
||||
xpbar = config.getBoolean("Spout.XP.Bar.Enabled", true);
|
||||
xpicon = config.getBoolean("Spout.XP.Icon.Enabled", true);
|
||||
xpbar_x = config.getInt("Spout.XP.Bar.X_POS", 95);
|
||||
xpbar_y = config.getInt("Spout.XP.Bar.Y_POS", 6);
|
||||
xpicon_x = config.getInt("Spout.XP.Icon.X_POS", 78);
|
||||
xpicon_y = config.getInt("Spout.XP.Icon.Y_POS", 2);
|
||||
|
||||
showFaces = config.getBoolean("Spout.Party.HUD.Show_Faces", true);
|
||||
showDisplayName = config.getBoolean("Spout.Party.HUD.Show_Display_Name", false);
|
||||
partybar = config.getBoolean("Spout.Party.HUD.Enabled", true);
|
||||
|
||||
acrobatics_r = config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3);
|
||||
acrobatics_g = config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3);
|
||||
acrobatics_b = config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75);
|
||||
archery_r = config.getDouble("Spout.HUD.Retro.Colors.Archery.RED", 0.3);
|
||||
archery_g = config.getDouble("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3);
|
||||
archery_b = config.getDouble("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75);
|
||||
axes_r = config.getDouble("Spout.HUD.Retro.Colors.Axes.RED", 0.3);
|
||||
axes_g = config.getDouble("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3);
|
||||
axes_b = config.getDouble("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75);
|
||||
excavation_r = config.getDouble("Spout.HUD.Retro.Colors.Excavation.RED", 0.3);
|
||||
excavation_g = config.getDouble("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3);
|
||||
excavation_b = config.getDouble("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75);
|
||||
herbalism_r = config.getDouble("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3);
|
||||
herbalism_g = config.getDouble("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3);
|
||||
herbalism_b = config.getDouble("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75);
|
||||
mining_r = config.getDouble("Spout.HUD.Retro.Colors.Mining.RED", 0.3);
|
||||
mining_g = config.getDouble("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3);
|
||||
mining_b = config.getDouble("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75);
|
||||
repair_r = config.getDouble("Spout.HUD.Retro.Colors.Repair.RED", 0.3);
|
||||
repair_g = config.getDouble("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3);
|
||||
repair_b = config.getDouble("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75);
|
||||
swords_r = config.getDouble("Spout.HUD.Retro.Colors.Swords.RED", 0.3);
|
||||
swords_g = config.getDouble("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3);
|
||||
swords_b = config.getDouble("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75);
|
||||
taming_r = config.getDouble("Spout.HUD.Retro.Colors.Taming.RED", 0.3);
|
||||
taming_g = config.getDouble("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3);
|
||||
taming_b = config.getDouble("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75);
|
||||
unarmed_r = config.getDouble("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3);
|
||||
unarmed_g = config.getDouble("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3);
|
||||
unarmed_b = config.getDouble("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75);
|
||||
woodcutting_r = config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3);
|
||||
woodcutting_g = config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3);
|
||||
woodcutting_b = config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75);
|
||||
fishing_r = config.getDouble("Spout.HUD.Retro.Colors.Fishing.RED", 0.3);
|
||||
fishing_g = config.getDouble("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3);
|
||||
fishing_b = config.getDouble("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75);
|
||||
|
||||
xpborder_r = config.getDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0);
|
||||
xpborder_g = config.getDouble("Spout.HUD.Retro.Colors.Border.GREEN", 0.0);
|
||||
xpborder_b = config.getDouble("Spout.HUD.Retro.Colors.Border.BLUE", 0.0);
|
||||
xpbackground_r = config.getDouble("Spout.HUD.Retro.Colors.Background.RED", 0.75);
|
||||
xpbackground_g = config.getDouble("Spout.HUD.Retro.Colors.Background.GREEN", 0.75);
|
||||
xpbackground_b = config.getDouble("Spout.HUD.Retro.Colors.Background.BLUE", 0.75);
|
||||
|
||||
mbase = config.getInt("Experience.Excavation.Base", 40);
|
||||
|
||||
msugar = config.getInt("Experience.Herbalism.Sugar_Cane", 30);
|
||||
mwheat = config.getInt("Experience.Herbalism.Wheat", 50);
|
||||
mcactus = config.getInt("Experience.Herbalism.Cactus", 30);
|
||||
mpumpkin = config.getInt("Experience.Herbalism.Pumpkin", 20);
|
||||
mflower = config.getInt("Experience.Herbalism.Flowers", 100);
|
||||
mmushroom = config.getInt("Experience.Herbalism.Mushrooms", 150);
|
||||
mmelon = config.getInt("Experience.Herbalism.Melon", 20);
|
||||
mnetherwart = config.getInt("Experience.Herbalism.Nether_Wart", 50);
|
||||
mlilypad = config.getInt("Experience.Herbalism.Lily_Pads", 100);
|
||||
mvines = config.getInt("Experience.Herbalism.Vines", 10);
|
||||
herbalismHungerBonus = config.getBoolean("Skills.Herbalism.Hunger_Bonus", true);
|
||||
wheatRegrowth = config.getBoolean("Skills.Herbalism.Instant_Wheat_Regrowth", true);
|
||||
|
||||
moak = config.getInt("Experience.Woodcutting.Oak", 70);
|
||||
mbirch = config.getInt("Experience.Woodcutting.Birch", 90);
|
||||
mspruce = config.getInt("Experience.Woodcutting.Spruce", 80);
|
||||
mjungle = config.getInt("Experience.Woodcutting.Jungle", 100);
|
||||
|
||||
mgold = config.getInt("Experience.Mining.Gold", 250);
|
||||
mdiamond = config.getInt("Experience.Mining.Diamond", 750);
|
||||
miron = config.getInt("Experience.Mining.Iron", 250);
|
||||
mredstone = config.getInt("Experience.Mining.Redstone", 150);
|
||||
mlapis = config.getInt("Experience.Mining.Lapis", 400);
|
||||
mobsidian = config.getInt("Experience.Mining.Obsidian", 150);
|
||||
mnetherrack = config.getInt("Experience.Mining.Netherrack", 30);
|
||||
mglowstone = config.getInt("Experience.Mining.Glowstone", 30);
|
||||
mcoal = config.getInt("Experience.Mining.Coal", 100);
|
||||
mstone = config.getInt("Experience.Mining.Stone", 30);
|
||||
msandstone = config.getInt("Experience.Mining.Sandstone", 30);
|
||||
mendstone = config.getInt("Experience.Mining.End_Stone", 150);
|
||||
mmossstone = config.getInt("Experience.Mining.Moss_Stone", 30);
|
||||
|
||||
mtameWolf = config.getInt("Experience.Taming.Animal_Taming.Wolf", 250);
|
||||
mtameOcelot = config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500);
|
||||
|
||||
mfishing = config.getInt("Experience.Fishing.Base", 800);
|
||||
|
||||
enableOnlyActivateWhenSneaking = config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false);
|
||||
|
||||
greenTerraCooldown = config.getInt("Abilities.Cooldowns.Green_Terra", 240);
|
||||
superBreakerCooldown = config.getInt("Abilities.Cooldowns.Super_Breaker", 240);
|
||||
gigaDrillBreakerCooldown = config.getInt("Abilities.Cooldowns.Giga_Drill_Breaker", 240);
|
||||
treeFellerThreshold = config.getInt("Abilities.Limits.Tree_Feller_Threshold", 500);
|
||||
treeFellerCooldown = config.getInt("Abilities.Cooldowns.Tree_Feller", 240);
|
||||
berserkCooldown = config.getInt("Abilities.Cooldowns.Berserk", 240);
|
||||
serratedStrikeCooldown = config.getInt("Abilities.Cooldowns.Serrated_Strikes", 240);
|
||||
skullSplitterCooldown = config.getInt("Abilities.Cooldowns.Skull_Splitter", 240);
|
||||
blastMiningCooldown = config.getInt("Abilities.Cooldowns.Blast_Mining", 60);
|
||||
|
||||
MySQLserverName = config.getString("MySQL.Server.Address", "localhost");
|
||||
|
||||
if (config.getString("MySQL.Database.User_Password", null) != null) {
|
||||
MySQLdbPass = config.getString("MySQL.Database.User_Password", null);
|
||||
}
|
||||
else {
|
||||
MySQLdbPass = "";
|
||||
}
|
||||
|
||||
MySQLdbName = config.getString("MySQL.Database.Name", "DatabaseName");
|
||||
MySQLuserName = config.getString("MySQL.Database.User_Name", "UserName");
|
||||
MySQLtablePrefix = config.getString("MySQL.Database.TablePrefix", "mcmmo_");
|
||||
MySQLport = config.getInt("MySQL.Server.Port", 3306);
|
||||
useMySQL = config.getBoolean("MySQL.Enabled", false);
|
||||
|
||||
locale = config.getString("General.Locale", "en_us");
|
||||
enableMotd = config.getBoolean("General.MOTD_Enabled", true);
|
||||
saveInterval = config.getInt("General.Save_Interval", 10);
|
||||
statsTracking = config.getBoolean("General.Stats_Tracking", true);
|
||||
eventCallback = config.getBoolean("General.Event_Callback", true);
|
||||
perLevelTools = config.getBoolean("General.Per_Level_Tools", false);
|
||||
|
||||
enableCobbleToMossy = config.getBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true);
|
||||
enableSmoothToMossy = config.getBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true);
|
||||
enableDirtToGrass = config.getBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true);
|
||||
|
||||
xpGainMultiplier = config.getInt("Experience.Gains.Multiplier.Global", 1);
|
||||
toolsLoseDurabilityFromAbilities = config.getBoolean("Abilities.Tools.Durability_Loss_Enabled", true);
|
||||
abilityDurabilityLoss = config.getInt("Abilities.Tools.Durability_Loss", 2);
|
||||
|
||||
feathersConsumedByChimaeraWing = config.getInt("Items.Chimaera_Wing.Feather_Cost", 10);
|
||||
chimaeraId = config.getInt("Items.Chimaera_Wing.Item_ID", 288);
|
||||
chimaeraWingEnable = config.getBoolean("Items.Chimaera_Wing.Enabled", true);
|
||||
dAxe = config.getInt("Items.Diamond.Axe", 750);
|
||||
dHoe = config.getInt("Items.Diamond.Hoe", 750);
|
||||
dShovel = config.getInt("Items.Diamond.Shovel", 750);
|
||||
dSword = config.getInt("Items.Diamond.Sword", 750);
|
||||
dPickaxe = config.getInt("Items.Diamond.Pickaxe", 750);
|
||||
gAxe = config.getInt("Items.Gold.Axe", 500);
|
||||
gHoe = config.getInt("Items.Gold.Hoe", 500);
|
||||
gShovel = config.getInt("Items.Gold.Shovel", 500);
|
||||
gSword = config.getInt("Items.Gold.Sword", 500);
|
||||
gPickaxe = config.getInt("Items.Gold.Pickaxe", 500);
|
||||
iAxe = config.getInt("Items.Iron.Axe", 250);
|
||||
iHoe = config.getInt("Items.Iron.Hoe", 250);
|
||||
iShovel = config.getInt("Items.Iron.Shovel", 250);
|
||||
iSword = config.getInt("Items.Iron.Sword", 250);
|
||||
iPickaxe = config.getInt("Items.Iron.Pickaxe", 250);
|
||||
sAxe = config.getInt("Items.Stone.Axe", 0);
|
||||
sHoe = config.getInt("Items.Stone.Hoe", 0);
|
||||
sShovel = config.getInt("Items.Stone.Shovel", 0);
|
||||
sSword = config.getInt("Items.Stone.Sword", 0);
|
||||
sPickaxe = config.getInt("Items.Stone.Pickaxe", 0);
|
||||
|
||||
pvpxp = config.getBoolean("Experience.PVP.Rewards", true);
|
||||
pvpxprewardmodifier = config.getDouble("Experience.Gains.Multiplier.PVP", 1.0);
|
||||
|
||||
miningrequirespickaxe = config.getBoolean("Skills.Mining.Requires_Pickaxe", true);
|
||||
excavationRequiresShovel = config.getBoolean("Skills.Excavation.Requires_Shovel", true);
|
||||
woodcuttingrequiresaxe = config.getBoolean("Skills.Woodcutting.Requires_Axe", true);
|
||||
repairArmor = config.getBoolean("Skills.Repair.Can_Repair_Armor", true);
|
||||
repairTools = config.getBoolean("Skills.Repair.Can_Repair_Tools", true);
|
||||
repairdiamondlevel = config.getInt("Skills.Repair.Diamond.Level_Required", 50);
|
||||
repairIronLevel = config.getInt("Skills.Repair.Iron.Level_Required", 0);
|
||||
repairGoldLevel = config.getInt("Skills.Repair.Gold.Level_Required", 0);
|
||||
repairStoneLevel = config.getInt("Skills.Repair.Stone.Level_Required", 0);
|
||||
|
||||
tamingxpmodifier = config.getDouble("Experience.Formula.Multiplier.Taming", 1.0);
|
||||
miningxpmodifier = config.getDouble("Experience.Formula.Multiplier.Mining", 1.0);
|
||||
repairxpmodifier = config.getDouble("Experience.Formula.Multiplier.Repair", 1.0);
|
||||
woodcuttingxpmodifier = config.getDouble("Experience.Formula.Multiplier.Woodcutting", 1.0);
|
||||
unarmedxpmodifier = config.getDouble("Experience.Formula.Multiplier.Unarmed", 1.0);
|
||||
herbalismxpmodifier = config.getDouble("Experience.Formula.Multiplier.Herbalism", 1.0);
|
||||
excavationxpmodifier = config.getDouble("Experience.Formula.Multiplier.Excavation", 1.0);
|
||||
archeryxpmodifier = config.getDouble("Experience.Formula.Multiplier.Archery", 1.0);
|
||||
swordsxpmodifier = config.getDouble("Experience.Formula.Multiplier.Swords", 1.0);
|
||||
axesxpmodifier = config.getDouble("Experience.Formula.Multiplier.Axes", 1.0);
|
||||
acrobaticsxpmodifier = config.getDouble("Experience.Formula.Multiplier.Acrobatics", 1.0);
|
||||
fishingxpmodifier = config.getDouble("Experience.Forumla.Multiplier.Fishing", 1.0);
|
||||
|
||||
anvilmessages = config.getBoolean("Skills.Repair.Anvil_Messages", true);
|
||||
anvilID = config.getInt("Skills.Repair.Anvil_ID", 42);
|
||||
|
||||
rGold = config.getInt("Skills.Repair.Gold.ID", 266);
|
||||
rStone = config.getInt("Skills.Repair.Stone.ID", 4);
|
||||
rWood = config.getInt("Skills.Repair.Wood.ID", 5);
|
||||
rDiamond = config.getInt("Skills.Repair.Diamond.ID", 264);
|
||||
rIron = config.getInt("Skills.Repair.Iron.ID", 265);
|
||||
rString = config.getInt("Skills.Repair.String.ID", 287);
|
||||
rLeather = config.getInt("Skills.Repair.Leather.ID", 334);
|
||||
|
||||
levelCapAcrobatics = config.getInt("Skills.Acrobatics.Level_Cap", 0);
|
||||
levelCapArchery = config.getInt("Skills.Archery.Level_Cap", 0);
|
||||
levelCapAxes = config.getInt("Skills.Axes.Level_Cap", 0);
|
||||
levelCapExcavation = config.getInt("Skills.Excavation.Level_Cap", 0);
|
||||
levelCapFishing = config.getInt("Skills.Fishing.Level_Cap", 0);
|
||||
levelCapHerbalism = config.getInt("Skills.Herbalism.Level_Cap", 0);
|
||||
levelCapMining = config.getInt("Skills.Mining.Level_Cap", 0);
|
||||
levelCapRepair = config.getInt("Skills.Repair.Level_Cap", 0);
|
||||
levelCapSwords = config.getInt("Skills.Swords.Level_Cap", 0);
|
||||
levelCapTaming = config.getInt("Skills.Taming.Level_Cap", 0);
|
||||
levelCapUnarmed = config.getInt("Skills.Unarmed.Level_Cap", 0);
|
||||
levelCapWoodcutting = config.getInt("Skills.Woodcutting.Level_Cap", 0);
|
||||
|
||||
mayDowngradeEnchants = config.getBoolean("Arcane_Forging.Downgrades.Enabled", true);
|
||||
downgradeRank1 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_1", 75);
|
||||
downgradeRank2 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_2", 50);
|
||||
downgradeRank3 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_3", 25);
|
||||
downgradeRank4 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_4", 15);
|
||||
mayLoseEnchants = config.getBoolean("Arcane_Forging.May_Lose_Enchants", true);
|
||||
keepEnchantsRank1 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10);
|
||||
keepEnchantsRank2 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20);
|
||||
keepEnchantsRank3 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30);
|
||||
keepEnchantsRank4 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40);
|
||||
arcaneRank1 = config.getInt("Arcane_Forging.Rank_Levels.Rank_1", 100);
|
||||
arcaneRank2 = config.getInt("Arcane_Forging.Rank_Levels.Rank_2", 250);
|
||||
arcaneRank3 = config.getInt("Arcane_Forging.Rank_Levels.Rank_3", 500);
|
||||
arcaneRank4 = config.getInt("Arcane_Forging.Rank_Levels.Rank_4", 750);
|
||||
|
||||
fishingDrops = config.getBoolean("Fishing.Drops_Enabled", true);
|
||||
fishingTier1 = config.getInt("Fishing.Tier_Levels.Tier1", 0);
|
||||
fishingTier2 = config.getInt("Fishing.Tier_Levels.Tier2", 200);
|
||||
fishingTier3 = config.getInt("Fishing.Tier_Levels.Tier3", 400);
|
||||
fishingTier4 = config.getInt("Fishing.Tier_Levels.Tier4", 600);
|
||||
fishingTier5 = config.getInt("Fishing.Tier_Levels.Tier5", 800);
|
||||
|
||||
xplockEnable = config.getBoolean("Commands.xplock.Enabled", true);
|
||||
xprateEnable = config.getBoolean("Commands.xprate.Enabled", true);
|
||||
mctopEnable = config.getBoolean("Commands.mctop.Enabled", true);
|
||||
addxpEnable = config.getBoolean("Commands.addxp.Enabled", true);
|
||||
addlevelsEnable = config.getBoolean("Commands.addlevels.Enabled", true);
|
||||
mcabilityEnable = config.getBoolean("Commands.mcability.Enabled", true);
|
||||
mcrefreshEnable = config.getBoolean("Commands.mcrefresh.Enabled", true);
|
||||
mcmmoEnable = config.getBoolean("Commands.mcmmo.Enabled", true);
|
||||
mccEnable = config.getBoolean("Commands.mcc.Enabled", true);
|
||||
mcgodEnable = config.getBoolean("Commands.mcgod.Enabled", true);
|
||||
mcstatsEnable = config.getBoolean("Commands.mcstats.Enabled", true);
|
||||
mmoeditEnable = config.getBoolean("Commands.mmoedit.Enabled", true);
|
||||
mcremoveEnable = config.getBoolean("Commands.mcremove.Enable", true);
|
||||
ptpEnable = config.getBoolean("Commands.ptp.Enabled", true);
|
||||
partyEnable = config.getBoolean("Commands.party.Enabled", true);
|
||||
inspectEnable = config.getBoolean("Commands.inspect.Enabled", true);
|
||||
inviteEnable = config.getBoolean("Commands.invite.Enabled", true);
|
||||
acceptEnable = config.getBoolean("Commands.accept.Enabled", true);
|
||||
aEnable = config.getBoolean("Commands.a.Enabled", true);
|
||||
pEnable = config.getBoolean("Commands.p.Enabled", true);
|
||||
|
||||
aDisplayNames = config.getBoolean("Commands.a.Display_Names", true);
|
||||
pDisplayNames = config.getBoolean("Commands.p.Display_Names", true);
|
||||
|
||||
ptpCommandCooldown = config.getInt("Commands.ptp.Cooldown", 30);
|
||||
|
||||
animalXP = config.getDouble("Experience.Combat.Multiplier.Animals", 1.0);
|
||||
creeperXP = config.getDouble("Experience.Combat.Multiplier.Creeper", 4.0);
|
||||
skeletonXP = config.getDouble("Experience.Combat.Multiplier.Skeleton", 2.0);
|
||||
spiderXP = config.getDouble("Experience.Combat.Multiplier.Spider", 3.0);
|
||||
ghastXP = config.getDouble("Experience.Combat.Multiplier.Ghast", 3.0);
|
||||
slimeXP = config.getDouble("Experience.Combat.Multiplier.Slime", 2.0);
|
||||
zombieXP = config.getDouble("Experience.Combat.Multiplier.Zombie", 2.0);
|
||||
pigzombieXP = config.getDouble("Experience.Combat.Multiplier.Pig_Zombie", 3.0);
|
||||
endermanXP = config.getDouble("Experience.Combat.Multiplier.Enderman", 2.0);
|
||||
cavespiderXP = config.getDouble("Experience.Combat.Multiplier.Cave_Spider", 3.0);
|
||||
silverfishXP = config.getDouble("Experience.Combat.Multiplier.Silverfish", 3.0);
|
||||
blazeXP = config.getDouble("Experience.Combat.Multiplier.Blaze", 3.0);
|
||||
magmacubeXP = config.getDouble("Experience.Combat.Multiplier.Magma_Cube", 2.0);
|
||||
enderdragonXP = config.getDouble("Experience.Combat.Multiplier.Ender_Dragon", 8.0);
|
||||
|
||||
detonatorID = config.getInt("Skills.Mining.Detonator_ID", 259);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@@ -9,9 +7,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@@ -19,201 +17,270 @@ import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.Treasure;
|
||||
|
||||
public class LoadTreasures {
|
||||
public class LoadTreasures extends ConfigLoader{
|
||||
|
||||
public static List<ExcavationTreasure> excavationFromDirt = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromGrass = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromSand = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromGravel = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromClay = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromMycel = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromSoulSand = new ArrayList<ExcavationTreasure>();
|
||||
public static List<FishingTreasure> fishingRewardsTier1 = new ArrayList<FishingTreasure>();
|
||||
public static List<FishingTreasure> fishingRewardsTier2 = new ArrayList<FishingTreasure>();
|
||||
public static List<FishingTreasure> fishingRewardsTier3 = new ArrayList<FishingTreasure>();
|
||||
public static List<FishingTreasure> fishingRewardsTier4 = new ArrayList<FishingTreasure>();
|
||||
public static List<FishingTreasure> fishingRewardsTier5 = new ArrayList<FishingTreasure>();
|
||||
|
||||
protected static File configFile;
|
||||
protected static File dataFolder;
|
||||
protected final mcMMO plugin;
|
||||
protected static FileConfiguration config;
|
||||
public static List<ExcavationTreasure> excavationFromDirt = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromGrass = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromSand = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromGravel = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromClay = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromMycel = new ArrayList<ExcavationTreasure>();
|
||||
public static List<ExcavationTreasure> excavationFromSoulSand = new ArrayList<ExcavationTreasure>();
|
||||
public static List<FishingTreasure> fishingRewardsTier1 = new ArrayList<FishingTreasure>();
|
||||
public static List<FishingTreasure> fishingRewardsTier2 = new ArrayList<FishingTreasure>();
|
||||
public static List<FishingTreasure> fishingRewardsTier3 = new ArrayList<FishingTreasure>();
|
||||
public static List<FishingTreasure> fishingRewardsTier4 = new ArrayList<FishingTreasure>();
|
||||
public static List<FishingTreasure> fishingRewardsTier5 = new ArrayList<FishingTreasure>();
|
||||
|
||||
public LoadTreasures(mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
dataFolder = plugin.getDataFolder();
|
||||
configFile = new File(dataFolder, File.separator + "treasures.yml");
|
||||
config = plugin.getTreasuresConfig();
|
||||
}
|
||||
public LoadTreasures(mcMMO plugin) {
|
||||
super(plugin, "treasures.yml");
|
||||
config = plugin.getTreasuresConfig();
|
||||
}
|
||||
|
||||
public void load() {
|
||||
// If not exist, copy from the jar
|
||||
if (!configFile.exists()) {
|
||||
dataFolder.mkdir();
|
||||
plugin.saveTreasuresConfig();
|
||||
}
|
||||
addDefaults();
|
||||
loadKeys();
|
||||
}
|
||||
|
||||
private static void saveConfig() {
|
||||
try {
|
||||
config.save(configFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void addDefaults() {
|
||||
// Load from included config.yml
|
||||
config.options().copyDefaults(true);
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
private Boolean readBoolean(String root, Boolean def) {
|
||||
Boolean result = config.getBoolean(root, def);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void loadKeys()
|
||||
{
|
||||
plugin.getLogger().info("Loading mcMMO treasures.yml File...");
|
||||
|
||||
// Load treasures
|
||||
Map<String, Treasure> treasures = new HashMap<String, Treasure>();
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
ConfigurationSection treasureSection = config.getConfigurationSection("Treasures");
|
||||
// If it doesn't exist, copy it from the .jar
|
||||
if (!configFile.exists()) {
|
||||
dataFolder.mkdir();
|
||||
plugin.saveTreasuresConfig();
|
||||
}
|
||||
|
||||
addDefaults();
|
||||
loadKeys();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
plugin.getLogger().info("Loading mcMMO treasures.yml File...");
|
||||
|
||||
Map<String, Treasure> treasures = new HashMap<String, Treasure>();
|
||||
ConfigurationSection treasureSection = config.getConfigurationSection("Treasures");
|
||||
Set<String> treasureConfigSet = treasureSection.getKeys(false);
|
||||
Iterator<String> iterator = treasureConfigSet.iterator();
|
||||
while(iterator.hasNext())
|
||||
{
|
||||
String treasureName = iterator.next();
|
||||
|
||||
// Validate all the things!
|
||||
List<String> reason = new ArrayList<String>();
|
||||
while (iterator.hasNext()) {
|
||||
String treasureName = iterator.next();
|
||||
|
||||
if(!config.contains("Treasures." + treasureName + ".ID")) reason.add("Missing ID");
|
||||
if(!config.contains("Treasures." + treasureName + ".Amount")) reason.add("Missing Amount");
|
||||
if(!config.contains("Treasures." + treasureName + ".Data")) reason.add("Missing Data");
|
||||
// Validate all the things!
|
||||
List<String> reason = new ArrayList<String>();
|
||||
|
||||
int id = config.getInt("Treasures." + treasureName + ".ID");
|
||||
int amount = config.getInt("Treasures." + treasureName + ".Amount");
|
||||
int data = config.getInt("Treasures." + treasureName + ".Data");
|
||||
/*
|
||||
* ID, Amount, and Data
|
||||
*/
|
||||
|
||||
if(Material.getMaterial(id) == null) reason.add("Invlid id: " + id);
|
||||
if(amount < 1) reason.add("Invalid amount: " + amount);
|
||||
if(data > 127 || data < -128) reason.add("Invalid data: " + data);
|
||||
if (!config.contains("Treasures." + treasureName + ".ID")) {
|
||||
reason.add("Missing ID");
|
||||
}
|
||||
|
||||
if(!config.contains("Treasures." + treasureName + ".XP")) reason.add("Missing XP");
|
||||
if(!config.contains("Treasures." + treasureName + ".Drop_Chance")) reason.add("Missing Drop_Chance");
|
||||
if(!config.contains("Treasures." + treasureName + ".Drop_Level")) reason.add("Missing Drop_Level");
|
||||
if (!config.contains("Treasures." + treasureName + ".Amount")) {
|
||||
reason.add("Missing Amount");
|
||||
}
|
||||
|
||||
int xp = config.getInt("Treasures." + treasureName + ".XP");
|
||||
Double dropChance = config.getDouble("Treasures." + treasureName + ".Drop_Chance");
|
||||
int dropLevel = config.getInt("Treasures." + treasureName + ".Drop_Level");
|
||||
if (!config.contains("Treasures." + treasureName + ".Data")) {
|
||||
reason.add("Missing Data");
|
||||
}
|
||||
|
||||
if(xp < 0) reason.add("Invalid xp: " + xp);
|
||||
if(dropChance < 0) reason.add("Invalid Drop_Chance: " + dropChance);
|
||||
if(dropLevel < 0) reason.add("Invalid Drop_Level: " + dropLevel);
|
||||
int id = config.getInt("Treasures." + treasureName + ".ID");
|
||||
int amount = config.getInt("Treasures." + treasureName + ".Amount");
|
||||
int data = config.getInt("Treasures." + treasureName + ".Data");
|
||||
|
||||
ItemStack item = new ItemStack(id, amount, (byte) 0, (byte) data);
|
||||
if (Material.getMaterial(id) == null) {
|
||||
reason.add("Invlid id: " + id);
|
||||
}
|
||||
|
||||
if(readBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
|
||||
if(config.getConfigurationSection("Treasures." + treasureName + ".Drops_From").getKeys(false).size() != 1)
|
||||
reason.add("Fishing drops cannot also be excavation drops");
|
||||
if (amount < 1) {
|
||||
reason.add("Invalid amount: " + amount);
|
||||
}
|
||||
|
||||
if(!config.contains("Treasures." + treasureName + ".Max_Level")) reason.add("Missing Max_Level");
|
||||
int maxLevel = config.getInt("Treasures." + treasureName + ".Max_Level");
|
||||
if (data > 127 || data < -128) {
|
||||
reason.add("Invalid data: " + data);
|
||||
}
|
||||
|
||||
if(maxLevel < 0) reason.add("Invalid Max_Level: " + maxLevel);
|
||||
/*
|
||||
* XP, Drop Chance, and Drop Level
|
||||
*/
|
||||
|
||||
if(noErrorsInTreasure(reason)) {
|
||||
FishingTreasure fTreasure = new FishingTreasure(item, xp, dropChance, dropLevel, maxLevel);
|
||||
treasures.put(treasureName, fTreasure);
|
||||
}
|
||||
} else {
|
||||
ExcavationTreasure eTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
||||
if(readBoolean("Treasures." + treasureName + ".Drops_From.Dirt", false))
|
||||
eTreasure.setDropsFromDirt();
|
||||
if(readBoolean("Treasures." + treasureName + ".Drops_From.Grass", false))
|
||||
eTreasure.setDropsFromGrass();
|
||||
if(readBoolean("Treasures." + treasureName + ".Drops_From.Sand", false))
|
||||
eTreasure.setDropsFromSand();
|
||||
if(readBoolean("Treasures." + treasureName + ".Drops_From.Gravel", false))
|
||||
eTreasure.setDropsFromGravel();
|
||||
if(readBoolean("Treasures." + treasureName + ".Drops_From.Clay", false))
|
||||
eTreasure.setDropsFromClay();
|
||||
if(readBoolean("Treasures." + treasureName + ".Drops_From.Mycelium", false))
|
||||
eTreasure.setDropsFromMycel();
|
||||
if(readBoolean("Treasures." + treasureName + ".Drops_From.Soul_Sand", false))
|
||||
eTreasure.setDropsFromSoulSand();
|
||||
if (!config.contains("Treasures." + treasureName + ".XP")) {
|
||||
reason.add("Missing XP");
|
||||
}
|
||||
|
||||
if(readBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
|
||||
reason.add("Excavation drops cannot also be fishing drops");
|
||||
}
|
||||
if (!config.contains("Treasures." + treasureName + ".Drop_Chance")) {
|
||||
reason.add("Missing Drop_Chance");
|
||||
}
|
||||
|
||||
if(noErrorsInTreasure(reason)) {
|
||||
treasures.put(treasureName, eTreasure);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!config.contains("Treasures." + treasureName + ".Drop_Level")) {
|
||||
reason.add("Missing Drop_Level");
|
||||
}
|
||||
|
||||
List<String> excavationTreasures = config.getStringList("Excavation.Treasure");
|
||||
List<String> fishingTreasures = config.getStringList("Fishing.Treasure");
|
||||
int xp = config.getInt("Treasures." + treasureName + ".XP");
|
||||
Double dropChance = config.getDouble("Treasures." + treasureName + ".Drop_Chance");
|
||||
int dropLevel = config.getInt("Treasures." + treasureName + ".Drop_Level");
|
||||
|
||||
Iterator<String> treasureIterator = treasures.keySet().iterator();
|
||||
while(treasureIterator.hasNext()) {
|
||||
String treasureKey = treasureIterator.next();
|
||||
Treasure treasure = treasures.get(treasureKey);
|
||||
if (xp < 0) {
|
||||
reason.add("Invalid xp: " + xp);
|
||||
}
|
||||
|
||||
if(treasure instanceof FishingTreasure) {
|
||||
if(!fishingTreasures.contains(treasureKey)) continue;
|
||||
|
||||
FishingTreasure fTreasure = (FishingTreasure) treasure;
|
||||
int dropLevel = fTreasure.getDropLevel();
|
||||
int maxLevel = fTreasure.getMaxLevel();
|
||||
|
||||
if(dropLevel <= LoadProperties.fishingTier1 && maxLevel >= LoadProperties.fishingTier1)
|
||||
fishingRewardsTier1.add(fTreasure);
|
||||
if(dropLevel <= LoadProperties.fishingTier2 && maxLevel >= LoadProperties.fishingTier2)
|
||||
fishingRewardsTier2.add(fTreasure);
|
||||
if(dropLevel <= LoadProperties.fishingTier3 && maxLevel >= LoadProperties.fishingTier3)
|
||||
fishingRewardsTier3.add(fTreasure);
|
||||
if(dropLevel <= LoadProperties.fishingTier4 && maxLevel >= LoadProperties.fishingTier4)
|
||||
fishingRewardsTier4.add(fTreasure);
|
||||
if(dropLevel <= LoadProperties.fishingTier5 && maxLevel >= LoadProperties.fishingTier5)
|
||||
fishingRewardsTier5.add(fTreasure);
|
||||
|
||||
} else if(treasure instanceof ExcavationTreasure) {
|
||||
if(!excavationTreasures.contains(treasureKey)) continue;
|
||||
if (dropChance < 0) {
|
||||
reason.add("Invalid Drop_Chance: " + dropChance);
|
||||
}
|
||||
|
||||
ExcavationTreasure eTreasure = (ExcavationTreasure) treasure;
|
||||
if(eTreasure.getDropsFromDirt())
|
||||
excavationFromDirt.add(eTreasure);
|
||||
if(eTreasure.getDropsFromGrass())
|
||||
excavationFromGrass.add(eTreasure);
|
||||
if(eTreasure.getDropsFromSand())
|
||||
excavationFromSand.add(eTreasure);
|
||||
if(eTreasure.getDropsFromGravel())
|
||||
excavationFromGravel.add(eTreasure);
|
||||
if(eTreasure.getDropsFromClay())
|
||||
excavationFromClay.add(eTreasure);
|
||||
if(eTreasure.getDropsFromMycel())
|
||||
excavationFromMycel.add(eTreasure);
|
||||
if(eTreasure.getDropsFromSoulSand())
|
||||
excavationFromSoulSand.add(eTreasure);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dropLevel < 0) {
|
||||
reason.add("Invalid Drop_Level: " + dropLevel);
|
||||
}
|
||||
|
||||
private boolean noErrorsInTreasure(List<String> issues) {
|
||||
if(issues.isEmpty()) return true;
|
||||
/*
|
||||
* Drops From & Max Level
|
||||
*/
|
||||
|
||||
for(String issue : issues) {
|
||||
plugin.getLogger().warning(issue);
|
||||
}
|
||||
ItemStack item = new ItemStack(id, amount, (short) 0, (byte) data);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
|
||||
if (config.getConfigurationSection("Treasures." + treasureName + ".Drops_From").getKeys(false).size() != 1) {
|
||||
reason.add("Fishing drops cannot also be excavation drops");
|
||||
}
|
||||
|
||||
if (!config.contains("Treasures." + treasureName + ".Max_Level")) {
|
||||
reason.add("Missing Max_Level");
|
||||
}
|
||||
|
||||
int maxLevel = config.getInt("Treasures." + treasureName + ".Max_Level");
|
||||
|
||||
if (maxLevel < 0) {
|
||||
reason.add("Invalid Max_Level: " + maxLevel);
|
||||
}
|
||||
|
||||
if (noErrorsInTreasure(reason)) {
|
||||
FishingTreasure fTreasure = new FishingTreasure(item, xp, dropChance, dropLevel, maxLevel);
|
||||
treasures.put(treasureName, fTreasure);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ExcavationTreasure eTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Dirt", false)) {
|
||||
eTreasure.setDropsFromDirt();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Grass", false)) {
|
||||
eTreasure.setDropsFromGrass();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Sand", false)) {
|
||||
eTreasure.setDropsFromSand();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Gravel", false)) {
|
||||
eTreasure.setDropsFromGravel();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Clay", false)) {
|
||||
eTreasure.setDropsFromClay();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Mycelium", false)) {
|
||||
eTreasure.setDropsFromMycel();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Soul_Sand", false)) {
|
||||
eTreasure.setDropsFromSoulSand();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
|
||||
reason.add("Excavation drops cannot also be fishing drops");
|
||||
}
|
||||
|
||||
if (noErrorsInTreasure(reason)) {
|
||||
treasures.put(treasureName, eTreasure);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> excavationTreasures = config.getStringList("Excavation.Treasure");
|
||||
List<String> fishingTreasures = config.getStringList("Fishing.Treasure");
|
||||
Iterator<String> treasureIterator = treasures.keySet().iterator();
|
||||
|
||||
while (treasureIterator.hasNext()) {
|
||||
String treasureKey = treasureIterator.next();
|
||||
Treasure treasure = treasures.get(treasureKey);
|
||||
|
||||
if (treasure instanceof FishingTreasure) {
|
||||
if (!fishingTreasures.contains(treasureKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
FishingTreasure fTreasure = (FishingTreasure) treasure;
|
||||
int dropLevel = fTreasure.getDropLevel();
|
||||
int maxLevel = fTreasure.getMaxLevel();
|
||||
|
||||
if(dropLevel <= LoadProperties.fishingTier1 && maxLevel >= LoadProperties.fishingTier1) {
|
||||
fishingRewardsTier1.add(fTreasure);
|
||||
}
|
||||
|
||||
if(dropLevel <= LoadProperties.fishingTier2 && maxLevel >= LoadProperties.fishingTier2) {
|
||||
fishingRewardsTier2.add(fTreasure);
|
||||
}
|
||||
|
||||
if (dropLevel <= LoadProperties.fishingTier3 && maxLevel >= LoadProperties.fishingTier3) {
|
||||
fishingRewardsTier3.add(fTreasure);
|
||||
}
|
||||
|
||||
if (dropLevel <= LoadProperties.fishingTier4 && maxLevel >= LoadProperties.fishingTier4) {
|
||||
fishingRewardsTier4.add(fTreasure);
|
||||
}
|
||||
|
||||
if (dropLevel <= LoadProperties.fishingTier5 && maxLevel >= LoadProperties.fishingTier5) {
|
||||
fishingRewardsTier5.add(fTreasure);
|
||||
}
|
||||
|
||||
}
|
||||
else if (treasure instanceof ExcavationTreasure) {
|
||||
if (!excavationTreasures.contains(treasureKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ExcavationTreasure eTreasure = (ExcavationTreasure) treasure;
|
||||
|
||||
if (eTreasure.getDropsFromDirt()) {
|
||||
excavationFromDirt.add(eTreasure);
|
||||
}
|
||||
|
||||
if (eTreasure.getDropsFromGrass()) {
|
||||
excavationFromGrass.add(eTreasure);
|
||||
}
|
||||
|
||||
if (eTreasure.getDropsFromSand()) {
|
||||
excavationFromSand.add(eTreasure);
|
||||
}
|
||||
|
||||
if (eTreasure.getDropsFromGravel()) {
|
||||
excavationFromGravel.add(eTreasure);
|
||||
}
|
||||
|
||||
if (eTreasure.getDropsFromClay()) {
|
||||
excavationFromClay.add(eTreasure);
|
||||
}
|
||||
|
||||
if (eTreasure.getDropsFromMycel()) {
|
||||
excavationFromMycel.add(eTreasure);
|
||||
}
|
||||
|
||||
if (eTreasure.getDropsFromSoulSand()) {
|
||||
excavationFromSoulSand.add(eTreasure);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean noErrorsInTreasure(List<String> issues) {
|
||||
if (issues.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
for (String issue : issues) {
|
||||
Bukkit.getLogger().warning(issue);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
public class Misc
|
||||
{
|
||||
String location = "mcmmo.properties";
|
||||
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
public ArrayList<Integer> mobSpawnerList = new ArrayList<Integer>();
|
||||
public HashSet<Block> blockWatchList = new HashSet<Block>();
|
||||
public HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
|
||||
public ArrayList<LivingEntity> bleedTracker = new ArrayList<LivingEntity>();
|
||||
public HashMap<Location, Player> tntTracker = new HashMap<Location, Player>();
|
||||
mcMMO plugin = null;
|
||||
|
||||
//BLEED QUE STUFF
|
||||
public LivingEntity[] bleedQue = new LivingEntity[20];
|
||||
public int bleedQuePos = 0;
|
||||
public LivingEntity[] bleedRemovalQue = new LivingEntity[20];
|
||||
public int bleedRemovalQuePos = 0;
|
||||
|
||||
public Misc(mcMMO mcMMO)
|
||||
{
|
||||
plugin = mcMMO;
|
||||
}
|
||||
|
||||
public void addToBleedQue(LivingEntity entity)
|
||||
{
|
||||
//Assign entity to empty position
|
||||
bleedQue[bleedQuePos] = entity;
|
||||
|
||||
//Move position up by 1 increment
|
||||
bleedQuePos++;
|
||||
|
||||
//Check if array is full
|
||||
if(bleedQuePos >= bleedQue.length)
|
||||
{
|
||||
//Create new temporary array
|
||||
LivingEntity[] temp = new LivingEntity[bleedQue.length*2];
|
||||
//Copy data from bleedQue to temporary array
|
||||
System.arraycopy(bleedQue, 0, temp, 0, bleedQue.length);
|
||||
//Point bleedQue to new array
|
||||
bleedQue = temp;
|
||||
}
|
||||
}
|
||||
|
||||
public void addToBleedRemovalQue(LivingEntity entity)
|
||||
{
|
||||
//Assign entity to empty position
|
||||
bleedRemovalQue[bleedRemovalQuePos] = entity;
|
||||
|
||||
//Move position up by 1 increment
|
||||
bleedRemovalQuePos++;
|
||||
|
||||
//Check if array is full
|
||||
if(bleedRemovalQuePos >= bleedRemovalQue.length)
|
||||
{
|
||||
//Create new temporary array
|
||||
LivingEntity[] temp = new LivingEntity[bleedRemovalQue.length*2];
|
||||
//Copy data from bleedRemovalQue to temporary array
|
||||
System.arraycopy(bleedRemovalQue, 0, temp, 0, bleedRemovalQue.length);
|
||||
//Point bleedRemovalQue to new array
|
||||
bleedRemovalQue = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,195 +1,291 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.Excavation;
|
||||
import com.gmail.nossr50.skills.Herbalism;
|
||||
import com.gmail.nossr50.skills.Mining;
|
||||
|
||||
public enum AbilityType
|
||||
{
|
||||
BERSERK(LoadProperties.berserkCooldown, mcLocale.getString("Skills.BerserkOn"), mcLocale.getString("Skills.BerserkOff"), "Skills.BerserkPlayer", mcLocale.getString("Skills.YourBerserk"), "Skills.BerserkPlayerOff"),
|
||||
SUPER_BREAKER(LoadProperties.superBreakerCooldown, mcLocale.getString("Skills.SuperBreakerOn"), mcLocale.getString("Skills.SuperBreakerOff"), "Skills.SuperBreakerPlayer", mcLocale.getString("Skills.YourSuperBreaker"), "Skills.SuperBreakerPlayerOff"),
|
||||
GIGA_DRILL_BREAKER(LoadProperties.gigaDrillBreakerCooldown, mcLocale.getString("Skills.GigaDrillBreakerOn"), mcLocale.getString("Skills.GigaDrillBreakerOff"), "Skills.GigaDrillBreakerPlayer", mcLocale.getString("Skills.YourGigaDrillBreaker"), "Skills.GigaDrillBreakerPlayerOff"),
|
||||
GREEN_TERRA(LoadProperties.greenTerraCooldown, mcLocale.getString("Skills.GreenTerraOn"), mcLocale.getString("Skills.GreenTerraOff"), "Skills.GreenTerraPlayer", mcLocale.getString("Skills.YourGreenTerra"), mcLocale.getString("Skills.GreenTerraPlayerOff")),
|
||||
SKULL_SPLIITER(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SkullSplitterOn"), mcLocale.getString("Skills.SkullSplitterOff"), "Skills.SkullSplitterPlayer", mcLocale.getString("Skills.YourSkullSplitter"), "Skills.SkullSplitterPlayerOff"),
|
||||
TREE_FELLER(LoadProperties.treeFellerCooldown, mcLocale.getString("Skills.TreeFellerOn"), mcLocale.getString("Skills.TreeFellerOff"), "Skills.TreeFellerPlayer", mcLocale.getString("Skills.YourTreeFeller"), "Skills.TreeFellerPlayerOff"),
|
||||
SERRATED_STRIKES(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SerratedStrikesOn"), mcLocale.getString("Skills.SerratedStrikesOff"), "Skills.SerratedStrikesPlayer", mcLocale.getString("Skills.YourSerratedStrikes"), "Skills.SerratedStrikesPlayerOff"),
|
||||
BLAST_MINING(LoadProperties.blastMiningCooldown, "NOT NEEDED FOR BLAST MINING", "NOT NEEDED FOR BLAST MINING", "Skills.BlastMiningPlayer", mcLocale.getString("Skills.YourBlastMining"), "NOT NEEDED FOR BLAST MINING");
|
||||
public enum AbilityType {
|
||||
BERSERK(LoadProperties.berserkCooldown, mcLocale.getString("Skills.BerserkOn"), mcLocale.getString("Skills.BerserkOff"), "Skills.BerserkPlayer", mcLocale.getString("Skills.YourBerserk"), "Skills.BerserkPlayerOff"),
|
||||
SUPER_BREAKER(LoadProperties.superBreakerCooldown, mcLocale.getString("Skills.SuperBreakerOn"), mcLocale.getString("Skills.SuperBreakerOff"), "Skills.SuperBreakerPlayer", mcLocale.getString("Skills.YourSuperBreaker"), "Skills.SuperBreakerPlayerOff"),
|
||||
GIGA_DRILL_BREAKER(LoadProperties.gigaDrillBreakerCooldown, mcLocale.getString("Skills.GigaDrillBreakerOn"), mcLocale.getString("Skills.GigaDrillBreakerOff"), "Skills.GigaDrillBreakerPlayer", mcLocale.getString("Skills.YourGigaDrillBreaker"), "Skills.GigaDrillBreakerPlayerOff"),
|
||||
GREEN_TERRA(LoadProperties.greenTerraCooldown, mcLocale.getString("Skills.GreenTerraOn"), mcLocale.getString("Skills.GreenTerraOff"), "Skills.GreenTerraPlayer", mcLocale.getString("Skills.YourGreenTerra"), mcLocale.getString("Skills.GreenTerraPlayerOff")),
|
||||
SKULL_SPLIITER(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SkullSplitterOn"), mcLocale.getString("Skills.SkullSplitterOff"), "Skills.SkullSplitterPlayer", mcLocale.getString("Skills.YourSkullSplitter"), "Skills.SkullSplitterPlayerOff"),
|
||||
TREE_FELLER(LoadProperties.treeFellerCooldown, mcLocale.getString("Skills.TreeFellerOn"), mcLocale.getString("Skills.TreeFellerOff"), "Skills.TreeFellerPlayer", mcLocale.getString("Skills.YourTreeFeller"), "Skills.TreeFellerPlayerOff"),
|
||||
SERRATED_STRIKES(LoadProperties.skullSplitterCooldown, mcLocale.getString("Skills.SerratedStrikesOn"), mcLocale.getString("Skills.SerratedStrikesOff"), "Skills.SerratedStrikesPlayer", mcLocale.getString("Skills.YourSerratedStrikes"), "Skills.SerratedStrikesPlayerOff"),
|
||||
BLAST_MINING(LoadProperties.blastMiningCooldown, null, null, "Skills.BlastMiningPlayer", mcLocale.getString("Skills.YourBlastMining"), null),
|
||||
LEAF_BLOWER(0, null, null, null, null, null);
|
||||
|
||||
private int cooldown;
|
||||
private String abilityOn;
|
||||
private String abilityOff;
|
||||
private String abilityPlayer;
|
||||
private String abilityRefresh;
|
||||
private String abilityPlayerOff;
|
||||
|
||||
private AbilityType(int cooldown, String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff)
|
||||
{
|
||||
this.cooldown = cooldown;
|
||||
this.abilityOn = abilityOn;
|
||||
this.abilityOff = abilityOff;
|
||||
this.abilityPlayer = abilityPlayer;
|
||||
this.abilityRefresh = abilityRefresh;
|
||||
this.abilityPlayerOff = abilityPlayerOff;
|
||||
}
|
||||
|
||||
public int getCooldown()
|
||||
{
|
||||
return this.cooldown;
|
||||
}
|
||||
|
||||
public String getAbilityOn()
|
||||
{
|
||||
return this.abilityOn;
|
||||
}
|
||||
|
||||
public String getAbilityOff()
|
||||
{
|
||||
return this.abilityOff;
|
||||
}
|
||||
|
||||
public String getAbilityPlayer(Player player)
|
||||
{
|
||||
return mcLocale.getString(this.abilityPlayer, new Object[] {player.getName()});
|
||||
}
|
||||
|
||||
public String getAbilityPlayerOff(Player player)
|
||||
{
|
||||
return mcLocale.getString(this.abilityPlayerOff, new Object[] {player.getName()});
|
||||
}
|
||||
|
||||
public String getAbilityRefresh()
|
||||
{
|
||||
return this.abilityRefresh;
|
||||
}
|
||||
|
||||
public boolean getMode(PlayerProfile PP)
|
||||
{
|
||||
switch(this)
|
||||
{
|
||||
case BERSERK:
|
||||
return PP.getBerserkMode();
|
||||
case SUPER_BREAKER:
|
||||
return PP.getSuperBreakerMode();
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return PP.getGigaDrillBreakerMode();
|
||||
case GREEN_TERRA:
|
||||
return PP.getGreenTerraMode();
|
||||
case SKULL_SPLIITER:
|
||||
return PP.getSkullSplitterMode();
|
||||
case TREE_FELLER:
|
||||
return PP.getTreeFellerMode();
|
||||
case SERRATED_STRIKES:
|
||||
return PP.getSerratedStrikesMode();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private int cooldown;
|
||||
private String abilityOn;
|
||||
private String abilityOff;
|
||||
private String abilityPlayer;
|
||||
private String abilityRefresh;
|
||||
private String abilityPlayerOff;
|
||||
|
||||
public void setMode(PlayerProfile PP, boolean bool)
|
||||
{
|
||||
switch(this)
|
||||
{
|
||||
case BERSERK:
|
||||
PP.setBerserkMode(bool);
|
||||
break;
|
||||
case SUPER_BREAKER:
|
||||
PP.setSuperBreakerMode(bool);
|
||||
break;
|
||||
case GIGA_DRILL_BREAKER:
|
||||
PP.setGigaDrillBreakerMode(bool);
|
||||
break;
|
||||
case GREEN_TERRA:
|
||||
PP.setGreenTerraMode(bool);
|
||||
break;
|
||||
case SKULL_SPLIITER:
|
||||
PP.setSkullSplitterMode(bool);
|
||||
break;
|
||||
case TREE_FELLER:
|
||||
PP.setTreeFellerMode(bool);
|
||||
break;
|
||||
case SERRATED_STRIKES:
|
||||
PP.setSerratedStrikesMode(bool);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getInformed(PlayerProfile PP)
|
||||
{
|
||||
switch(this)
|
||||
{
|
||||
case BLAST_MINING:
|
||||
return PP.getBlastMiningInformed();
|
||||
case BERSERK:
|
||||
return PP.getBerserkInformed();
|
||||
case SUPER_BREAKER:
|
||||
return PP.getSuperBreakerInformed();
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return PP.getGigaDrillBreakerInformed();
|
||||
case GREEN_TERRA:
|
||||
return PP.getGreenTerraInformed();
|
||||
case SKULL_SPLIITER:
|
||||
return PP.getSkullSplitterInformed();
|
||||
case TREE_FELLER:
|
||||
return PP.getTreeFellerInformed();
|
||||
case SERRATED_STRIKES:
|
||||
return PP.getSerratedStrikesInformed();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setInformed(PlayerProfile PP, boolean bool)
|
||||
{
|
||||
switch(this)
|
||||
{
|
||||
case BLAST_MINING:
|
||||
PP.setBlastMiningInformed(bool);
|
||||
break;
|
||||
case BERSERK:
|
||||
PP.setBerserkInformed(bool);
|
||||
break;
|
||||
case SUPER_BREAKER:
|
||||
PP.setSuperBreakerInformed(bool);
|
||||
break;
|
||||
case GIGA_DRILL_BREAKER:
|
||||
PP.setGigaDrillBreakerInformed(bool);
|
||||
break;
|
||||
case GREEN_TERRA:
|
||||
PP.setGreenTerraInformed(bool);
|
||||
break;
|
||||
case SKULL_SPLIITER:
|
||||
PP.setSkullSplitterInformed(bool);
|
||||
break;
|
||||
case TREE_FELLER:
|
||||
PP.setTreeFellerInformed(bool);
|
||||
break;
|
||||
case SERRATED_STRIKES:
|
||||
PP.setSerratedStrikesInformed(bool);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getPermissions(Player player)
|
||||
{
|
||||
switch(this)
|
||||
{
|
||||
case BERSERK:
|
||||
return mcPermissions.getInstance().unarmedAbility(player);
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return mcPermissions.getInstance().excavationAbility(player);
|
||||
case GREEN_TERRA:
|
||||
return mcPermissions.getInstance().herbalismAbility(player);
|
||||
case SERRATED_STRIKES:
|
||||
return mcPermissions.getInstance().swordsAbility(player);
|
||||
case SKULL_SPLIITER:
|
||||
return mcPermissions.getInstance().axesAbility(player);
|
||||
case SUPER_BREAKER:
|
||||
return mcPermissions.getInstance().miningAbility(player);
|
||||
case TREE_FELLER:
|
||||
return mcPermissions.getInstance().woodCuttingAbility(player);
|
||||
case BLAST_MINING:
|
||||
return mcPermissions.getInstance().blastMining(player);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private AbilityType(int cooldown, String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
|
||||
this.cooldown = cooldown;
|
||||
this.abilityOn = abilityOn;
|
||||
this.abilityOff = abilityOff;
|
||||
this.abilityPlayer = abilityPlayer;
|
||||
this.abilityRefresh = abilityRefresh;
|
||||
this.abilityPlayerOff = abilityPlayerOff;
|
||||
}
|
||||
|
||||
public int getCooldown() {
|
||||
return this.cooldown;
|
||||
}
|
||||
|
||||
public String getAbilityOn() {
|
||||
return this.abilityOn;
|
||||
}
|
||||
|
||||
public String getAbilityOff() {
|
||||
return this.abilityOff;
|
||||
}
|
||||
|
||||
public String getAbilityPlayer(Player player) {
|
||||
return mcLocale.getString(this.abilityPlayer, new Object[] {player.getName()});
|
||||
}
|
||||
|
||||
public String getAbilityPlayerOff(Player player) {
|
||||
return mcLocale.getString(this.abilityPlayerOff, new Object[] {player.getName()});
|
||||
}
|
||||
|
||||
public String getAbilityRefresh() {
|
||||
return this.abilityRefresh;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mode of this ability.
|
||||
*
|
||||
* @param PP PlayerProfile of the player using the ability
|
||||
* @return true if the ability is enabled, false otherwise
|
||||
*/
|
||||
public boolean getMode(PlayerProfile PP) {
|
||||
switch (this) {
|
||||
case BERSERK:
|
||||
return PP.getBerserkMode();
|
||||
|
||||
case SUPER_BREAKER:
|
||||
return PP.getSuperBreakerMode();
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return PP.getGigaDrillBreakerMode();
|
||||
|
||||
case GREEN_TERRA:
|
||||
return PP.getGreenTerraMode();
|
||||
|
||||
case SKULL_SPLIITER:
|
||||
return PP.getSkullSplitterMode();
|
||||
|
||||
case TREE_FELLER:
|
||||
return PP.getTreeFellerMode();
|
||||
|
||||
case SERRATED_STRIKES:
|
||||
return PP.getSerratedStrikesMode();
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the mode of this ability.
|
||||
*
|
||||
* @param PP PlayerProfile of the player using the ability
|
||||
* @param bool Mode to set the ability to
|
||||
*/
|
||||
public void setMode(PlayerProfile PP, boolean bool) {
|
||||
switch (this) {
|
||||
case BERSERK:
|
||||
PP.setBerserkMode(bool);
|
||||
break;
|
||||
|
||||
case SUPER_BREAKER:
|
||||
PP.setSuperBreakerMode(bool);
|
||||
break;
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
PP.setGigaDrillBreakerMode(bool);
|
||||
break;
|
||||
|
||||
case GREEN_TERRA:
|
||||
PP.setGreenTerraMode(bool);
|
||||
break;
|
||||
|
||||
case SKULL_SPLIITER:
|
||||
PP.setSkullSplitterMode(bool);
|
||||
break;
|
||||
|
||||
case TREE_FELLER:
|
||||
PP.setTreeFellerMode(bool);
|
||||
break;
|
||||
|
||||
case SERRATED_STRIKES:
|
||||
PP.setSerratedStrikesMode(bool);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the informed state of this ability
|
||||
*
|
||||
* @param PP PlayerProfile of the player using the ability
|
||||
* @return true if the ability is informed, false otherwise
|
||||
*/
|
||||
public boolean getInformed(PlayerProfile PP) {
|
||||
switch (this) {
|
||||
case BERSERK:
|
||||
return PP.getBerserkInformed();
|
||||
|
||||
case BLAST_MINING:
|
||||
return PP.getBlastMiningInformed();
|
||||
|
||||
case SUPER_BREAKER:
|
||||
return PP.getSuperBreakerInformed();
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return PP.getGigaDrillBreakerInformed();
|
||||
|
||||
case GREEN_TERRA:
|
||||
return PP.getGreenTerraInformed();
|
||||
|
||||
case SKULL_SPLIITER:
|
||||
return PP.getSkullSplitterInformed();
|
||||
|
||||
case TREE_FELLER:
|
||||
return PP.getTreeFellerInformed();
|
||||
|
||||
case SERRATED_STRIKES:
|
||||
return PP.getSerratedStrikesInformed();
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the informed state of this ability.
|
||||
*
|
||||
* @param PP PlayerProfile of the player using the ability
|
||||
* @param bool Informed state to set the ability to
|
||||
*/
|
||||
public void setInformed(PlayerProfile PP, boolean bool) {
|
||||
switch (this) {
|
||||
case BERSERK:
|
||||
PP.setBerserkInformed(bool);
|
||||
break;
|
||||
|
||||
case BLAST_MINING:
|
||||
PP.setBlastMiningInformed(bool);
|
||||
break;
|
||||
|
||||
case SUPER_BREAKER:
|
||||
PP.setSuperBreakerInformed(bool);
|
||||
break;
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
PP.setGigaDrillBreakerInformed(bool);
|
||||
break;
|
||||
|
||||
case GREEN_TERRA:
|
||||
PP.setGreenTerraInformed(bool);
|
||||
break;
|
||||
|
||||
case SKULL_SPLIITER:
|
||||
PP.setSkullSplitterInformed(bool);
|
||||
break;
|
||||
|
||||
case TREE_FELLER:
|
||||
PP.setTreeFellerInformed(bool);
|
||||
break;
|
||||
|
||||
case SERRATED_STRIKES:
|
||||
PP.setSerratedStrikesInformed(bool);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the permissions for this ability.
|
||||
*
|
||||
* @param player Player to check permissions for
|
||||
* @return true if the player has permissions, false otherwise
|
||||
*/
|
||||
public boolean getPermissions(Player player) {
|
||||
switch (this) {
|
||||
case BERSERK:
|
||||
return mcPermissions.getInstance().berserk(player);
|
||||
|
||||
case BLAST_MINING:
|
||||
return mcPermissions.getInstance().blastMining(player);
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return mcPermissions.getInstance().gigaDrillBreaker(player);
|
||||
|
||||
case GREEN_TERRA:
|
||||
return mcPermissions.getInstance().greenTerra(player);
|
||||
|
||||
case LEAF_BLOWER:
|
||||
return mcPermissions.getInstance().leafBlower(player);
|
||||
|
||||
case SERRATED_STRIKES:
|
||||
return mcPermissions.getInstance().serratedStrikes(player);
|
||||
|
||||
case SKULL_SPLIITER:
|
||||
return mcPermissions.getInstance().skullSplitter(player);
|
||||
|
||||
case SUPER_BREAKER:
|
||||
return mcPermissions.getInstance().superBreaker(player);
|
||||
|
||||
case TREE_FELLER:
|
||||
return mcPermissions.getInstance().treeFeller(player);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a block is affected by this ability.
|
||||
*
|
||||
* @param material The block type to check
|
||||
* @return true if the block is affected by this ability, false otherwise
|
||||
*/
|
||||
public boolean blockCheck(Material material) {
|
||||
switch (this) {
|
||||
case BERSERK:
|
||||
return (Excavation.canBeGigaDrillBroken(material) || material.equals(Material.SNOW));
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return Excavation.canBeGigaDrillBroken(material);
|
||||
|
||||
case GREEN_TERRA:
|
||||
return Herbalism.makeMossy(material);
|
||||
|
||||
case LEAF_BLOWER:
|
||||
return material.equals(Material.LEAVES);
|
||||
|
||||
case SUPER_BREAKER:
|
||||
return Mining.canBeSuperBroken(material);
|
||||
|
||||
case TREE_FELLER:
|
||||
return material.equals(Material.LOG);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
public enum DatabaseUpdate {
|
||||
FISHING,
|
||||
BLAST_MINING;
|
||||
}
|
||||
@@ -1,25 +1,8 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
public enum HUDType
|
||||
{
|
||||
DISABLED,
|
||||
STANDARD,
|
||||
SMALL,
|
||||
RETRO;
|
||||
public enum HUDType {
|
||||
DISABLED,
|
||||
STANDARD,
|
||||
SMALL,
|
||||
RETRO;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -252,7 +236,7 @@ public class HUDmmo
|
||||
((GenericTexture) xpicon).setUrl(m.getCapitalized(theType.toString())+".png");
|
||||
xpicon.setDirty(true);
|
||||
|
||||
((GenericTexture) xpbar).setUrl(SpoutStuff.getUrlBar(SpoutStuff.getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.STANDARD)));
|
||||
((GenericTexture) xpbar).setUrl(getUrlBar(getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.STANDARD)));
|
||||
xpbar.setDirty(true);
|
||||
|
||||
SpoutManager.getPlayer(player).getMainScreen().setDirty(true);
|
||||
@@ -272,16 +256,82 @@ public class HUDmmo
|
||||
if(theType == null)
|
||||
return;
|
||||
|
||||
Color color = SpoutStuff.getRetroColor(theType);
|
||||
Color color = getRetroColor(theType);
|
||||
|
||||
if(xpicon != null && theType != null)
|
||||
xpicon.setUrl(m.getCapitalized(theType.toString())+"_r.png");
|
||||
|
||||
if(theType != null)
|
||||
xpfill.setBottomColor(color).setTopColor(color).setWidth(SpoutStuff.getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.RETRO)).setDirty(true);
|
||||
xpfill.setBottomColor(color).setTopColor(color).setWidth(getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.RETRO)).setDirty(true);
|
||||
else
|
||||
System.out.println("theType was null!");
|
||||
|
||||
SpoutManager.getPlayer(player).getMainScreen().setDirty(true);
|
||||
}
|
||||
|
||||
private static Color getRetroColor(SkillType type) {
|
||||
switch (type) {
|
||||
case ACROBATICS:
|
||||
return new Color((float) LoadProperties.acrobatics_r, (float) LoadProperties.acrobatics_g, (float) LoadProperties.acrobatics_b, 1f);
|
||||
case ARCHERY:
|
||||
return new Color((float) LoadProperties.archery_r, (float)LoadProperties.archery_g, (float)LoadProperties.archery_b, 1f);
|
||||
case AXES:
|
||||
return new Color((float) LoadProperties.axes_r, (float)LoadProperties.axes_g, (float)LoadProperties.axes_b, 1f);
|
||||
case EXCAVATION:
|
||||
return new Color((float)LoadProperties.excavation_r, (float)LoadProperties.excavation_g, (float)LoadProperties.excavation_b, 1f);
|
||||
case HERBALISM:
|
||||
return new Color((float)LoadProperties.herbalism_r, (float)LoadProperties.herbalism_g, (float)LoadProperties.herbalism_b, 1f);
|
||||
case MINING:
|
||||
return new Color((float)LoadProperties.mining_r, (float)LoadProperties.mining_g, (float)LoadProperties.mining_b, 1f);
|
||||
case REPAIR:
|
||||
return new Color((float)LoadProperties.repair_r, (float)LoadProperties.repair_g, (float)LoadProperties.repair_b, 1f);
|
||||
case SWORDS:
|
||||
return new Color((float)LoadProperties.swords_r, (float)LoadProperties.swords_g, (float)LoadProperties.swords_b, 1f);
|
||||
case TAMING:
|
||||
return new Color((float)LoadProperties.taming_r, (float)LoadProperties.taming_g, (float)LoadProperties.taming_b, 1f);
|
||||
case UNARMED:
|
||||
return new Color((float)LoadProperties.unarmed_r, (float)LoadProperties.unarmed_g, (float)LoadProperties.unarmed_b, 1f);
|
||||
case WOODCUTTING:
|
||||
return new Color((float)LoadProperties.woodcutting_r, (float)LoadProperties.woodcutting_g, (float)LoadProperties.woodcutting_b, 1f);
|
||||
case FISHING:
|
||||
return new Color((float)LoadProperties.fishing_r, (float)LoadProperties.fishing_g, (float)LoadProperties.fishing_b, 1f);
|
||||
default:
|
||||
return new Color(0.3f, 0.3f, 0.75f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getUrlBar(Integer number) {
|
||||
char[] num = number.toString().toCharArray();
|
||||
|
||||
switch (num.length) {
|
||||
case 1:
|
||||
return "xpbar_inc00"+number+".png";
|
||||
|
||||
case 2:
|
||||
return "xpbar_inc0"+number+".png";
|
||||
|
||||
default:
|
||||
return "xpbar_inc"+number+".png";
|
||||
}
|
||||
}
|
||||
|
||||
private static Integer getXpInc(int skillxp, int xptolevel, HUDType hud) {
|
||||
double percentage = (double) skillxp / xptolevel;
|
||||
double inc;
|
||||
|
||||
switch (hud) {
|
||||
case RETRO:
|
||||
inc = 0.0079365079365079;
|
||||
break;
|
||||
|
||||
case STANDARD:
|
||||
inc = 0.0039370078740157;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (int) (percentage / inc);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -22,8 +6,6 @@ import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
@@ -37,8 +19,6 @@ import com.gmail.nossr50.mcMMO;
|
||||
|
||||
public class PlayerProfile
|
||||
{
|
||||
protected final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
//HUD
|
||||
private HUDType hud;
|
||||
|
||||
@@ -46,8 +26,8 @@ public class PlayerProfile
|
||||
private String party, invite;
|
||||
|
||||
//TOGGLES
|
||||
private boolean loaded = false, partyhud = true, spoutcraft = false, filling = false, xpbarlocked = false, placedAnvil = false, partyChatMode = false, adminChatMode = false, godMode = false, greenTerraMode, partyChatOnly = false, greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true,
|
||||
superBreakerInformed = true, blastMiningInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode,
|
||||
private boolean loaded = false, partyhud = true, spoutcraft = false, xpbarlocked = false, placedAnvil = false, partyChatMode = false, adminChatMode = false, godMode = false, greenTerraMode, partyChatOnly = false, greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true,
|
||||
superBreakerInformed = true, blastMiningInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode,
|
||||
serratedStrikesMode, hoePreparationMode = false, shovelPreparationMode = false, swordsPreparationMode = false, fistsPreparationMode = false, pickaxePreparationMode = false, axePreparationMode = false, skullSplitterMode, berserkMode;
|
||||
|
||||
//TIMESTAMPS
|
||||
@@ -145,15 +125,15 @@ public class PlayerProfile
|
||||
public boolean loadMySQL()
|
||||
{
|
||||
Integer id = 0;
|
||||
id = mcMMO.database.GetInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'");
|
||||
id = mcMMO.database.getInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'");
|
||||
if(id == 0)
|
||||
return false;
|
||||
this.userid = id;
|
||||
if (id > 0) {
|
||||
HashMap<Integer, ArrayList<String>> huds = mcMMO.database.Read("SELECT hudtype FROM "+LoadProperties.MySQLtablePrefix+"huds WHERE user_id = " + id);
|
||||
HashMap<Integer, ArrayList<String>> huds = mcMMO.database.read("SELECT hudtype FROM "+LoadProperties.MySQLtablePrefix+"huds WHERE user_id = " + id);
|
||||
if(huds.get(1) == null)
|
||||
{
|
||||
mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"huds (user_id) VALUES ("+id+")");
|
||||
mcMMO.database.write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"huds (user_id) VALUES ("+id+")");
|
||||
} else {
|
||||
if(huds.get(1).get(0) != null)
|
||||
{
|
||||
@@ -168,17 +148,17 @@ public class PlayerProfile
|
||||
hud = LoadProperties.defaulthud;
|
||||
}
|
||||
}
|
||||
HashMap<Integer, ArrayList<String>> users = mcMMO.database.Read("SELECT lastlogin, party FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = " + id);
|
||||
HashMap<Integer, ArrayList<String>> users = mcMMO.database.read("SELECT lastlogin, party FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = " + id);
|
||||
//lastlogin = Integer.parseInt(users.get(1).get(0));
|
||||
party = users.get(1).get(1);
|
||||
HashMap<Integer, ArrayList<String>> cooldowns = mcMMO.database.Read("SELECT mining, woodcutting, unarmed, herbalism, excavation, swords, axes, blast_mining FROM "+LoadProperties.MySQLtablePrefix+"cooldowns WHERE user_id = " + id);
|
||||
HashMap<Integer, ArrayList<String>> cooldowns = mcMMO.database.read("SELECT mining, woodcutting, unarmed, herbalism, excavation, swords, axes, blast_mining FROM "+LoadProperties.MySQLtablePrefix+"cooldowns WHERE user_id = " + id);
|
||||
/*
|
||||
* I'm still learning MySQL, this is a fix for adding a new table
|
||||
* its not pretty but it works
|
||||
*/
|
||||
if(cooldowns.get(1) == null)
|
||||
{
|
||||
mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"cooldowns (user_id) VALUES ("+id+")");
|
||||
mcMMO.database.write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"cooldowns (user_id) VALUES ("+id+")");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -191,7 +171,7 @@ public class PlayerProfile
|
||||
skillsDATS.put(AbilityType.SKULL_SPLIITER, Integer.valueOf(cooldowns.get(1).get(6)));
|
||||
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(cooldowns.get(1).get(7)));
|
||||
}
|
||||
HashMap<Integer, ArrayList<String>> stats = mcMMO.database.Read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM "+LoadProperties.MySQLtablePrefix+"skills WHERE user_id = " + id);
|
||||
HashMap<Integer, ArrayList<String>> stats = mcMMO.database.read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM "+LoadProperties.MySQLtablePrefix+"skills WHERE user_id = " + id);
|
||||
skills.put(SkillType.TAMING, Integer.valueOf(stats.get(1).get(0)));
|
||||
skills.put(SkillType.MINING, Integer.valueOf(stats.get(1).get(1)));
|
||||
skills.put(SkillType.REPAIR, Integer.valueOf(stats.get(1).get(2)));
|
||||
@@ -204,7 +184,7 @@ public class PlayerProfile
|
||||
skills.put(SkillType.AXES, Integer.valueOf(stats.get(1).get(9)));
|
||||
skills.put(SkillType.ACROBATICS, Integer.valueOf(stats.get(1).get(10)));
|
||||
skills.put(SkillType.FISHING, Integer.valueOf(stats.get(1).get(11)));
|
||||
HashMap<Integer, ArrayList<String>> experience = mcMMO.database.Read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM "+LoadProperties.MySQLtablePrefix+"experience WHERE user_id = " + id);
|
||||
HashMap<Integer, ArrayList<String>> experience = mcMMO.database.read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM "+LoadProperties.MySQLtablePrefix+"experience WHERE user_id = " + id);
|
||||
skillsXp.put(SkillType.TAMING, Integer.valueOf(experience.get(1).get(0)));
|
||||
skillsXp.put(SkillType.MINING, Integer.valueOf(experience.get(1).get(1)));
|
||||
skillsXp.put(SkillType.REPAIR, Integer.valueOf(experience.get(1).get(2)));
|
||||
@@ -226,11 +206,11 @@ public class PlayerProfile
|
||||
}
|
||||
public void addMySQLPlayer() {
|
||||
Integer id = 0;
|
||||
mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"users (user, lastlogin) VALUES ('" + playerName + "'," + System.currentTimeMillis() / 1000 +")");
|
||||
id = mcMMO.database.GetInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'");
|
||||
mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"cooldowns (user_id) VALUES ("+id+")");
|
||||
mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"skills (user_id) VALUES ("+id+")");
|
||||
mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"experience (user_id) VALUES ("+id+")");
|
||||
mcMMO.database.write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"users (user, lastlogin) VALUES ('" + playerName + "'," + System.currentTimeMillis() / 1000 +")");
|
||||
id = mcMMO.database.getInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'");
|
||||
mcMMO.database.write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"cooldowns (user_id) VALUES ("+id+")");
|
||||
mcMMO.database.write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"skills (user_id) VALUES ("+id+")");
|
||||
mcMMO.database.write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"experience (user_id) VALUES ("+id+")");
|
||||
this.userid = id;
|
||||
}
|
||||
|
||||
@@ -333,8 +313,7 @@ public class PlayerProfile
|
||||
}
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Exception while reading "
|
||||
+ location + " (Are you sure you formatted it correctly?)", e);
|
||||
Bukkit.getLogger().severe("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -345,11 +324,11 @@ public class PlayerProfile
|
||||
// if we are using mysql save to database
|
||||
if (LoadProperties.useMySQL)
|
||||
{
|
||||
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"huds SET "
|
||||
mcMMO.database.write("UPDATE "+LoadProperties.MySQLtablePrefix+"huds SET "
|
||||
+" hudtype = '"+hud.toString()+"' WHERE user_id = "+this.userid);
|
||||
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET lastlogin = " + timestamp.intValue() + " WHERE id = " + this.userid);
|
||||
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET party = '"+this.party+"' WHERE id = " +this.userid);
|
||||
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"cooldowns SET "
|
||||
mcMMO.database.write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET lastlogin = " + timestamp.intValue() + " WHERE id = " + this.userid);
|
||||
mcMMO.database.write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET party = '"+this.party+"' WHERE id = " +this.userid);
|
||||
mcMMO.database.write("UPDATE "+LoadProperties.MySQLtablePrefix+"cooldowns SET "
|
||||
+" mining = " + skillsDATS.get(AbilityType.SUPER_BREAKER)
|
||||
+", woodcutting = " + skillsDATS.get(AbilityType.TREE_FELLER)
|
||||
+", unarmed = " + skillsDATS.get(AbilityType.BERSERK)
|
||||
@@ -359,7 +338,7 @@ public class PlayerProfile
|
||||
+", axes = " + skillsDATS.get(AbilityType.SKULL_SPLIITER)
|
||||
+", blast_mining = " + skillsDATS.get(AbilityType.BLAST_MINING)
|
||||
+" WHERE user_id = "+this.userid);
|
||||
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"skills SET "
|
||||
mcMMO.database.write("UPDATE "+LoadProperties.MySQLtablePrefix+"skills SET "
|
||||
+" taming = "+skills.get(SkillType.TAMING)
|
||||
+", mining = "+skills.get(SkillType.MINING)
|
||||
+", repair = "+skills.get(SkillType.REPAIR)
|
||||
@@ -373,7 +352,7 @@ public class PlayerProfile
|
||||
+", acrobatics = "+skills.get(SkillType.ACROBATICS)
|
||||
+", fishing = "+skills.get(SkillType.FISHING)
|
||||
+" WHERE user_id = "+this.userid);
|
||||
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"experience SET "
|
||||
mcMMO.database.write("UPDATE "+LoadProperties.MySQLtablePrefix+"experience SET "
|
||||
+" taming = "+skillsXp.get(SkillType.TAMING)
|
||||
+", mining = "+skillsXp.get(SkillType.MINING)
|
||||
+", repair = "+skillsXp.get(SkillType.REPAIR)
|
||||
@@ -456,7 +435,7 @@ public class PlayerProfile
|
||||
out.write(writer.toString());
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e);
|
||||
Bukkit.getLogger().severe("Exception while writing to " + location + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -534,7 +513,7 @@ public class PlayerProfile
|
||||
out.newLine();
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e);
|
||||
Bukkit.getLogger().severe("Exception while writing to " + location + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
}
|
||||
public void togglePartyHUD()
|
||||
@@ -553,15 +532,6 @@ public class PlayerProfile
|
||||
{
|
||||
spoutcraft = !spoutcraft;
|
||||
}
|
||||
|
||||
public boolean isFilling()
|
||||
{
|
||||
return filling;
|
||||
}
|
||||
public void toggleFilling()
|
||||
{
|
||||
filling = !filling;
|
||||
}
|
||||
public HUDType getHUDType()
|
||||
{
|
||||
return hud;
|
||||
@@ -1119,6 +1089,7 @@ public class PlayerProfile
|
||||
skills.put(skillType, newvalue);
|
||||
skillsXp.put(skillType, 0);
|
||||
}
|
||||
save(); //This will make mctop update for MySQL
|
||||
}
|
||||
|
||||
public void addLevels(SkillType skillType, int levels)
|
||||
@@ -1191,10 +1162,6 @@ public class PlayerProfile
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDead(){
|
||||
return dead;
|
||||
}
|
||||
|
||||
public String getPlayerName()
|
||||
{
|
||||
return playerName;
|
||||
|
||||
@@ -1,23 +1,6 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
public class PlayerStat
|
||||
{
|
||||
public String name;
|
||||
public int statVal = 0;
|
||||
public class PlayerStat {
|
||||
public String name;
|
||||
public int statVal = 0;
|
||||
}
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.gmail.nossr50.datatypes;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.ItemChecks;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public enum ToolType
|
||||
@@ -129,17 +129,17 @@ public enum ToolType
|
||||
switch(this)
|
||||
{
|
||||
case AXE:
|
||||
return m.isAxes(is);
|
||||
return ItemChecks.isAxe(is);
|
||||
case FISTS:
|
||||
return is.getType().equals(Material.AIR);
|
||||
case HOE:
|
||||
return m.isHoe(is);
|
||||
return ItemChecks.isHoe(is);
|
||||
case PICKAXE:
|
||||
return m.isMiningPick(is);
|
||||
return ItemChecks.isMiningPick(is);
|
||||
case SHOVEL:
|
||||
return m.isShovel(is);
|
||||
return ItemChecks.isShovel(is);
|
||||
case SWORD:
|
||||
return m.isSwords(is);
|
||||
return ItemChecks.isSword(is);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -22,34 +6,49 @@ import com.gmail.nossr50.datatypes.PlayerStat;
|
||||
|
||||
public class Tree {
|
||||
|
||||
TreeNode root = null;
|
||||
private TreeNode root = null;
|
||||
|
||||
public Tree(){}
|
||||
public Tree(){}
|
||||
|
||||
public void add(String p, int in)
|
||||
{
|
||||
if(root == null){
|
||||
root = new TreeNode(p, in);
|
||||
}
|
||||
else
|
||||
root.add(p,in);
|
||||
}
|
||||
|
||||
public PlayerStat[] inOrder()
|
||||
{
|
||||
if(root != null){
|
||||
ArrayList<PlayerStat> order = root.inOrder(new ArrayList<PlayerStat>());
|
||||
return order.toArray(new PlayerStat[order.size()]);
|
||||
} else {
|
||||
//Throw some dummy info in case the users file is empty
|
||||
//It's not a good fix but its better than rewriting the whole system
|
||||
ArrayList<PlayerStat> x = new ArrayList<PlayerStat>();
|
||||
PlayerStat y = new PlayerStat();
|
||||
y.name = "$mcMMO_DummyInfo";
|
||||
y.statVal = 0;
|
||||
x.add(y);
|
||||
return x.toArray(new PlayerStat[x.size()]);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add a node to this tree.
|
||||
*
|
||||
* @param p Player name
|
||||
* @param in Stat value
|
||||
*/
|
||||
public void add(String p, int in) {
|
||||
if (root == null) {
|
||||
root = new TreeNode(p, in);
|
||||
}
|
||||
else {
|
||||
root.add(p, in);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve an array of PlayerStats from the Tree.
|
||||
*
|
||||
* @return the player stats of this tree, in order
|
||||
*/
|
||||
public PlayerStat[] inOrder() {
|
||||
if (root != null) {
|
||||
ArrayList<PlayerStat> order = root.inOrder(new ArrayList<PlayerStat>());
|
||||
|
||||
return order.toArray(new PlayerStat[order.size()]);
|
||||
}
|
||||
else {
|
||||
|
||||
/* Throw some dummy info in case the users file is empty.
|
||||
* It's not a good fix but its better than rewriting the whole system.
|
||||
*/
|
||||
ArrayList<PlayerStat> x = new ArrayList<PlayerStat>();
|
||||
PlayerStat y = new PlayerStat();
|
||||
|
||||
y.name = "$mcMMO_DummyInfo";
|
||||
y.statVal = 0;
|
||||
x.add(y);
|
||||
|
||||
return x.toArray(new PlayerStat[x.size()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.datatypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.datatypes.buttons;
|
||||
|
||||
import org.getspout.spoutapi.gui.GenericButton;
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.datatypes.buttons;
|
||||
|
||||
import org.getspout.spoutapi.gui.GenericButton;
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.datatypes.buttons;
|
||||
|
||||
import org.getspout.spoutapi.gui.GenericButton;
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.datatypes.popups;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
@@ -1,28 +1,15 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.events;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class FakeBlockBreakEvent extends BlockBreakEvent {
|
||||
|
||||
public FakeBlockBreakEvent(Block theBlock, Player player) {
|
||||
super(theBlock, player);
|
||||
super(theBlock, player, new ArrayList<ItemStack>(theBlock.getDrops()));
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.events;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -1,354 +1,332 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.BlockChecks;
|
||||
import com.gmail.nossr50.ItemChecks;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.datatypes.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.skills.Excavation;
|
||||
import com.gmail.nossr50.skills.Herbalism;
|
||||
import com.gmail.nossr50.skills.Mining;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
import com.gmail.nossr50.skills.WoodCutting;
|
||||
import com.gmail.nossr50.spout.SpoutSounds;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.CropState;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
import org.getspout.spoutapi.sound.SoundEffect;
|
||||
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.*;
|
||||
import com.gmail.nossr50.events.FakeBlockBreakEvent;
|
||||
|
||||
public class mcBlockListener implements Listener
|
||||
{
|
||||
public class mcBlockListener implements Listener {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public mcBlockListener(final mcMMO plugin)
|
||||
{
|
||||
public mcBlockListener(final mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
//Setup some basic variables
|
||||
Block block;
|
||||
Player player = event.getPlayer();
|
||||
|
||||
//When blocks are placed on snow this event reports the wrong block.
|
||||
if (event.getBlockReplacedState() != null && event.getBlockReplacedState().getTypeId() == 78)
|
||||
block = event.getBlockAgainst();
|
||||
else
|
||||
block = event.getBlock();
|
||||
|
||||
int id = block.getTypeId();
|
||||
Material mat = block.getType();
|
||||
|
||||
//TNT placement checks - needed for Blast Mining
|
||||
if(id == 46 && mcPermissions.getInstance().blastMining(player))
|
||||
plugin.misc.tntTracker.put(block.getLocation(), player);
|
||||
|
||||
//Check if the blocks placed should be monitored so they do not give out XP in the future
|
||||
if(m.shouldBeWatched(mat))
|
||||
{
|
||||
//Only needed for blocks that use their block data (wood, pumpkins, etc.)
|
||||
boolean shouldBeChanged = true;
|
||||
|
||||
switch(mat)
|
||||
{
|
||||
case CACTUS:
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case JACK_O_LANTERN:
|
||||
case LOG:
|
||||
case PUMPKIN:
|
||||
case REDSTONE_ORE:
|
||||
case SUGAR_CANE_BLOCK:
|
||||
case VINE:
|
||||
shouldBeChanged = false; //We don't want these added to changeQueue
|
||||
plugin.misc.blockWatchList.add(block);
|
||||
break;
|
||||
case BROWN_MUSHROOM:
|
||||
case RED_MUSHROOM:
|
||||
case RED_ROSE:
|
||||
case YELLOW_FLOWER:
|
||||
case WATER_LILY:
|
||||
plugin.fastChangeQueue.push(block);
|
||||
break;
|
||||
}
|
||||
|
||||
if(shouldBeChanged)
|
||||
plugin.changeQueue.push(block);
|
||||
}
|
||||
|
||||
if(id == LoadProperties.anvilID && LoadProperties.anvilmessages)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(!PP.getPlacedAnvil())
|
||||
{
|
||||
if(LoadProperties.spoutEnabled)
|
||||
{
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||
if(sPlayer.isSpoutCraftEnabled())
|
||||
sPlayer.sendNotification("[mcMMO] Anvil Placed", "Right click to repair!", Material.IRON_BLOCK);
|
||||
}
|
||||
else
|
||||
event.getPlayer().sendMessage(mcLocale.getString("mcBlockListener.PlacedAnvil")); //$NON-NLS-1$
|
||||
|
||||
PP.togglePlacedAnvil();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
Block block = event.getBlock();
|
||||
int id = block.getTypeId();
|
||||
ItemStack inhand = player.getItemInHand();
|
||||
|
||||
if(event instanceof FakeBlockBreakEvent)
|
||||
return;
|
||||
|
||||
/*
|
||||
* HERBALISM
|
||||
*/
|
||||
|
||||
//Green Terra
|
||||
if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalismAbility(player) && ((id == 59 && block.getData() == (byte) 0x07) || Herbalism.canBeGreenTerra(block)))
|
||||
Skills.abilityCheck(player, SkillType.HERBALISM);
|
||||
|
||||
//Wheat && Triple drops
|
||||
if(PP.getGreenTerraMode() && Herbalism.canBeGreenTerra(block))
|
||||
Herbalism.herbalismProcCheck(block, player, event, plugin);
|
||||
|
||||
if(mcPermissions.getInstance().herbalism(player) && block.getData() != (byte) 5)
|
||||
Herbalism.herbalismProcCheck(block, player, event, plugin);
|
||||
|
||||
/*
|
||||
* MINING
|
||||
*/
|
||||
//TNT removal checks - needed for Blast Mining
|
||||
if(id == 46 && plugin.misc.tntTracker.containsKey(block.getLocation()))
|
||||
plugin.misc.tntTracker.remove(block.getLocation());
|
||||
|
||||
if(mcPermissions.getInstance().mining(player))
|
||||
{
|
||||
if(LoadProperties.miningrequirespickaxe && m.isMiningPick(inhand))
|
||||
Mining.miningBlockCheck(player, block, plugin);
|
||||
else if(!LoadProperties.miningrequirespickaxe)
|
||||
Mining.miningBlockCheck(player, block, plugin);
|
||||
}
|
||||
|
||||
/*
|
||||
* WOOD CUTTING
|
||||
*/
|
||||
|
||||
if(mcPermissions.getInstance().woodcutting(player) && id == 17)
|
||||
{
|
||||
if(LoadProperties.woodcuttingrequiresaxe && m.isAxes(inhand))
|
||||
WoodCutting.woodcuttingBlockCheck(player, block, plugin);
|
||||
else if(!LoadProperties.woodcuttingrequiresaxe)
|
||||
WoodCutting.woodcuttingBlockCheck(player, block, plugin);
|
||||
|
||||
if(PP.getTreeFellerMode())
|
||||
WoodCutting.treeFeller(event, plugin);
|
||||
}
|
||||
|
||||
/*
|
||||
* EXCAVATION
|
||||
*/
|
||||
if(Excavation.canBeGigaDrillBroken(block) && mcPermissions.getInstance().excavation(player) && block.getData() != (byte) 5)
|
||||
{
|
||||
if(LoadProperties.excavationRequiresShovel && m.isShovel(inhand))
|
||||
Excavation.excavationProcCheck(block, player);
|
||||
else if(!LoadProperties.excavationRequiresShovel)
|
||||
Excavation.excavationProcCheck(block, player);
|
||||
}
|
||||
|
||||
//Change the byte back when broken
|
||||
if(block.getData() == 5 && m.shouldBeWatched(block.getType()))
|
||||
{
|
||||
block.setData((byte) 0);
|
||||
if(plugin.misc.blockWatchList.contains(block))
|
||||
{
|
||||
plugin.misc.blockWatchList.remove(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Monitor BlockPistonExtend events.
|
||||
*
|
||||
* @param event The event to monitor
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
||||
List<Block> blocks = event.getBlocks();
|
||||
BlockFace direction = event.getDirection();
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockDamage(BlockDamageEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
ItemStack inhand = player.getItemInHand();
|
||||
Block block = event.getBlock();
|
||||
int id = block.getTypeId();
|
||||
|
||||
/*
|
||||
* ABILITY PREPARATION CHECKS
|
||||
*/
|
||||
if(m.abilityBlockCheck(block))
|
||||
{
|
||||
if(PP.getHoePreparationMode() && Herbalism.canBeGreenTerra(block))
|
||||
Skills.abilityCheck(player, SkillType.HERBALISM);
|
||||
if(PP.getAxePreparationMode() && id == 17 && mcPermissions.getInstance().woodCuttingAbility(player))
|
||||
Skills.abilityCheck(player, SkillType.WOODCUTTING);
|
||||
if(PP.getPickaxePreparationMode() && Mining.canBeSuperBroken(block))
|
||||
Skills.abilityCheck(player, SkillType.MINING);
|
||||
if(PP.getShovelPreparationMode() && Excavation.canBeGigaDrillBroken(block))
|
||||
Skills.abilityCheck(player, SkillType.EXCAVATION);
|
||||
}
|
||||
|
||||
if(PP.getFistsPreparationMode() && (Excavation.canBeGigaDrillBroken(block) || id == 78))
|
||||
Skills.abilityCheck(player, SkillType.UNARMED);
|
||||
|
||||
/*
|
||||
* TREE FELLER STUFF
|
||||
*/
|
||||
if(LoadProperties.spoutEnabled && id == 17 && PP.getTreeFellerMode())
|
||||
SpoutStuff.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
|
||||
|
||||
/*
|
||||
* GREEN TERRA STUFF
|
||||
*/
|
||||
if(PP.getGreenTerraMode() && mcPermissions.getInstance().herbalismAbility(player))
|
||||
Herbalism.greenTerra(player, block);
|
||||
|
||||
/*
|
||||
* GIGA DRILL BREAKER CHECKS
|
||||
*/
|
||||
if(PP.getGigaDrillBreakerMode() && Excavation.canBeGigaDrillBroken(block) && m.blockBreakSimulate(block, player, true) && mcPermissions.getInstance().excavationAbility(player))
|
||||
{
|
||||
if(LoadProperties.excavationRequiresShovel && m.isShovel(inhand))
|
||||
{
|
||||
event.setInstaBreak(true);
|
||||
Excavation.gigaDrillBreaker(player, block);
|
||||
}
|
||||
else if(!LoadProperties.excavationRequiresShovel){
|
||||
|
||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||
{
|
||||
if(!inhand.containsEnchantment(Enchantment.DURABILITY))
|
||||
{
|
||||
short durability = inhand.getDurability();
|
||||
durability += (LoadProperties.abilityDurabilityLoss);
|
||||
inhand.setDurability(durability);
|
||||
}
|
||||
}
|
||||
|
||||
event.setInstaBreak(true);
|
||||
Excavation.gigaDrillBreaker(player, block);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* BERSERK MODE CHECKS
|
||||
*/
|
||||
if(PP.getBerserkMode()
|
||||
&& m.blockBreakSimulate(block, player, true)
|
||||
&& player.getItemInHand().getTypeId() == 0
|
||||
&& (Excavation.canBeGigaDrillBroken(block) || id == 78)
|
||||
&& mcPermissions.getInstance().unarmedAbility(player))
|
||||
{
|
||||
event.setInstaBreak(true);
|
||||
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
}
|
||||
|
||||
/*
|
||||
* SUPER BREAKER CHECKS
|
||||
*/
|
||||
if(PP.getSuperBreakerMode()
|
||||
&& Mining.canBeSuperBroken(block)
|
||||
&& m.blockBreakSimulate(block, player, true)
|
||||
&& mcPermissions.getInstance().miningAbility(player))
|
||||
{
|
||||
if(LoadProperties.miningrequirespickaxe)
|
||||
{
|
||||
if(m.isMiningPick(inhand)){
|
||||
|
||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||
{
|
||||
if(!inhand.containsEnchantment(Enchantment.DURABILITY))
|
||||
{
|
||||
short durability = inhand.getDurability();
|
||||
durability += (LoadProperties.abilityDurabilityLoss);
|
||||
inhand.setDurability(durability);
|
||||
}
|
||||
}
|
||||
|
||||
event.setInstaBreak(true);
|
||||
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
||||
}
|
||||
} else {
|
||||
event.setInstaBreak(true);
|
||||
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* LEAF BLOWER CHECKS
|
||||
*/
|
||||
if(id == 18
|
||||
&& mcPermissions.getInstance().woodCuttingAbility(player)
|
||||
&& PP.getSkillLevel(SkillType.WOODCUTTING) >= 100
|
||||
&& m.blockBreakSimulate(block, player, true))
|
||||
{
|
||||
if(LoadProperties.woodcuttingrequiresaxe)
|
||||
{
|
||||
if(m.isAxes(inhand)){
|
||||
event.setInstaBreak(true);
|
||||
WoodCutting.leafBlower(player, block);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(inhand.getTypeId() != 359){
|
||||
event.setInstaBreak(true);
|
||||
WoodCutting.leafBlower(player, block);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockFromTo(BlockFromToEvent event)
|
||||
{
|
||||
Block blockFrom = event.getBlock();
|
||||
Block blockTo = event.getToBlock();
|
||||
if(m.shouldBeWatched(blockFrom.getType()) && blockFrom.getData() == (byte)5)
|
||||
{
|
||||
blockTo.setData((byte)5);
|
||||
for (Block b : blocks) {
|
||||
if (b.hasMetadata("mcmmoPlacedBlock")) {
|
||||
b.getRelative(direction).setMetadata("mcmmoNeedsTracking", new FixedMetadataValue(plugin, true));
|
||||
b.removeMetadata("mcmmoPlacedBlock", plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Block b : blocks) {
|
||||
if (b.getRelative(direction).hasMetadata("mcmmoNeedsTracking")) {
|
||||
b.getRelative(direction).setMetadata("mcmmoPlacedBlock", new FixedMetadataValue(plugin, true));
|
||||
b.getRelative(direction).removeMetadata("mcmmoNeedsTracking", plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor BlockPistonRetract events.
|
||||
*
|
||||
* @param event The event to monitor
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||
Block block = event.getRetractLocation().getBlock();
|
||||
|
||||
if (block.hasMetadata("mcmmoPlacedBlock")) {
|
||||
block.removeMetadata("mcmmoPlacedBlock", plugin);
|
||||
event.getBlock().getRelative(event.getDirection()).setMetadata("mcmmoPlacedBlock", new FixedMetadataValue(plugin, true));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor BlockPlace events.
|
||||
*
|
||||
* @param event The event to monitor
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
Block block;
|
||||
Player player = event.getPlayer();
|
||||
|
||||
//When blocks are placed on snow this event reports the wrong block.
|
||||
if (event.getBlockReplacedState() != null && event.getBlockReplacedState().getType().equals(Material.SNOW)) {
|
||||
block = event.getBlockAgainst();
|
||||
}
|
||||
else {
|
||||
block = event.getBlock();
|
||||
}
|
||||
|
||||
int id = block.getTypeId();
|
||||
Material mat = block.getType();
|
||||
|
||||
/* Code to prevent issues with placed falling Sand/Gravel not being tracked */
|
||||
if (mat.equals(Material.SAND) || mat.equals(Material.GRAVEL)) {
|
||||
for (int y = -1; y + block.getY() >= 0; y--) {
|
||||
if (block.getRelative(0, y, 0).getType().equals(Material.AIR)) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
Block newLocation = block.getRelative(0, y+1, 0);
|
||||
newLocation.setMetadata("mcmmoPlacedBlock", new FixedMetadataValue(plugin, true));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
|
||||
if (BlockChecks.shouldBeWatched(mat)) {
|
||||
block.setMetadata("mcmmoPlacedBlock", new FixedMetadataValue(plugin, true));
|
||||
}
|
||||
|
||||
if (id == LoadProperties.anvilID && LoadProperties.anvilmessages) {
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (!PP.getPlacedAnvil()) {
|
||||
if (LoadProperties.spoutEnabled) {
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||
|
||||
if (sPlayer.isSpoutCraftEnabled()) {
|
||||
sPlayer.sendNotification("[mcMMO] Anvil Placed", "Right click to repair!", Material.getMaterial(id));
|
||||
}
|
||||
}
|
||||
else {
|
||||
event.getPlayer().sendMessage(mcLocale.getString("mcBlockListener.PlacedAnvil"));
|
||||
}
|
||||
|
||||
PP.togglePlacedAnvil();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor BlockBreak events.
|
||||
*
|
||||
* @param event The event to monitor
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
Block block = event.getBlock();
|
||||
Material mat = block.getType();
|
||||
ItemStack inhand = player.getItemInHand();
|
||||
|
||||
if(event instanceof FakeBlockBreakEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* HERBALISM
|
||||
*/
|
||||
|
||||
/* Green Terra */
|
||||
if (PP.getHoePreparationMode() && mcPermissions.getInstance().greenTerra(player) && ((mat.equals(Material.CROPS) && block.getData() == CropState.RIPE.getData()) || Herbalism.canBeGreenTerra(mat))) {
|
||||
Skills.abilityCheck(player, SkillType.HERBALISM);
|
||||
}
|
||||
|
||||
/* Triple drops */
|
||||
if (PP.getGreenTerraMode() && Herbalism.canBeGreenTerra(mat)) {
|
||||
Herbalism.herbalismProcCheck(block, player, event, plugin);
|
||||
Herbalism.herbalismProcCheck(block, player, event, plugin); //Called twice for triple drop functionality
|
||||
}
|
||||
|
||||
if (mcPermissions.getInstance().herbalismDoubleDrops(player) && Herbalism.canBeGreenTerra(mat)) {
|
||||
Herbalism.herbalismProcCheck(block, player, event, plugin);
|
||||
}
|
||||
|
||||
/*
|
||||
* MINING
|
||||
*/
|
||||
|
||||
if (mcPermissions.getInstance().mining(player) && Mining.canBeSuperBroken(mat)) {
|
||||
if (LoadProperties.miningrequirespickaxe && ItemChecks.isMiningPick(inhand)) {
|
||||
Mining.miningBlockCheck(player, block);
|
||||
}
|
||||
else if (!LoadProperties.miningrequirespickaxe) {
|
||||
Mining.miningBlockCheck(player, block);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WOOD CUTTING
|
||||
*/
|
||||
|
||||
if (mcPermissions.getInstance().woodcutting(player) && mat.equals(Material.LOG)) {
|
||||
if (LoadProperties.woodcuttingrequiresaxe && ItemChecks.isAxe(inhand)) {
|
||||
WoodCutting.woodcuttingBlockCheck(player, block);
|
||||
}
|
||||
else if (!LoadProperties.woodcuttingrequiresaxe) {
|
||||
WoodCutting.woodcuttingBlockCheck(player, block);
|
||||
}
|
||||
}
|
||||
|
||||
if (PP.getTreeFellerMode() && mcPermissions.getInstance().treeFeller(player)) {
|
||||
WoodCutting.treeFeller(event);
|
||||
}
|
||||
|
||||
/*
|
||||
* EXCAVATION
|
||||
*/
|
||||
|
||||
if (Excavation.canBeGigaDrillBroken(mat) && mcPermissions.getInstance().excavation(player) && !block.hasMetadata("mcmmoPlacedBlock")) {
|
||||
if (LoadProperties.excavationRequiresShovel && ItemChecks.isShovel(inhand)) {
|
||||
Excavation.excavationProcCheck(block, player);
|
||||
}
|
||||
else if (!LoadProperties.excavationRequiresShovel) {
|
||||
Excavation.excavationProcCheck(block, player);
|
||||
}
|
||||
}
|
||||
|
||||
//Remove metadata when broken
|
||||
if (block.hasMetadata("mcmmoPlacedBlock") && BlockChecks.shouldBeWatched(mat)) {
|
||||
block.removeMetadata("mcmmoPlacedBlock", plugin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor BlockDamage events.
|
||||
*
|
||||
* @param event The event to monitor
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockDamage(BlockDamageEvent event) {
|
||||
final int LEAF_BLOWER_LEVEL = 100;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
ItemStack inhand = player.getItemInHand();
|
||||
Block block = event.getBlock();
|
||||
Material mat = block.getType();
|
||||
|
||||
/*
|
||||
* ABILITY PREPARATION CHECKS
|
||||
*/
|
||||
if (BlockChecks.abilityBlockCheck(mat)) {
|
||||
if (PP.getHoePreparationMode() && (Herbalism.canBeGreenTerra(mat) || Herbalism.makeMossy(mat))) {
|
||||
Skills.abilityCheck(player, SkillType.HERBALISM);
|
||||
}
|
||||
else if (PP.getAxePreparationMode() && mat.equals(Material.LOG) && mcPermissions.getInstance().treeFeller(player)) { //Why are we checking the permissions here?
|
||||
Skills.abilityCheck(player, SkillType.WOODCUTTING);
|
||||
}
|
||||
else if (PP.getPickaxePreparationMode() && Mining.canBeSuperBroken(mat)) {
|
||||
Skills.abilityCheck(player, SkillType.MINING);
|
||||
}
|
||||
else if (PP.getShovelPreparationMode() && Excavation.canBeGigaDrillBroken(mat)) {
|
||||
Skills.abilityCheck(player, SkillType.EXCAVATION);
|
||||
}
|
||||
else if (PP.getFistsPreparationMode() && (Excavation.canBeGigaDrillBroken(mat) || mat.equals(Material.SNOW))) {
|
||||
Skills.abilityCheck(player, SkillType.UNARMED);
|
||||
}
|
||||
}
|
||||
|
||||
/* TREE FELLER SOUNDS */
|
||||
if (LoadProperties.spoutEnabled && mat.equals(Material.LOG) && PP.getTreeFellerMode()) {
|
||||
SpoutSounds.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
|
||||
}
|
||||
|
||||
/*
|
||||
* ABILITY TRIGGER CHECKS
|
||||
*/
|
||||
if (PP.getGreenTerraMode() && mcPermissions.getInstance().greenTerra(player) && Herbalism.makeMossy(mat)) {
|
||||
Herbalism.greenTerra(player, block);
|
||||
}
|
||||
else if (PP.getGigaDrillBreakerMode() && Skills.triggerCheck(player, block, AbilityType.GIGA_DRILL_BREAKER)) {
|
||||
if (LoadProperties.excavationRequiresShovel && ItemChecks.isShovel(inhand)) {
|
||||
event.setInstaBreak(true);
|
||||
Excavation.gigaDrillBreaker(player, block);
|
||||
}
|
||||
else if (!LoadProperties.excavationRequiresShovel) {
|
||||
event.setInstaBreak(true);
|
||||
Excavation.gigaDrillBreaker(player, block);
|
||||
}
|
||||
}
|
||||
else if (PP.getBerserkMode() && Skills.triggerCheck(player, block, AbilityType.BERSERK)) {
|
||||
if (inhand.getType().equals(Material.AIR)) {
|
||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
|
||||
event.setInstaBreak(true);
|
||||
}
|
||||
|
||||
if (LoadProperties.spoutEnabled) {
|
||||
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
}
|
||||
}
|
||||
else if (PP.getSuperBreakerMode() && Skills.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) {
|
||||
if (LoadProperties.miningrequirespickaxe && ItemChecks.isMiningPick(inhand)) {
|
||||
event.setInstaBreak(true);
|
||||
Mining.SuperBreakerBlockCheck(player, block);
|
||||
}
|
||||
else if (!LoadProperties.miningrequirespickaxe) {
|
||||
event.setInstaBreak(true);
|
||||
Mining.SuperBreakerBlockCheck(player, block);
|
||||
}
|
||||
}
|
||||
else if (PP.getSkillLevel(SkillType.WOODCUTTING) >= LEAF_BLOWER_LEVEL && mat.equals(Material.LEAVES)) {
|
||||
if (LoadProperties.woodcuttingrequiresaxe && ItemChecks.isAxe(inhand)) {
|
||||
if (Skills.triggerCheck(player, block, AbilityType.LEAF_BLOWER)) {
|
||||
event.setInstaBreak(true);
|
||||
WoodCutting.leafBlower(player, block);
|
||||
}
|
||||
}
|
||||
else if (!LoadProperties.woodcuttingrequiresaxe && !inhand.getType().equals(Material.SHEARS)) {
|
||||
if (Skills.triggerCheck(player, block, AbilityType.LEAF_BLOWER)) {
|
||||
event.setInstaBreak(true);
|
||||
WoodCutting.leafBlower(player, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,5 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@@ -37,6 +20,7 @@ import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityTameEvent;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import com.gmail.nossr50.Combat;
|
||||
import com.gmail.nossr50.Users;
|
||||
@@ -49,277 +33,282 @@ import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.events.FakeEntityDamageByEntityEvent;
|
||||
import com.gmail.nossr50.events.FakeEntityDamageEvent;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.runnables.mcBleedTimer;
|
||||
import com.gmail.nossr50.skills.Acrobatics;
|
||||
import com.gmail.nossr50.skills.Archery;
|
||||
import com.gmail.nossr50.skills.BlastMining;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
import com.gmail.nossr50.skills.Taming;
|
||||
|
||||
|
||||
public class mcEntityListener implements Listener
|
||||
{
|
||||
private final mcMMO plugin;
|
||||
public class mcEntityListener implements Listener {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public mcEntityListener(final mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Monitor EntityDamageByEntity events.
|
||||
*
|
||||
* @param event The event to monitor
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event)
|
||||
{
|
||||
//Lets just put this here...
|
||||
if(event instanceof FakeEntityDamageByEntityEvent)
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
if (event instanceof FakeEntityDamageByEntityEvent) {
|
||||
return;
|
||||
|
||||
Entity defender = event.getEntity();
|
||||
Entity attacker = event.getDamager();
|
||||
|
||||
if(attacker instanceof Player && defender instanceof Player)
|
||||
{
|
||||
if(!defender.getWorld().getPVP())
|
||||
return;
|
||||
if(Party.getInstance().inSameParty((Player)defender, (Player)attacker))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
//Make sure defender is not invincible
|
||||
if(defender instanceof LivingEntity)
|
||||
{
|
||||
LivingEntity livingDefender = (LivingEntity)defender;
|
||||
if(!m.isInvincible(livingDefender, event))
|
||||
Combat.combatChecks(event, plugin);
|
||||
}
|
||||
}
|
||||
|
||||
Entity defender = event.getEntity();
|
||||
Entity attacker = event.getDamager();
|
||||
|
||||
if (attacker instanceof Player && defender instanceof Player) {
|
||||
if (!defender.getWorld().getPVP()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Party.getInstance().inSameParty((Player)defender, (Player)attacker)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for invincibility */
|
||||
if (defender instanceof LivingEntity) {
|
||||
LivingEntity livingDefender = (LivingEntity)defender;
|
||||
|
||||
if (!m.isInvincible(livingDefender, event)) {
|
||||
Combat.combatChecks(event, plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Monitor EntityDamage events.
|
||||
*
|
||||
* @param event The event to monitor
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityDamage(EntityDamageEvent event)
|
||||
{
|
||||
if(event instanceof FakeEntityDamageEvent)
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
if (event instanceof FakeEntityDamageEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
EntityType type = entity.getType();
|
||||
DamageCause cause = event.getCause();
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
EntityType type = entity.getType();
|
||||
DamageCause cause = event.getCause();
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case PLAYER:
|
||||
/*
|
||||
* CHECK FOR INVULNERABILITY
|
||||
*/
|
||||
Player player = (Player) entity;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(PP.getGodMode())
|
||||
event.setCancelled(true);
|
||||
|
||||
if(!m.isInvincible(player, event))
|
||||
{
|
||||
if(cause == DamageCause.FALL && mcPermissions.getInstance().acrobatics(player))
|
||||
Acrobatics.acrobaticsCheck(player, event);
|
||||
if(cause == DamageCause.BLOCK_EXPLOSION && mcPermissions.getInstance().blastMining(player))
|
||||
BlastMining.demolitionsExpertise(player, event);
|
||||
if(event.getDamage() >= 1)
|
||||
PP.setRecentlyHurt(System.currentTimeMillis());
|
||||
}
|
||||
break;
|
||||
case WOLF:
|
||||
Wolf wolf = (Wolf) entity;
|
||||
if((!m.isInvincible(wolf, event)) && wolf.isTamed() && wolf.getOwner() != null)
|
||||
Taming.preventDamage(event, plugin);
|
||||
break;
|
||||
}
|
||||
switch(type) {
|
||||
case PLAYER:
|
||||
|
||||
/* Check for invincibility */
|
||||
Player player = (Player) entity;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (PP.getGodMode()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m.isInvincible(player, event)) {
|
||||
if (cause == DamageCause.FALL && mcPermissions.getInstance().acrobatics(player)) {
|
||||
Acrobatics.acrobaticsCheck(player, event);
|
||||
}
|
||||
else if (cause == DamageCause.BLOCK_EXPLOSION && mcPermissions.getInstance().demolitionsExpertise(player)) {
|
||||
BlastMining.demolitionsExpertise(player, event);
|
||||
}
|
||||
|
||||
if (event.getDamage() >= 1) {
|
||||
PP.setRecentlyHurt(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WOLF:
|
||||
Wolf wolf = (Wolf) entity;
|
||||
|
||||
if ((!m.isInvincible(wolf, event)) && wolf.isTamed() && (wolf.getOwner() instanceof Player)) {
|
||||
Taming.preventDamage(event);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDeath(EntityDeathEvent event)
|
||||
{
|
||||
LivingEntity x = event.getEntity();
|
||||
x.setFireTicks(0);
|
||||
|
||||
//Remove mob from mob spawner list
|
||||
if(plugin.misc.mobSpawnerList.contains(x.getEntityId()))
|
||||
{
|
||||
plugin.misc.mobSpawnerList.remove((Object)x.getEntityId());
|
||||
}
|
||||
|
||||
//Remove bleed track
|
||||
if(plugin.misc.bleedTracker.contains(x))
|
||||
plugin.misc.addToBleedRemovalQue(x);
|
||||
|
||||
Archery.arrowRetrievalCheck(x, plugin);
|
||||
/**
|
||||
* Monitor EntityDeath events.
|
||||
*
|
||||
* @param event The event to monitor
|
||||
*/
|
||||
@EventHandler (priority = EventPriority.MONITOR)
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
LivingEntity x = event.getEntity();
|
||||
x.setFireTicks(0);
|
||||
|
||||
if(x instanceof Player)
|
||||
Users.getProfile((Player)x).setBleedTicks(0);
|
||||
/* Remove bleed track */
|
||||
mcBleedTimer.remove(x);
|
||||
|
||||
Archery.arrowRetrievalCheck(x, plugin);
|
||||
|
||||
if (x instanceof Player) {
|
||||
Users.getProfile((Player)x).setBleedTicks(0);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event)
|
||||
{
|
||||
SpawnReason reason = event.getSpawnReason();
|
||||
|
||||
if(reason == SpawnReason.SPAWNER && !LoadProperties.xpGainsMobSpawners)
|
||||
plugin.misc.mobSpawnerList.add(event.getEntity().getEntityId());
|
||||
/**
|
||||
* Monitor CreatureSpawn events.
|
||||
*
|
||||
* @param event The event to monitor
|
||||
*/
|
||||
@EventHandler (priority = EventPriority.MONITOR)
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
if (event.getSpawnReason().equals(SpawnReason.SPAWNER) && !LoadProperties.xpGainsMobSpawners) {
|
||||
event.getEntity().setMetadata("mcmmoFromMobSpawner", new FixedMetadataValue(plugin, true));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.LOW)
|
||||
public void onExplosionPrime(ExplosionPrimeEvent event)
|
||||
{
|
||||
if(event.getEntity() instanceof TNTPrimed)
|
||||
{
|
||||
Location location = event.getEntity().getLocation();
|
||||
|
||||
//Ugly code to make it recognize the location
|
||||
location.setX(location.getBlockX()+1);
|
||||
location.setY(location.getBlockY());
|
||||
location.setZ(location.getBlockZ()+1);
|
||||
|
||||
if(plugin.misc.tntTracker.containsKey(location))
|
||||
{
|
||||
Player player = plugin.misc.tntTracker.get(location);
|
||||
BlastMining.biggerBombs(player, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.LOW)
|
||||
public void onEnitityExplode(EntityExplodeEvent event)
|
||||
{
|
||||
if(event.getEntity() instanceof TNTPrimed)
|
||||
{
|
||||
Location location = event.getEntity().getLocation();
|
||||
|
||||
//Ugly code to make it recognize the location
|
||||
location.setX(location.getBlockX()+1);
|
||||
location.setY(location.getBlockY());
|
||||
location.setZ(location.getBlockZ()+1);
|
||||
|
||||
if(plugin.misc.tntTracker.containsKey(location))
|
||||
{
|
||||
Player player = plugin.misc.tntTracker.get(location);
|
||||
BlastMining.dropProcessing(player, event, plugin);
|
||||
plugin.misc.tntTracker.remove(location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.LOW)
|
||||
public void onFoodLevelChange(FoodLevelChangeEvent event)
|
||||
{
|
||||
if(LoadProperties.herbalismHungerBonus)
|
||||
{
|
||||
if(event.getEntity() instanceof Player)
|
||||
{
|
||||
Player player = (Player) event.getEntity();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int currentFoodLevel = player.getFoodLevel();
|
||||
int newFoodLevel = event.getFoodLevel();
|
||||
|
||||
//Some foods have 3 ranks
|
||||
//Some foods have 5 ranks
|
||||
//The number of ranks is based on how 'common' the item is
|
||||
//We can adjust this quite easily if we find something is giving too much of a bonus
|
||||
|
||||
if(newFoodLevel > currentFoodLevel)
|
||||
{
|
||||
Material food = player.getItemInHand().getType();
|
||||
int herbLevel = PP.getSkillLevel(SkillType.HERBALISM);
|
||||
int foodChange = newFoodLevel - currentFoodLevel;
|
||||
|
||||
switch(food)
|
||||
{
|
||||
case BREAD:
|
||||
{
|
||||
//BREAD RESTORES 2 1/2 HUNGER
|
||||
//Restores 5 HUNGER @ 1000
|
||||
if(herbLevel >= 200 && herbLevel < 400)
|
||||
foodChange = foodChange + 1;
|
||||
else if(herbLevel >= 400 && herbLevel < 600)
|
||||
foodChange = foodChange + 2;
|
||||
else if(herbLevel >= 600 && herbLevel < 800)
|
||||
foodChange = foodChange + 3;
|
||||
else if(herbLevel >= 800 && herbLevel < 1000)
|
||||
foodChange = foodChange + 4;
|
||||
else if(herbLevel >= 1000)
|
||||
foodChange = foodChange + 5;
|
||||
/**
|
||||
* Monitor ExplosionPrime events.
|
||||
*
|
||||
* @param event The event to monitor
|
||||
*/
|
||||
@EventHandler (priority = EventPriority.LOW)
|
||||
public void onExplosionPrime(ExplosionPrimeEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (entity instanceof TNTPrimed) {
|
||||
int id = entity.getEntityId();
|
||||
|
||||
if (plugin.tntTracker.containsKey(id)) {
|
||||
Player player = plugin.tntTracker.get(id);
|
||||
|
||||
if (mcPermissions.getInstance().biggerBombs(player)) {
|
||||
BlastMining.biggerBombs(player, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor EntityExplode events.
|
||||
*
|
||||
* @param event The event to monitor
|
||||
*/
|
||||
@EventHandler (priority = EventPriority.LOW)
|
||||
public void onEnitityExplode(EntityExplodeEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (event.getEntity() instanceof TNTPrimed) {
|
||||
int id = entity.getEntityId();
|
||||
|
||||
if (plugin.tntTracker.containsKey(id)) {
|
||||
Player player = plugin.tntTracker.get(id);
|
||||
BlastMining.dropProcessing(player, event);
|
||||
plugin.tntTracker.remove(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor FoodLevelChange events.
|
||||
*
|
||||
* @param event The event to monitor
|
||||
*/
|
||||
@EventHandler (priority = EventPriority.LOW)
|
||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||
if (LoadProperties.herbalismHungerBonus) {
|
||||
if (event.getEntity() instanceof Player) {
|
||||
Player player = (Player) event.getEntity();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int currentFoodLevel = player.getFoodLevel();
|
||||
int newFoodLevel = event.getFoodLevel();
|
||||
|
||||
/* Some foods have 3 ranks
|
||||
* Some foods have 5 ranks
|
||||
* The number of ranks is based on how 'common' the item is
|
||||
* We can adjust this quite easily if we find something is giving too much of a bonus
|
||||
*/
|
||||
|
||||
if (newFoodLevel > currentFoodLevel) {
|
||||
Material food = player.getItemInHand().getType();
|
||||
int herbLevel = PP.getSkillLevel(SkillType.HERBALISM);
|
||||
int foodChange = newFoodLevel - currentFoodLevel;
|
||||
int rankChange = 0;
|
||||
|
||||
switch (food) {
|
||||
case BREAD:
|
||||
/* BREAD RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
|
||||
rankChange = 200;
|
||||
break;
|
||||
}
|
||||
case COOKIE:
|
||||
{
|
||||
//COOKIE RESTORES 1/2 HUNGER
|
||||
//RESTORES 2 HUNGER @ 1000
|
||||
if(herbLevel >= 200 && herbLevel < 600)
|
||||
foodChange = foodChange + 1;
|
||||
else if(herbLevel >= 600 && herbLevel < 1000)
|
||||
foodChange = foodChange + 2;
|
||||
else if(herbLevel >= 1000)
|
||||
foodChange = foodChange + 3;
|
||||
|
||||
case COOKIE:
|
||||
/* COOKIE RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||
rankChange = 400;
|
||||
break;
|
||||
}
|
||||
case MELON:
|
||||
{
|
||||
//MELON RESTORES 1 HUNGER
|
||||
//RESTORES 2 1/2 HUNGER @ 1000
|
||||
if(herbLevel >= 200 && herbLevel < 600)
|
||||
foodChange = foodChange + 1;
|
||||
else if(herbLevel >= 600 && herbLevel < 1000)
|
||||
foodChange = foodChange + 2;
|
||||
else if(herbLevel >= 1000)
|
||||
foodChange = foodChange + 3;
|
||||
break;
|
||||
}
|
||||
case MUSHROOM_SOUP:
|
||||
{
|
||||
//MUSHROOM SOUP RESTORES 4 HUNGER
|
||||
//RESTORES 6 1/2 HUNGER @ 1000
|
||||
if(herbLevel >= 200 && herbLevel < 400)
|
||||
foodChange = foodChange + 1;
|
||||
else if(herbLevel >= 400 && herbLevel < 600)
|
||||
foodChange = foodChange + 2;
|
||||
else if(herbLevel >= 600 && herbLevel < 800)
|
||||
foodChange = foodChange + 3;
|
||||
else if(herbLevel >= 800 && herbLevel < 1000)
|
||||
foodChange = foodChange + 4;
|
||||
else if(herbLevel >= 1000)
|
||||
foodChange = foodChange + 5;
|
||||
|
||||
case MELON:
|
||||
/* MELON RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
rankChange = 400;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Make sure we don't go over the max value
|
||||
newFoodLevel = currentFoodLevel + foodChange;
|
||||
if(newFoodLevel > 20)
|
||||
|
||||
case MUSHROOM_SOUP:
|
||||
/* MUSHROOM SOUP RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
|
||||
rankChange = 200;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 200; i <= 1000; i += rankChange) {
|
||||
if (herbLevel >= i) {
|
||||
foodChange++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure we don't go over the max value */
|
||||
newFoodLevel = currentFoodLevel + foodChange;
|
||||
if (newFoodLevel > 20) {
|
||||
event.setFoodLevel(20);
|
||||
if(newFoodLevel <= 20)
|
||||
}
|
||||
else {
|
||||
event.setFoodLevel(newFoodLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.MONITOR)
|
||||
public void onEntityTame(EntityTameEvent event)
|
||||
{
|
||||
Player player = (Player) event.getOwner();
|
||||
if(mcPermissions.getInstance().taming(player))
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
EntityType type = event.getEntityType();
|
||||
int xp = 0;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case WOLF:
|
||||
xp = LoadProperties.mtameWolf;
|
||||
break;
|
||||
/*
|
||||
case OCELOT:
|
||||
xp = LoadProperties.mtameOcelot;
|
||||
break;
|
||||
*/
|
||||
}
|
||||
|
||||
PP.addXP(SkillType.TAMING, xp, player);
|
||||
Skills.XpCheckSkill(SkillType.TAMING, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor EntityTame events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler (priority = EventPriority.MONITOR)
|
||||
public void onEntityTame(EntityTameEvent event) {
|
||||
Player player = (Player) event.getOwner();
|
||||
|
||||
if (mcPermissions.getInstance().taming(player) && !event.getEntity().hasMetadata("mcmmoSummoned")) {
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
EntityType type = event.getEntityType();
|
||||
int xp = 0;
|
||||
|
||||
switch (type) {
|
||||
case WOLF:
|
||||
xp = LoadProperties.mtameWolf;
|
||||
break;
|
||||
|
||||
case OCELOT:
|
||||
xp = LoadProperties.mtameOcelot;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
PP.addXP(SkillType.TAMING, xp, player);
|
||||
Skills.XpCheckSkill(SkillType.TAMING, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +1,11 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -45,314 +22,345 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.BlockChecks;
|
||||
import com.gmail.nossr50.Combat;
|
||||
import com.gmail.nossr50.Item;
|
||||
import com.gmail.nossr50.ItemChecks;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.commands.general.XprateCommand;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.runnables.RemoveProfileFromMemoryTask;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.datatypes.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.skills.BlastMining;
|
||||
import com.gmail.nossr50.skills.Fishing;
|
||||
import com.gmail.nossr50.skills.Herbalism;
|
||||
import com.gmail.nossr50.skills.Repair;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
import com.gmail.nossr50.skills.Taming;
|
||||
|
||||
public class mcPlayerListener implements Listener {
|
||||
private mcMMO plugin;
|
||||
|
||||
public class mcPlayerListener implements Listener
|
||||
{
|
||||
protected static final Logger log = Logger.getLogger("Minecraft"); //$NON-NLS-1$
|
||||
private mcMMO plugin;
|
||||
public mcPlayerListener(mcMMO instance) {
|
||||
plugin = instance;
|
||||
}
|
||||
|
||||
public mcPlayerListener(mcMMO instance)
|
||||
{
|
||||
plugin = instance;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if(PP.getGodMode())
|
||||
{
|
||||
if(!mcPermissions.getInstance().mcgod(player))
|
||||
{
|
||||
PP.toggleGodMode();
|
||||
player.sendMessage("[mcMMO] God Mode not permitted on this world (See Permissions)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerFish(PlayerFishEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if(mcPermissions.getInstance().fishing(player))
|
||||
{
|
||||
State state = event.getState();
|
||||
Entity caught = event.getCaught();
|
||||
if(state== State.CAUGHT_FISH)
|
||||
{
|
||||
if(caught instanceof org.bukkit.entity.Item)
|
||||
Fishing.processResults(event);
|
||||
}
|
||||
else if (state == State.CAUGHT_ENTITY)
|
||||
{
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.FISHING);
|
||||
if(skillLevel >= 150)
|
||||
Fishing.shakeMob(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Monitor PlayerChangedWorld events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerPickupItem(PlayerPickupItemEvent event)
|
||||
{
|
||||
if(Users.getProfile(event.getPlayer()).getBerserkMode())
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerLogin(PlayerLoginEvent event)
|
||||
{
|
||||
Users.addUser(event.getPlayer());
|
||||
}
|
||||
if (PP.getGodMode()) {
|
||||
if (!mcPermissions.getInstance().mcgod(player)) {
|
||||
PP.toggleGodMode();
|
||||
player.sendMessage(mcLocale.getString("GodMode.Forbidden"));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
/*
|
||||
* GARBAGE COLLECTION
|
||||
*/
|
||||
//Discard the PlayerProfile object
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(LoadProperties.spoutEnabled && SpoutStuff.playerHUDs.containsKey(player))
|
||||
SpoutStuff.playerHUDs.remove(player);
|
||||
|
||||
//Bleed it out
|
||||
if(PP.getBleedTicks() > 0)
|
||||
Combat.dealDamage(player, PP.getBleedTicks()*2);
|
||||
|
||||
//Save PlayerData to MySQL/FlatFile on player quit
|
||||
PP.save();
|
||||
|
||||
//Schedule PlayerProfile removal 2 minutes after quitting
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new RemoveProfileFromMemoryTask(player), 2400);
|
||||
}
|
||||
if (PP.inParty()) {
|
||||
if (!mcPermissions.getInstance().party(player)) {
|
||||
PP.removeParty();
|
||||
player.sendMessage(mcLocale.getString("Party.Forbidden"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if(mcPermissions.getInstance().motd(player) && LoadProperties.enableMotd)
|
||||
{
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.MOTD", new Object[] {plugin.getDescription().getVersion(), "mcmmo"}));
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.WIKI"));
|
||||
}
|
||||
//THIS IS VERY BAD WAY TO DO THINGS, NEED BETTER WAY
|
||||
if(XprateCommand.xpevent)
|
||||
player.sendMessage(ChatColor.GOLD+"mcMMO is currently in an XP rate event! XP rate is "+LoadProperties.xpGainMultiplier+"x!");
|
||||
}
|
||||
/**
|
||||
* Monitor PlayerFish events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerFish(PlayerFishEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
Action action = event.getAction();
|
||||
Block block = event.getClickedBlock();
|
||||
ItemStack is = player.getItemInHand();
|
||||
|
||||
/*
|
||||
* Ability checks
|
||||
*/
|
||||
if(action == Action.RIGHT_CLICK_BLOCK)
|
||||
{
|
||||
Material mat = block.getType();
|
||||
if (mcPermissions.getInstance().fishing(player)) {
|
||||
State state = event.getState();
|
||||
|
||||
if(block != null && mcPermissions.getInstance().repair(player) && block.getTypeId() == LoadProperties.anvilID && (Repair.isTools(is) || Repair.isArmor(is)))
|
||||
{
|
||||
Repair.repairCheck(player, is, event.getClickedBlock());
|
||||
event.setCancelled(true);
|
||||
player.updateInventory();
|
||||
}
|
||||
switch (state) {
|
||||
case CAUGHT_FISH:
|
||||
Fishing.processResults(event);
|
||||
break;
|
||||
|
||||
if(LoadProperties.enableAbilities && m.abilityBlockCheck(block))
|
||||
{
|
||||
if(block != null && m.isHoe(is) && !mat.equals(Material.DIRT) && !mat.equals(Material.GRASS) && !mat.equals(Material.SOIL))
|
||||
Skills.activationCheck(player, SkillType.HERBALISM);
|
||||
|
||||
Skills.activationCheck(player, SkillType.AXES);
|
||||
Skills.activationCheck(player, SkillType.EXCAVATION);
|
||||
Skills.activationCheck(player, SkillType.MINING);
|
||||
Skills.activationCheck(player, SkillType.SWORDS);
|
||||
Skills.activationCheck(player, SkillType.UNARMED);
|
||||
Skills.activationCheck(player, SkillType.WOODCUTTING);
|
||||
}
|
||||
|
||||
//GREEN THUMB
|
||||
if(block != null && mcPermissions.getInstance().herbalism(player) && (mat.equals(Material.COBBLESTONE) || mat.equals(Material.DIRT) || mat.equals(Material.SMOOTH_BRICK)) && is.getType().equals(Material.SEEDS))
|
||||
{
|
||||
boolean pass = false;
|
||||
int seeds = is.getAmount();
|
||||
player.setItemInHand(new ItemStack(Material.SEEDS, seeds - 1));
|
||||
|
||||
if(Math.random() * 1500 <= PP.getSkillLevel(SkillType.HERBALISM) && m.blockBreakSimulate(block, player, false))
|
||||
{
|
||||
switch(mat)
|
||||
{
|
||||
case COBBLESTONE:
|
||||
if(LoadProperties.enableCobbleToMossy)
|
||||
{
|
||||
block.setType(Material.MOSSY_COBBLESTONE);
|
||||
pass = true;
|
||||
}
|
||||
break;
|
||||
case DIRT:
|
||||
if(LoadProperties.enableDirtToGrass)
|
||||
{
|
||||
block.setType(Material.GRASS);
|
||||
pass = true;
|
||||
}
|
||||
break;
|
||||
case SMOOTH_BRICK:
|
||||
if(LoadProperties.enableSmoothToMossy)
|
||||
{
|
||||
pass = true;
|
||||
block.setData((byte)1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(pass == false)
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.GreenThumbFail"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(LoadProperties.enableAbilities && action == Action.RIGHT_CLICK_AIR)
|
||||
{
|
||||
Skills.activationCheck(player, SkillType.AXES);
|
||||
Skills.activationCheck(player, SkillType.EXCAVATION);
|
||||
Skills.activationCheck(player, SkillType.HERBALISM);
|
||||
Skills.activationCheck(player, SkillType.MINING);
|
||||
Skills.activationCheck(player, SkillType.SWORDS);
|
||||
Skills.activationCheck(player, SkillType.UNARMED);
|
||||
Skills.activationCheck(player, SkillType.WOODCUTTING);
|
||||
}
|
||||
|
||||
/*
|
||||
* ITEM CHECKS
|
||||
*/
|
||||
if(action == Action.RIGHT_CLICK_AIR)
|
||||
Item.itemchecks(player, plugin);
|
||||
if(action == Action.RIGHT_CLICK_BLOCK && m.abilityBlockCheck(block))
|
||||
Item.itemchecks(player, plugin);
|
||||
|
||||
if(player.isSneaking() && mcPermissions.getInstance().taming(player) && (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK))
|
||||
{
|
||||
if(is.getType().equals(Material.BONE) && is.getAmount() >= LoadProperties.bonesConsumedByCOTW)
|
||||
{
|
||||
for(Entity x : player.getNearbyEntities(40, 40, 40))
|
||||
{
|
||||
if(x instanceof Wolf)
|
||||
{
|
||||
player.sendMessage(mcLocale.getString("m.TamingSummonFailed"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
World world = player.getWorld();
|
||||
world.spawnCreature(player.getLocation(), EntityType.WOLF);
|
||||
|
||||
int bones = is.getAmount();
|
||||
bones = bones - LoadProperties.bonesConsumedByCOTW;
|
||||
player.setItemInHand(new ItemStack(Material.BONE, bones));
|
||||
player.sendMessage(mcLocale.getString("m.TamingSummon"));
|
||||
}
|
||||
}
|
||||
|
||||
//BLAST MINING
|
||||
if((action == Action.RIGHT_CLICK_BLOCK || action == Action.RIGHT_CLICK_AIR) && is.getTypeId() == LoadProperties.detonatorID)
|
||||
{
|
||||
Block b = player.getTargetBlock(null, 100);
|
||||
if(b.getType().equals(Material.TNT) && mcPermissions.getInstance().blastMining(player) && m.blockBreakSimulate(b, player, true) && Users.getProfile(player).getSkillLevel(SkillType.MINING) >= 125)
|
||||
{
|
||||
AbilityType ability = AbilityType.BLAST_MINING;
|
||||
//Check cooldown
|
||||
if(!Skills.cooldownOver(player, (PP.getSkillDATS(ability) * 1000), ability.getCooldown()))
|
||||
{
|
||||
player.sendMessage(mcLocale.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + Skills.calculateTimeLeft(player, (PP.getSkillDATS(ability) * 1000), ability.getCooldown()) + "s)");
|
||||
return;
|
||||
}
|
||||
//Send message to nearby players
|
||||
for(Player y : player.getWorld().getPlayers())
|
||||
{
|
||||
if(y != player && m.isNear(player.getLocation(), y.getLocation(), 10))
|
||||
y.sendMessage(ability.getAbilityPlayer(player));
|
||||
case CAUGHT_ENTITY:
|
||||
if (Users.getProfile(player).getSkillLevel(SkillType.FISHING) >= 150 && mcPermissions.getInstance().shakeMob(player)) {
|
||||
Fishing.shakeMob(event);
|
||||
}
|
||||
|
||||
player.sendMessage(ChatColor.GRAY+"**BOOM**");
|
||||
|
||||
TNTPrimed tnt = player.getWorld().spawn(b.getLocation(), TNTPrimed.class);
|
||||
b.setType(Material.AIR);
|
||||
tnt.setFuseTicks(0);
|
||||
PP.setSkillDATS(ability, System.currentTimeMillis()); //Save DATS for Blast Mining
|
||||
PP.setBlastMiningInformed(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerChat(PlayerChatEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(PP.getPartyChatMode())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
String name = (LoadProperties.pDisplayNames) ? player.getDisplayName() : player.getName();
|
||||
String format = ChatColor.GREEN + "(" + ChatColor.WHITE + name + ChatColor.GREEN + ") "+event.getMessage();
|
||||
for(Player x : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(Party.getInstance().inSameParty(player, x))
|
||||
x.sendMessage(format);
|
||||
}
|
||||
log.log(Level.INFO, "[P](" + PP.getParty() + ")<" + name + ">" + event.getMessage());
|
||||
} else if (PP.getAdminChatMode()) {
|
||||
event.setCancelled(true);
|
||||
String name = (LoadProperties.aDisplayNames) ? player.getDisplayName() : player.getName();
|
||||
String format = ChatColor.AQUA + "{" + ChatColor.WHITE + name + ChatColor.AQUA + "} "+event.getMessage();
|
||||
for(Player x : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(x.isOp() || mcPermissions.getInstance().adminChat(x))
|
||||
x.sendMessage(format);
|
||||
}
|
||||
log.log(Level.INFO, "[A]<" + name + ">" + event.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// Dynamically aliasing commands need to be re-done.
|
||||
// For now, using a command with an alias will send both the original command, and the mcMMO command
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
String message = event.getMessage();
|
||||
if(!message.startsWith("/")) return;
|
||||
String command = message.substring(1).split(" ")[0];
|
||||
if(plugin.aliasMap.containsKey(command)) {
|
||||
if(command.equalsIgnoreCase(plugin.aliasMap.get(command))) return;
|
||||
//event.setCancelled(true);
|
||||
event.getPlayer().chat(message.replaceFirst(command, plugin.aliasMap.get(command)));
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor PlaterPickupItem events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
||||
if (Users.getProfile(event.getPlayer()).getBerserkMode()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor PlayerLogin events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
Users.addUser(event.getPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor PlayerQuit events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
/* GARBAGE COLLECTION */
|
||||
|
||||
//Remove Spout Stuff
|
||||
if(LoadProperties.spoutEnabled && SpoutStuff.playerHUDs.containsKey(player)) {
|
||||
SpoutStuff.playerHUDs.remove(player);
|
||||
}
|
||||
|
||||
//Bleed it out
|
||||
if(PP.getBleedTicks() > 0) {
|
||||
Combat.dealDamage(player, PP.getBleedTicks()*2);
|
||||
}
|
||||
|
||||
//Schedule PlayerProfile removal 2 minutes after quitting
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new RemoveProfileFromMemoryTask(player), 2400);
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor PlayerJoin events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (mcPermissions.getInstance().motd(player) && LoadProperties.enableMotd) {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.MOTD", new Object[] {plugin.getDescription().getVersion(), "mcmmo"}));
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.WIKI"));
|
||||
}
|
||||
|
||||
//THIS IS VERY BAD WAY TO DO THINGS, NEED BETTER WAY
|
||||
if (XprateCommand.xpevent) {
|
||||
player.sendMessage(mcLocale.getString("XPRate.Event", new Object[] {LoadProperties.xpGainMultiplier}));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor PlayerInteract events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
Action action = event.getAction();
|
||||
Block block = event.getClickedBlock();
|
||||
ItemStack is = player.getItemInHand();
|
||||
Material mat;
|
||||
|
||||
/* Fix for NPE on interacting with air */
|
||||
if (block == null) {
|
||||
mat = Material.AIR;
|
||||
}
|
||||
else {
|
||||
mat = block.getType();
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
case RIGHT_CLICK_BLOCK:
|
||||
|
||||
/* REPAIR CHECKS */
|
||||
if (mcPermissions.getInstance().repair(player) && block.getTypeId() == LoadProperties.anvilID && (ItemChecks.isTool(is) || ItemChecks.isArmor(is))) {
|
||||
Repair.repairCheck(player, is);
|
||||
event.setCancelled(true);
|
||||
player.updateInventory();
|
||||
}
|
||||
|
||||
/* ACTIVATION CHECKS */
|
||||
if (LoadProperties.enableAbilities && BlockChecks.abilityBlockCheck(mat)) {
|
||||
if (!mat.equals(Material.DIRT) && !mat.equals(Material.GRASS) && !mat.equals(Material.SOIL)) {
|
||||
Skills.activationCheck(player, SkillType.HERBALISM);
|
||||
}
|
||||
|
||||
Skills.activationCheck(player, SkillType.AXES);
|
||||
Skills.activationCheck(player, SkillType.EXCAVATION);
|
||||
Skills.activationCheck(player, SkillType.MINING);
|
||||
Skills.activationCheck(player, SkillType.SWORDS);
|
||||
Skills.activationCheck(player, SkillType.UNARMED);
|
||||
Skills.activationCheck(player, SkillType.WOODCUTTING);
|
||||
}
|
||||
|
||||
/* GREEN THUMB CHECK */
|
||||
if (mcPermissions.getInstance().greenThumbBlocks(player) && Herbalism.makeMossy(mat) && is.getType().equals(Material.SEEDS)) {
|
||||
Herbalism.greenThumbBlocks(is, player, block);
|
||||
}
|
||||
|
||||
/* ITEM CHECKS */
|
||||
if (BlockChecks.abilityBlockCheck(mat)) {
|
||||
Item.itemchecks(player);
|
||||
}
|
||||
|
||||
/* BLAST MINING CHECK */
|
||||
if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == LoadProperties.detonatorID) {
|
||||
BlastMining.remoteDetonation(player, plugin);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RIGHT_CLICK_AIR:
|
||||
|
||||
/* ACTIVATION CHECKS */
|
||||
if (LoadProperties.enableAbilities) {
|
||||
Skills.activationCheck(player, SkillType.AXES);
|
||||
Skills.activationCheck(player, SkillType.EXCAVATION);
|
||||
Skills.activationCheck(player, SkillType.HERBALISM);
|
||||
Skills.activationCheck(player, SkillType.MINING);
|
||||
Skills.activationCheck(player, SkillType.SWORDS);
|
||||
Skills.activationCheck(player, SkillType.UNARMED);
|
||||
Skills.activationCheck(player, SkillType.WOODCUTTING);
|
||||
}
|
||||
|
||||
/* ITEM CHECKS */
|
||||
Item.itemchecks(player);
|
||||
|
||||
/* BLAST MINING CHECK */
|
||||
if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == LoadProperties.detonatorID) {
|
||||
BlastMining.remoteDetonation(player, plugin);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case LEFT_CLICK_AIR:
|
||||
case LEFT_CLICK_BLOCK:
|
||||
|
||||
/* CALL OF THE WILD CHECKS */
|
||||
if (player.isSneaking() && mcPermissions.getInstance().taming(player)) {
|
||||
if (is.getType().equals(Material.RAW_FISH)) {
|
||||
Taming.animalSummon(EntityType.OCELOT, player, plugin);
|
||||
}
|
||||
else if (is.getType().equals(Material.BONE)) {
|
||||
Taming.animalSummon(EntityType.WOLF, player, plugin);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor PlayerChat events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerChat(PlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
boolean partyChat = PP.getPartyChatMode();
|
||||
boolean adminChat = PP.getAdminChatMode();
|
||||
|
||||
if (partyChat || adminChat) {
|
||||
event.setCancelled(true);
|
||||
|
||||
String name = "";
|
||||
boolean displayNames = false;
|
||||
ChatColor color = ChatColor.WHITE;
|
||||
String logHeader = "";
|
||||
|
||||
/* Set the pChat & aChat specific stuff */
|
||||
if (partyChat) {
|
||||
if (!PP.inParty()) {
|
||||
player.sendMessage("You're not in a party, type /p to leave party chat mode."); //TODO: Use mcLocale
|
||||
return;
|
||||
}
|
||||
|
||||
displayNames = LoadProperties.pDisplayNames;
|
||||
color = ChatColor.GREEN;
|
||||
logHeader = "[P](" + PP.getParty() + ")<";
|
||||
}
|
||||
else if (adminChat) {
|
||||
displayNames = LoadProperties.aDisplayNames;
|
||||
color = ChatColor.AQUA;
|
||||
logHeader = "[A]<";
|
||||
}
|
||||
|
||||
/* Format & display */
|
||||
if (displayNames) {
|
||||
name = player.getDisplayName();
|
||||
}
|
||||
else {
|
||||
name = player.getName();
|
||||
}
|
||||
|
||||
String format = color + "(" + ChatColor.WHITE + name + color + ") " + event.getMessage();
|
||||
|
||||
for (Player x : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (partyChat && Party.getInstance().inSameParty(player, x))
|
||||
x.sendMessage(format);
|
||||
else if (adminChat && (x.isOp() || mcPermissions.getInstance().adminChat(x))) {
|
||||
x.sendMessage(format);
|
||||
}
|
||||
}
|
||||
|
||||
Bukkit.getLogger().info(logHeader + name + ">" + event.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// Dynamically aliasing commands need to be re-done.
|
||||
// For now, using a command with an alias will send both the original command, and the mcMMO command
|
||||
|
||||
/**
|
||||
* Monitor PlayerCommandPreprocess events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
String message = event.getMessage();
|
||||
|
||||
if (!message.startsWith("/")) {
|
||||
return;
|
||||
}
|
||||
|
||||
String command = message.substring(1).split(" ")[0];
|
||||
|
||||
if (plugin.aliasMap.containsKey(command)) {
|
||||
if(command.equalsIgnoreCase(plugin.aliasMap.get(command))) {
|
||||
return;
|
||||
}
|
||||
event.getPlayer().chat(message.replaceFirst(command, plugin.aliasMap.get(command)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -25,16 +9,24 @@ import com.gmail.nossr50.events.McMMOPlayerXpGainEvent;
|
||||
* Listener for listening to our own events, only really useful for catching errors
|
||||
*/
|
||||
public class mcSelfListener implements Listener {
|
||||
@EventHandler
|
||||
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
|
||||
int xp = event.getXpGained();
|
||||
if(xp < 0) {
|
||||
try {
|
||||
throw new Exception("Gained negative XP!");
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor internal XP gain events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler
|
||||
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
|
||||
int xp = event.getXpGained();
|
||||
|
||||
if(xp < 0) {
|
||||
try {
|
||||
throw new Exception("Gained negative XP!");
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -27,37 +11,38 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.popups.PopupMMO;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
public class mcSpoutInputListener implements Listener
|
||||
{
|
||||
mcMMO plugin = null;
|
||||
|
||||
public mcSpoutInputListener(mcMMO pluginx)
|
||||
{
|
||||
plugin = pluginx;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onKeyPressedEvent(KeyPressedEvent event)
|
||||
{
|
||||
if(!event.getPlayer().isSpoutCraftEnabled() || event.getPlayer().getMainScreen().getActivePopup() != null)
|
||||
return;
|
||||
if(event.getScreenType() != ScreenType.GAME_SCREEN)
|
||||
return;
|
||||
|
||||
SpoutPlayer sPlayer = event.getPlayer();
|
||||
|
||||
if(event.getKey() == SpoutStuff.keypress)
|
||||
{
|
||||
if(!SpoutStuff.playerScreens.containsKey(sPlayer))
|
||||
{
|
||||
PopupMMO mmoPop = new PopupMMO(sPlayer, Users.getProfile(sPlayer), plugin);
|
||||
SpoutStuff.playerScreens.put(sPlayer, mmoPop);
|
||||
sPlayer.getMainScreen().attachPopupScreen(SpoutStuff.playerScreens.get(sPlayer));
|
||||
sPlayer.getMainScreen().setDirty(true);
|
||||
} else {
|
||||
sPlayer.getMainScreen().attachPopupScreen(SpoutStuff.playerScreens.get(sPlayer));
|
||||
sPlayer.getMainScreen().setDirty(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public class mcSpoutInputListener implements Listener {
|
||||
private mcMMO plugin;
|
||||
|
||||
public mcSpoutInputListener(mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor Spout KeyPressed events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler
|
||||
public void onKeyPressedEvent(KeyPressedEvent event) {
|
||||
SpoutPlayer sPlayer = event.getPlayer();
|
||||
|
||||
if (!sPlayer.isSpoutCraftEnabled() || sPlayer.getMainScreen().getActivePopup() != null || event.getScreenType() != ScreenType.GAME_SCREEN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getKey() == SpoutStuff.keypress) {
|
||||
if (!SpoutStuff.playerScreens.containsKey(sPlayer)) {
|
||||
PopupMMO mmoPop = new PopupMMO(sPlayer, Users.getProfile(sPlayer), plugin);
|
||||
|
||||
SpoutStuff.playerScreens.put(sPlayer, mmoPop);
|
||||
sPlayer.getMainScreen().attachPopupScreen(SpoutStuff.playerScreens.get(sPlayer));
|
||||
sPlayer.getMainScreen().setDirty(true);
|
||||
}
|
||||
else {
|
||||
sPlayer.getMainScreen().attachPopupScreen(SpoutStuff.playerScreens.get(sPlayer));
|
||||
sPlayer.getMainScreen().setDirty(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -22,30 +6,32 @@ import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.HUDmmo;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
public class mcSpoutListener implements Listener
|
||||
{
|
||||
mcMMO plugin = null;
|
||||
|
||||
public mcSpoutListener(mcMMO pluginx)
|
||||
{
|
||||
plugin = pluginx;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSpoutCraftEnable(SpoutCraftEnableEvent event)
|
||||
{
|
||||
SpoutPlayer sPlayer = event.getPlayer();
|
||||
if(sPlayer.isSpoutCraftEnabled())
|
||||
{
|
||||
//Setup Party HUD stuff
|
||||
SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer));
|
||||
public class mcSpoutListener implements Listener {
|
||||
//Why do we have this here? We never use it...
|
||||
mcMMO plugin = null;
|
||||
|
||||
public mcSpoutListener(mcMMO pluginx) {
|
||||
plugin = pluginx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor SpoutCraftEnable events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler
|
||||
public void onSpoutCraftEnable(SpoutCraftEnableEvent event) {
|
||||
SpoutPlayer sPlayer = event.getPlayer();
|
||||
|
||||
//Party.update(sPlayer);
|
||||
Users.getProfile(sPlayer).toggleSpoutEnabled();
|
||||
}
|
||||
}
|
||||
if (sPlayer.isSpoutCraftEnabled()) {
|
||||
SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer)); //Setup Party HUD stuff
|
||||
Users.getProfile(sPlayer).toggleSpoutEnabled();
|
||||
sPlayer.setTitle(String.valueOf(m.getPowerLevel(sPlayer, Users.getProfile(sPlayer))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -33,65 +17,75 @@ import com.gmail.nossr50.datatypes.buttons.ButtonPartyToggle;
|
||||
import com.gmail.nossr50.datatypes.popups.PopupMMO;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
public class mcSpoutScreenListener implements Listener
|
||||
{
|
||||
mcMMO plugin = null;
|
||||
public mcSpoutScreenListener(mcMMO pluginx)
|
||||
{
|
||||
plugin = pluginx;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onButtonClick(ButtonClickEvent event)
|
||||
{
|
||||
SpoutPlayer sPlayer = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(sPlayer);
|
||||
|
||||
if(event.getButton() instanceof ButtonHUDStyle)
|
||||
{
|
||||
if(SpoutStuff.playerHUDs.containsKey(sPlayer))
|
||||
{
|
||||
SpoutStuff.playerHUDs.get(sPlayer).resetHUD();
|
||||
SpoutStuff.playerHUDs.remove(sPlayer);
|
||||
|
||||
switch(PP.getHUDType())
|
||||
{
|
||||
case RETRO:
|
||||
PP.setHUDType(HUDType.STANDARD);
|
||||
break;
|
||||
case STANDARD:
|
||||
PP.setHUDType(HUDType.SMALL);
|
||||
break;
|
||||
case SMALL:
|
||||
PP.setHUDType(HUDType.DISABLED);
|
||||
break;
|
||||
case DISABLED:
|
||||
PP.setHUDType(HUDType.RETRO);
|
||||
}
|
||||
|
||||
SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer));
|
||||
|
||||
SpoutStuff.playerScreens.get(sPlayer).updateButtons(PP);
|
||||
}
|
||||
} else if (event.getButton() instanceof ButtonEscape)
|
||||
{
|
||||
sPlayer.getMainScreen().closePopup();
|
||||
} else if (event.getButton() instanceof ButtonPartyToggle)
|
||||
{
|
||||
PP.togglePartyHUD();
|
||||
ButtonPartyToggle bpt = (ButtonPartyToggle)event.getButton();
|
||||
bpt.updateText(PP);
|
||||
SpoutStuff.playerHUDs.get(sPlayer).resetHUD();
|
||||
SpoutStuff.playerHUDs.get(sPlayer).initializeHUD(sPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onScreenClose(ScreenCloseEvent event)
|
||||
{
|
||||
if(event.getScreen() instanceof PopupMMO)
|
||||
{
|
||||
SpoutStuff.playerScreens.remove(event.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
public class mcSpoutScreenListener implements Listener {
|
||||
//Why do we have this here? We never use it...
|
||||
mcMMO plugin = null;
|
||||
|
||||
public mcSpoutScreenListener(mcMMO pluginx) {
|
||||
plugin = pluginx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor Spout ButtonClick events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler
|
||||
public void onButtonClick(ButtonClickEvent event) {
|
||||
SpoutPlayer sPlayer = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(sPlayer);
|
||||
|
||||
if (event.getButton() instanceof ButtonHUDStyle) {
|
||||
if (SpoutStuff.playerHUDs.containsKey(sPlayer)) {
|
||||
SpoutStuff.playerHUDs.get(sPlayer).resetHUD();
|
||||
SpoutStuff.playerHUDs.remove(sPlayer);
|
||||
|
||||
switch (PP.getHUDType()) {
|
||||
case RETRO:
|
||||
PP.setHUDType(HUDType.STANDARD);
|
||||
break;
|
||||
|
||||
case STANDARD:
|
||||
PP.setHUDType(HUDType.SMALL);
|
||||
break;
|
||||
|
||||
case SMALL:
|
||||
PP.setHUDType(HUDType.DISABLED);
|
||||
break;
|
||||
|
||||
case DISABLED:
|
||||
PP.setHUDType(HUDType.RETRO);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer));
|
||||
SpoutStuff.playerScreens.get(sPlayer).updateButtons(PP);
|
||||
}
|
||||
}
|
||||
else if (event.getButton() instanceof ButtonEscape) {
|
||||
sPlayer.getMainScreen().closePopup();
|
||||
}
|
||||
else if (event.getButton() instanceof ButtonPartyToggle) {
|
||||
PP.togglePartyHUD();
|
||||
ButtonPartyToggle bpt = (ButtonPartyToggle) event.getButton();
|
||||
bpt.updateText(PP);
|
||||
SpoutStuff.playerHUDs.get(sPlayer).resetHUD();
|
||||
SpoutStuff.playerHUDs.get(sPlayer).initializeHUD(sPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor Spout ScreenClose events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler
|
||||
public void onScreenClose(ScreenCloseEvent event) {
|
||||
if (event.getScreen() instanceof PopupMMO) {
|
||||
SpoutStuff.playerScreens.remove(event.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.locale;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
@@ -1,617 +1,281 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import com.gmail.nossr50.config.*;
|
||||
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.events.FakeBlockBreakEvent;
|
||||
import com.gmail.nossr50.events.McMMOItemSpawnEvent;
|
||||
import com.gmail.nossr50.skills.Repair;
|
||||
|
||||
public class m
|
||||
{
|
||||
public static final Logger log = Logger.getLogger("Minecraft");
|
||||
/*
|
||||
* I'm storing my misc functions/methods in here in an unorganized manner. Spheal with it.
|
||||
* This is probably the most embarrassing part of my code for mcMMO
|
||||
* I really should find an organized place for these things!
|
||||
*/
|
||||
|
||||
public static String getCapitalized(String target)
|
||||
{
|
||||
String firstLetter = target.substring(0,1);
|
||||
String remainder = target.substring(1);
|
||||
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
|
||||
|
||||
return capitalized;
|
||||
}
|
||||
public static int getInt(String string)
|
||||
{
|
||||
if(isInt(string))
|
||||
return Integer.parseInt(string);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static boolean isInvincible(LivingEntity le, EntityDamageEvent event)
|
||||
{
|
||||
//So apparently if you do more damage to a LivingEntity than its last damage int you bypass the invincibility
|
||||
//So yeah, this is for that
|
||||
if(le.getNoDamageTicks() > le.getMaximumNoDamageTicks() / 2.0F && event.getDamage() <= le.getLastDamage())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isDouble(String string)
|
||||
{
|
||||
try
|
||||
{
|
||||
Double.parseDouble(string);
|
||||
}
|
||||
catch(NumberFormatException nFE) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if a block type awards XP.
|
||||
*
|
||||
* @param material Block type to check
|
||||
* @return true if the block type awards XP, false otherwise
|
||||
*/
|
||||
public static boolean shouldBeWatched(Material material)
|
||||
{
|
||||
switch(material){
|
||||
case BROWN_MUSHROOM:
|
||||
case CACTUS:
|
||||
case CLAY:
|
||||
case COAL_ORE:
|
||||
case DIAMOND_ORE:
|
||||
case DIRT:
|
||||
case ENDER_STONE:
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case GLOWSTONE:
|
||||
case GOLD_ORE:
|
||||
case GRASS:
|
||||
case GRAVEL:
|
||||
case IRON_ORE:
|
||||
case JACK_O_LANTERN:
|
||||
case LAPIS_ORE:
|
||||
case LOG:
|
||||
case MELON_BLOCK:
|
||||
case MOSSY_COBBLESTONE:
|
||||
case MYCEL:
|
||||
case NETHERRACK:
|
||||
case OBSIDIAN:
|
||||
case PUMPKIN:
|
||||
case RED_MUSHROOM:
|
||||
case RED_ROSE:
|
||||
case REDSTONE_ORE:
|
||||
case SAND:
|
||||
case SANDSTONE:
|
||||
case SOUL_SAND:
|
||||
case STONE:
|
||||
case SUGAR_CANE_BLOCK:
|
||||
case VINE:
|
||||
case WATER_LILY:
|
||||
case YELLOW_FLOWER:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getPowerLevel(Player player)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int x = 0;
|
||||
if(mcPermissions.getInstance().taming(player))
|
||||
x+=PP.getSkillLevel(SkillType.TAMING);
|
||||
if(mcPermissions.getInstance().mining(player))
|
||||
x+=PP.getSkillLevel(SkillType.MINING);
|
||||
if(mcPermissions.getInstance().woodcutting(player))
|
||||
x+=PP.getSkillLevel(SkillType.WOODCUTTING);
|
||||
if(mcPermissions.getInstance().unarmed(player))
|
||||
x+=PP.getSkillLevel(SkillType.UNARMED);
|
||||
if(mcPermissions.getInstance().herbalism(player))
|
||||
x+=PP.getSkillLevel(SkillType.HERBALISM);
|
||||
if(mcPermissions.getInstance().excavation(player))
|
||||
x+=PP.getSkillLevel(SkillType.EXCAVATION);
|
||||
if(mcPermissions.getInstance().archery(player))
|
||||
x+=PP.getSkillLevel(SkillType.ARCHERY);
|
||||
if(mcPermissions.getInstance().swords(player))
|
||||
x+=PP.getSkillLevel(SkillType.SWORDS);
|
||||
if(mcPermissions.getInstance().axes(player))
|
||||
x+=PP.getSkillLevel(SkillType.AXES);
|
||||
if(mcPermissions.getInstance().acrobatics(player))
|
||||
x+=PP.getSkillLevel(SkillType.ACROBATICS);
|
||||
if(mcPermissions.getInstance().repair(player))
|
||||
x+=PP.getSkillLevel(SkillType.REPAIR);
|
||||
if(mcPermissions.getInstance().fishing(player))
|
||||
x+=PP.getSkillLevel(SkillType.FISHING);
|
||||
return x;
|
||||
}
|
||||
public class m {
|
||||
|
||||
public static boolean blockBreakSimulate(Block block, Player player, Boolean shouldArmSwing)
|
||||
{
|
||||
//Support for NoCheat
|
||||
if(shouldArmSwing)
|
||||
{
|
||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||
/**
|
||||
* Gets a capitalized version of the target string.
|
||||
*
|
||||
* @param target String to capitalize
|
||||
* @return the capitalized string
|
||||
*/
|
||||
public static String getCapitalized(String target) {
|
||||
String firstLetter = target.substring(0,1);
|
||||
String remainder = target.substring(1);
|
||||
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
|
||||
|
||||
return capitalized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a nicely formatted string version of an item name from a given item ID.
|
||||
*
|
||||
* @param itemID The ID of the item to convert to string.
|
||||
* @return the nicely formatting string
|
||||
*/
|
||||
public static String prettyItemString(int itemID) {
|
||||
String baseString = Material.getMaterial(itemID).toString();
|
||||
String[] substrings = baseString.split("_");
|
||||
String prettyString = "";
|
||||
int size = 1;
|
||||
|
||||
for (String s : substrings) {
|
||||
prettyString = prettyString.concat(m.getCapitalized(s));
|
||||
|
||||
if (size < substrings.length) {
|
||||
prettyString = prettyString.concat(" ");
|
||||
}
|
||||
|
||||
size++;
|
||||
}
|
||||
|
||||
return prettyString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the int represented by this string.
|
||||
*
|
||||
* @param string The string to parse
|
||||
* @return the int represented by this string
|
||||
*/
|
||||
public static int getInt(String string) {
|
||||
if (isInt(string)) {
|
||||
return Integer.parseInt(string);
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if an entity is currently invincible.
|
||||
*
|
||||
* @param le The LivingEntity to check
|
||||
* @param event The event the entity is involved in
|
||||
* @return true if the entity is invincible, false otherwise
|
||||
*/
|
||||
public static boolean isInvincible(LivingEntity le, EntityDamageEvent event) {
|
||||
|
||||
/*
|
||||
* So apparently if you do more damage to a LivingEntity than its last damage int you bypass the invincibility.
|
||||
* So yeah, this is for that.
|
||||
*/
|
||||
if (le.getNoDamageTicks() > le.getMaximumNoDamageTicks() / 2.0F && event.getDamage() <= le.getLastDamage()) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the power level of a player.
|
||||
*
|
||||
* @param player The player to get the power level of
|
||||
* @param PP The profile of the player
|
||||
* @return the power level of the player
|
||||
*/
|
||||
public static int getPowerLevel(Player player, PlayerProfile PP) {
|
||||
int powerLevel = 0;
|
||||
|
||||
for (SkillType type : SkillType.values()) {
|
||||
if (type.getPermissions(player)) {
|
||||
powerLevel += PP.getSkillLevel(type);
|
||||
}
|
||||
}
|
||||
|
||||
return powerLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate a block break event.
|
||||
*
|
||||
* @param block The block to break
|
||||
* @param player The player breaking the block
|
||||
* @param shouldArmSwing true if an armswing event should be fired, false otherwise
|
||||
* @return true if the event wasn't cancelled, false otherwise
|
||||
*/
|
||||
public static boolean blockBreakSimulate(Block block, Player player, Boolean shouldArmSwing) {
|
||||
|
||||
//Support for NoCheat
|
||||
if (shouldArmSwing) {
|
||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
}
|
||||
|
||||
FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player);
|
||||
if(block != null && player != null){
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if(!event.isCancelled())
|
||||
{
|
||||
return true; //Return true if not cancelled
|
||||
} else {
|
||||
return false; //Return false if cancelled
|
||||
}
|
||||
} else {
|
||||
return false; //Return false if something went wrong
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer getTier(Player player)
|
||||
{
|
||||
ItemStack is = player.getItemInHand();
|
||||
if(Repair.isWoodTools(is))
|
||||
return 1;
|
||||
if(Repair.isStoneTools(is))
|
||||
return 2;
|
||||
if(Repair.isIronTools(is))
|
||||
return 3;
|
||||
if(Repair.isGoldTools(is))
|
||||
return 1;
|
||||
if(Repair.isDiamondTools(is))
|
||||
return 4;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static boolean isNear(Location first, Location second, int maxDistance) {
|
||||
double relX = first.getX() - second.getX();
|
||||
double relY = first.getY() - second.getY();
|
||||
double relZ = first.getZ() - second.getZ();
|
||||
double dist = relX * relX + relY * relY + relZ * relZ;
|
||||
|
||||
if (dist < maxDistance * maxDistance)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean abilityBlockCheck(Block block)
|
||||
{
|
||||
switch(block.getType()){
|
||||
case BED_BLOCK:
|
||||
case BREWING_STAND:
|
||||
case BURNING_FURNACE:
|
||||
case CAKE_BLOCK:
|
||||
case CHEST:
|
||||
case DISPENSER:
|
||||
case ENCHANTMENT_TABLE:
|
||||
case FENCE_GATE:
|
||||
case FURNACE:
|
||||
case IRON_DOOR_BLOCK:
|
||||
case JUKEBOX:
|
||||
case LEVER:
|
||||
case NOTE_BLOCK:
|
||||
case STONE_BUTTON:
|
||||
case TRAP_DOOR:
|
||||
case WALL_SIGN:
|
||||
case WOODEN_DOOR:
|
||||
case WORKBENCH:
|
||||
return false;
|
||||
}
|
||||
|
||||
if(block.getTypeId() == LoadProperties.anvilID)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isInt(String string)
|
||||
{
|
||||
try
|
||||
{
|
||||
Integer.parseInt(string);
|
||||
}
|
||||
catch(NumberFormatException nFE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void mcDropItems(Location location, ItemStack is, int quantity)
|
||||
{
|
||||
for(int i = 0; i < quantity; i++)
|
||||
mcDropItem(location, is);
|
||||
}
|
||||
|
||||
public static void mcRandomDropItem(Location location, ItemStack is, int chance)
|
||||
{
|
||||
if(Math.random() * 100 < chance)
|
||||
mcDropItem(location, is);
|
||||
}
|
||||
|
||||
public static void mcRandomDropItems(Location location, ItemStack is, int chance, int quantity)
|
||||
{
|
||||
for(int i = 0; i < quantity; i++)
|
||||
mcRandomDropItem(location, is, chance);
|
||||
}
|
||||
|
||||
public static void mcDropItem(Location location, ItemStack itemStack) {
|
||||
// We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
|
||||
McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(location, itemStack);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if(event.isCancelled()) return;
|
||||
|
||||
location.getWorld().dropItemNaturally(location, itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSwords(ItemStack is)
|
||||
{
|
||||
switch(is.getType()){
|
||||
case DIAMOND_SWORD:
|
||||
case GOLD_SWORD:
|
||||
case IRON_SWORD:
|
||||
case STONE_SWORD:
|
||||
case WOOD_SWORD:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isHoe(ItemStack is)
|
||||
{
|
||||
switch(is.getType()){
|
||||
case DIAMOND_HOE:
|
||||
case GOLD_HOE:
|
||||
case IRON_HOE:
|
||||
case STONE_HOE:
|
||||
case WOOD_HOE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isShovel(ItemStack is)
|
||||
{
|
||||
switch(is.getType()){
|
||||
case DIAMOND_SPADE:
|
||||
case GOLD_SPADE:
|
||||
case IRON_SPADE:
|
||||
case STONE_SPADE:
|
||||
case WOOD_SPADE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isAxes(ItemStack is)
|
||||
{
|
||||
switch(is.getType()){
|
||||
case DIAMOND_AXE:
|
||||
case GOLD_AXE:
|
||||
case IRON_AXE:
|
||||
case STONE_AXE:
|
||||
case WOOD_AXE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isMiningPick(ItemStack is)
|
||||
{
|
||||
switch(is.getType()){
|
||||
case DIAMOND_PICKAXE:
|
||||
case GOLD_PICKAXE:
|
||||
case IRON_PICKAXE:
|
||||
case STONE_PICKAXE:
|
||||
case WOOD_PICKAXE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isHelmet(ItemStack is)
|
||||
{
|
||||
switch(is.getType()){
|
||||
case DIAMOND_HELMET:
|
||||
case GOLD_HELMET:
|
||||
case IRON_HELMET:
|
||||
case LEATHER_HELMET:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isChestplate(ItemStack is)
|
||||
{
|
||||
switch(is.getType()){
|
||||
case DIAMOND_CHESTPLATE:
|
||||
case GOLD_CHESTPLATE:
|
||||
case IRON_CHESTPLATE:
|
||||
case LEATHER_CHESTPLATE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isPants(ItemStack is)
|
||||
{
|
||||
switch(is.getType()){
|
||||
case DIAMOND_LEGGINGS:
|
||||
case GOLD_LEGGINGS:
|
||||
case IRON_LEGGINGS:
|
||||
case LEATHER_LEGGINGS:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isBoots(ItemStack is)
|
||||
{
|
||||
switch(is.getType()){
|
||||
case DIAMOND_BOOTS:
|
||||
case GOLD_BOOTS:
|
||||
case IRON_BOOTS:
|
||||
case LEATHER_BOOTS:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isOre(Block block)
|
||||
{
|
||||
switch (block.getType()) {
|
||||
case COAL_ORE:
|
||||
case DIAMOND_ORE:
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case GOLD_ORE:
|
||||
case IRON_ORE:
|
||||
case LAPIS_ORE:
|
||||
case REDSTONE_ORE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void convertToMySQL()
|
||||
{
|
||||
if(!LoadProperties.useMySQL)
|
||||
return;
|
||||
|
||||
Bukkit.getScheduler().scheduleAsyncDelayedTask(Bukkit.getServer().getPluginManager().getPlugin("mcMMO"), new Runnable(){
|
||||
public void run() {
|
||||
String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
|
||||
try {
|
||||
//Open the user file
|
||||
FileReader file = new FileReader(location);
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
String line = "";
|
||||
String playerName = null, mining = null, party = null, miningXP = null, woodcutting = null, woodCuttingXP = null, repair = null, unarmed = null, herbalism = null, excavation = null, archery = null, swords = null, axes = null, acrobatics = null, repairXP = null, unarmedXP = null, herbalismXP = null, excavationXP = null, archeryXP = null, swordsXP = null, axesXP = null, acrobaticsXP = null, taming = null, tamingXP = null, fishing = null, fishingXP = null;
|
||||
int id = 0, theCount = 0;
|
||||
while ((line = in.readLine()) != null) {
|
||||
//Find if the line contains the player we want.
|
||||
String[] character = line.split(":");
|
||||
playerName = character[0];
|
||||
//Check for things we don't want put in the DB
|
||||
if (playerName == null
|
||||
|| playerName.equals("null")
|
||||
|| playerName
|
||||
.equals("#Storage place for user information"))
|
||||
continue;
|
||||
FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
//Get Mining
|
||||
if (character.length > 1)
|
||||
mining = character[1];
|
||||
//Party
|
||||
if (character.length > 3)
|
||||
party = character[3];
|
||||
//Mining XP
|
||||
if (character.length > 4)
|
||||
miningXP = character[4];
|
||||
if (character.length > 5)
|
||||
woodcutting = character[5];
|
||||
if (character.length > 6)
|
||||
woodCuttingXP = character[6];
|
||||
if (character.length > 7)
|
||||
repair = character[7];
|
||||
if (character.length > 8)
|
||||
unarmed = character[8];
|
||||
if (character.length > 9)
|
||||
herbalism = character[9];
|
||||
if (character.length > 10)
|
||||
excavation = character[10];
|
||||
if (character.length > 11)
|
||||
archery = character[11];
|
||||
if (character.length > 12)
|
||||
swords = character[12];
|
||||
if (character.length > 13)
|
||||
axes = character[13];
|
||||
if (character.length > 14)
|
||||
acrobatics = character[14];
|
||||
if (character.length > 15)
|
||||
repairXP = character[15];
|
||||
if (character.length > 16)
|
||||
unarmedXP = character[16];
|
||||
if (character.length > 17)
|
||||
herbalismXP = character[17];
|
||||
if (character.length > 18)
|
||||
excavationXP = character[18];
|
||||
if (character.length > 19)
|
||||
archeryXP = character[19];
|
||||
if (character.length > 20)
|
||||
swordsXP = character[20];
|
||||
if (character.length > 21)
|
||||
axesXP = character[21];
|
||||
if (character.length > 22)
|
||||
acrobaticsXP = character[22];
|
||||
if (character.length > 24)
|
||||
taming = character[24];
|
||||
if (character.length > 25)
|
||||
tamingXP = character[25];
|
||||
if (character.length > 34)
|
||||
fishing = character[34];
|
||||
if (character.length > 35)
|
||||
fishingXP = character[35];
|
||||
if (!event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check to see if the user is in the DB
|
||||
id = mcMMO.database.GetInt("SELECT id FROM "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "users WHERE user = '" + playerName + "'");
|
||||
/**
|
||||
* Get the upgrade tier of the item in hand.
|
||||
*
|
||||
* @param inHand The item to check the tier of
|
||||
* @return the tier of the item
|
||||
*/
|
||||
public static Integer getTier(ItemStack inHand) {
|
||||
int tier = 0;
|
||||
|
||||
if (id > 0) {
|
||||
theCount++;
|
||||
//Update the skill values
|
||||
mcMMO.database.Write("UPDATE "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "users SET lastlogin = " + 0
|
||||
+ " WHERE id = " + id);
|
||||
mcMMO.database.Write("UPDATE "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "skills SET " + " taming = taming+"
|
||||
+ getInt(taming) + ", mining = mining+"
|
||||
+ getInt(mining) + ", repair = repair+"
|
||||
+ getInt(repair)
|
||||
+ ", woodcutting = woodcutting+"
|
||||
+ getInt(woodcutting)
|
||||
+ ", unarmed = unarmed+" + getInt(unarmed)
|
||||
+ ", herbalism = herbalism+"
|
||||
+ getInt(herbalism)
|
||||
+ ", excavation = excavation+"
|
||||
+ getInt(excavation)
|
||||
+ ", archery = archery+" + getInt(archery)
|
||||
+ ", swords = swords+" + getInt(swords)
|
||||
+ ", axes = axes+" + getInt(axes)
|
||||
+ ", acrobatics = acrobatics+"
|
||||
+ getInt(acrobatics)
|
||||
+ ", fishing = fishing+" + getInt(fishing)
|
||||
+ " WHERE user_id = " + id);
|
||||
mcMMO.database.Write("UPDATE "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "experience SET " + " taming = "
|
||||
+ getInt(tamingXP) + ", mining = "
|
||||
+ getInt(miningXP) + ", repair = "
|
||||
+ getInt(repairXP) + ", woodcutting = "
|
||||
+ getInt(woodCuttingXP) + ", unarmed = "
|
||||
+ getInt(unarmedXP) + ", herbalism = "
|
||||
+ getInt(herbalismXP) + ", excavation = "
|
||||
+ getInt(excavationXP) + ", archery = "
|
||||
+ getInt(archeryXP) + ", swords = "
|
||||
+ getInt(swordsXP) + ", axes = "
|
||||
+ getInt(axesXP) + ", acrobatics = "
|
||||
+ getInt(acrobaticsXP) + ", fishing = "
|
||||
+ getInt(fishingXP) + " WHERE user_id = "
|
||||
+ id);
|
||||
} else {
|
||||
theCount++;
|
||||
//Create the user in the DB
|
||||
mcMMO.database.Write("INSERT INTO "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "users (user, lastlogin) VALUES ('"
|
||||
+ playerName + "',"
|
||||
+ System.currentTimeMillis() / 1000 + ")");
|
||||
id = mcMMO.database
|
||||
.GetInt("SELECT id FROM "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "users WHERE user = '"
|
||||
+ playerName + "'");
|
||||
mcMMO.database.Write("INSERT INTO "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "skills (user_id) VALUES (" + id + ")");
|
||||
mcMMO.database.Write("INSERT INTO "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "experience (user_id) VALUES (" + id
|
||||
+ ")");
|
||||
//Update the skill values
|
||||
mcMMO.database.Write("UPDATE "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "users SET lastlogin = " + 0
|
||||
+ " WHERE id = " + id);
|
||||
mcMMO.database.Write("UPDATE "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "users SET party = '" + party
|
||||
+ "' WHERE id = " + id);
|
||||
mcMMO.database.Write("UPDATE "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "skills SET " + " taming = "
|
||||
+ getInt(taming) + ", mining = "
|
||||
+ getInt(mining) + ", repair = "
|
||||
+ getInt(repair) + ", woodcutting = "
|
||||
+ getInt(woodcutting) + ", unarmed = "
|
||||
+ getInt(unarmed) + ", herbalism = "
|
||||
+ getInt(herbalism) + ", excavation = "
|
||||
+ getInt(excavation) + ", archery = "
|
||||
+ getInt(archery) + ", swords = "
|
||||
+ getInt(swords) + ", axes = "
|
||||
+ getInt(axes) + ", acrobatics = "
|
||||
+ getInt(acrobatics) + ", fishing = "
|
||||
+ getInt(fishing) + " WHERE user_id = "
|
||||
+ id);
|
||||
mcMMO.database.Write("UPDATE "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "experience SET " + " taming = "
|
||||
+ getInt(tamingXP) + ", mining = "
|
||||
+ getInt(miningXP) + ", repair = "
|
||||
+ getInt(repairXP) + ", woodcutting = "
|
||||
+ getInt(woodCuttingXP) + ", unarmed = "
|
||||
+ getInt(unarmedXP) + ", herbalism = "
|
||||
+ getInt(herbalismXP) + ", excavation = "
|
||||
+ getInt(excavationXP) + ", archery = "
|
||||
+ getInt(archeryXP) + ", swords = "
|
||||
+ getInt(swordsXP) + ", axes = "
|
||||
+ getInt(axesXP) + ", acrobatics = "
|
||||
+ getInt(acrobaticsXP) + ", fishing = "
|
||||
+ getInt(fishingXP) + " WHERE user_id = "
|
||||
+ id);
|
||||
}
|
||||
}
|
||||
System.out
|
||||
.println("[mcMMO] MySQL Updated from users file, "
|
||||
+ theCount
|
||||
+ " items added/updated to MySQL DB");
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Exception while reading " + location
|
||||
+ " (Are you sure you formatted it correctly?)", e);
|
||||
}
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
if (ItemChecks.isWoodTool(inHand)) {
|
||||
tier = 1;
|
||||
}
|
||||
else if (ItemChecks.isStoneTool(inHand)) {
|
||||
tier = 2;
|
||||
}
|
||||
else if (ItemChecks.isIronTool(inHand)) {
|
||||
tier = 3;
|
||||
}
|
||||
else if(ItemChecks.isGoldTool(inHand)) {
|
||||
tier = 1;
|
||||
}
|
||||
else if(ItemChecks.isDiamondTool(inHand))
|
||||
tier = 4;
|
||||
|
||||
return tier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if two locations are near each other.
|
||||
*
|
||||
* @param first The first location
|
||||
* @param second The second location
|
||||
* @param maxDistance The max distance apart
|
||||
* @return true if the distance between <code>first</code> and <code>second</code> is less than <code>maxDistance</code>, false otherwise
|
||||
*/
|
||||
public static boolean isNear(Location first, Location second, int maxDistance) {
|
||||
double relX = first.getX() - second.getX();
|
||||
double relY = first.getY() - second.getY();
|
||||
double relZ = first.getZ() - second.getZ();
|
||||
double dist = (relX * relX) + (relY * relY) + (relZ * relZ);
|
||||
|
||||
if (dist < maxDistance * maxDistance) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a string represents an Integer
|
||||
*
|
||||
* @param string String to check
|
||||
* @return true if the string is an Integer, false otherwise
|
||||
*/
|
||||
public static boolean isInt(String string) {
|
||||
try {
|
||||
Integer.parseInt(string);
|
||||
return true;
|
||||
}
|
||||
catch (NumberFormatException nFE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop items at a given location.
|
||||
*
|
||||
* @param location The location to drop the items at
|
||||
* @param is The items to drop
|
||||
* @param quantity The amount of items to drop
|
||||
*/
|
||||
public static void mcDropItems(Location location, ItemStack is, int quantity) {
|
||||
for (int i = 0; i < quantity; i++) {
|
||||
mcDropItem(location, is);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Randomly drop an item at a given location.
|
||||
*
|
||||
* @param location The location to drop the items at
|
||||
* @param is The item to drop
|
||||
* @param chance The percentage chance for the item to drop
|
||||
*/
|
||||
public static void mcRandomDropItem(Location location, ItemStack is, double chance) {
|
||||
if (Math.random() * 100 < chance) {
|
||||
mcDropItem(location, is);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Randomly drop items at a given location.
|
||||
*
|
||||
* @param location The location to drop the items at
|
||||
* @param is The item to drop
|
||||
* @param chance The percentage chance for the item to drop
|
||||
* @param quantity The amount of items to drop
|
||||
*/
|
||||
public static void mcRandomDropItems(Location location, ItemStack is, int chance, int quantity) {
|
||||
for(int i = 0; i < quantity; i++) {
|
||||
mcRandomDropItem(location, is, chance);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop an item at a given location.
|
||||
*
|
||||
* @param location The location to drop the item at
|
||||
* @param itemStack The item to drop
|
||||
*/
|
||||
public static void mcDropItem(Location location, ItemStack itemStack) {
|
||||
|
||||
// We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
|
||||
McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(location, itemStack);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
location.getWorld().dropItemNaturally(location, itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a skill level is higher than the max bonus level of the ability.
|
||||
*
|
||||
* @param skillLevel Skill level to check
|
||||
* @param maxLevel Max level of the ability
|
||||
* @return whichever value is lower
|
||||
*/
|
||||
public static int skillCheck(int skillLevel, int maxLevel) {
|
||||
if (skillLevel > maxLevel) {
|
||||
return maxLevel;
|
||||
}
|
||||
else {
|
||||
return skillLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,3 @@
|
||||
/*
|
||||
Copyright (C) 2012 Matt 'The Yeti' Burnett & mcMMO Development
|
||||
Copyright (C) 2010-2011 'nossr50'
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
@@ -26,15 +9,13 @@ import com.gmail.nossr50.commands.party.*;
|
||||
import com.gmail.nossr50.commands.general.*;
|
||||
import com.gmail.nossr50.config.*;
|
||||
import com.gmail.nossr50.runnables.*;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.listeners.mcBlockListener;
|
||||
import com.gmail.nossr50.listeners.mcEntityListener;
|
||||
import com.gmail.nossr50.listeners.mcPlayerListener;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.skills.*;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
@@ -46,384 +27,540 @@ import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.FileManager;
|
||||
|
||||
public class mcMMO extends JavaPlugin {
|
||||
|
||||
public class mcMMO extends JavaPlugin
|
||||
{
|
||||
|
||||
public static String maindirectory = "plugins" + File.separator + "mcMMO";
|
||||
File file = new File(maindirectory + File.separator + "config.yml");
|
||||
static File versionFile = new File(maindirectory + File.separator + "VERSION");
|
||||
public static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
private final mcPlayerListener playerListener = new mcPlayerListener(this);
|
||||
private final mcBlockListener blockListener = new mcBlockListener(this);
|
||||
private final mcEntityListener entityListener = new mcEntityListener(this);
|
||||
|
||||
//Queue for block data change for R2+ fix
|
||||
public ArrayDeque<Block> changeQueue = new ArrayDeque<Block>();
|
||||
public ArrayDeque<Block> fastChangeQueue = new ArrayDeque<Block>();
|
||||
public static String maindirectory = "plugins" + File.separator + "mcMMO";
|
||||
public static File file = new File(maindirectory + File.separator + "config.yml");
|
||||
public static File versionFile = new File(maindirectory + File.separator + "VERSION");
|
||||
|
||||
private Runnable mcMMO_Timer = new mcTimer(this); //BLEED AND REGENERATION
|
||||
private Runnable mcMMO_SaveTimer = new mcSaveTimer(this); //Periodic saving of Player Data
|
||||
private Runnable ChangeDataValueTimer = new ChangeDataValueTimer(changeQueue); //R2 block place workaround
|
||||
private Runnable FastChangeDataValueTimer = new ChangeDataValueTimer(fastChangeQueue);
|
||||
private final mcPlayerListener playerListener = new mcPlayerListener(this);
|
||||
private final mcBlockListener blockListener = new mcBlockListener(this);
|
||||
private final mcEntityListener entityListener = new mcEntityListener(this);
|
||||
|
||||
//Alias - Command
|
||||
public HashMap<String, String> aliasMap = new HashMap<String, String>();
|
||||
|
||||
public static Database database = null;
|
||||
public Misc misc = new Misc(this);
|
||||
//Alias - Command
|
||||
public HashMap<String, String> aliasMap = new HashMap<String, String>();
|
||||
public HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
|
||||
public HashMap<Integer, Player> tntTracker = new HashMap<Integer, Player>();
|
||||
|
||||
//Config file stuff
|
||||
LoadProperties config;
|
||||
LoadTreasures config2;
|
||||
|
||||
//Jar stuff
|
||||
public static File mcmmo;
|
||||
public static Database database = null;
|
||||
|
||||
public void onEnable()
|
||||
{
|
||||
final Plugin thisPlugin = this;
|
||||
mcmmo = this.getFile();
|
||||
new File(maindirectory).mkdir();
|
||||
|
||||
if(!versionFile.exists())
|
||||
{
|
||||
updateVersion();
|
||||
} else
|
||||
{
|
||||
String vnum = readVersion();
|
||||
//This will be changed to whatever version preceded when we actually need updater code.
|
||||
//Version 1.0.48 is the first to implement this, no checking before that version can be done.
|
||||
if(vnum.equalsIgnoreCase("1.0.48")) {
|
||||
updateFrom(1);
|
||||
}
|
||||
//Just add in more else if blocks for versions that need updater code. Increment the updateFrom age int as we do so.
|
||||
//Catch all for versions not matching and no specific code being needed
|
||||
else if(!vnum.equalsIgnoreCase(this.getDescription().getVersion())) updateFrom(-1);
|
||||
}
|
||||
|
||||
this.config = new LoadProperties(this);
|
||||
this.config.load();
|
||||
|
||||
this.config2 = new LoadTreasures(this);
|
||||
this.config2.load();
|
||||
|
||||
Party.getInstance().loadParties();
|
||||
new Party(this);
|
||||
|
||||
if(!LoadProperties.useMySQL)
|
||||
Users.getInstance().loadUsers(); //Load Users file
|
||||
/*
|
||||
* REGISTER EVENTS
|
||||
*/
|
||||
//Config file stuff
|
||||
LoadProperties config;
|
||||
LoadTreasures config2;
|
||||
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
//Jar stuff
|
||||
public static File mcmmo;
|
||||
|
||||
if(pm.getPlugin("Spout") != null)
|
||||
LoadProperties.spoutEnabled = true;
|
||||
else
|
||||
LoadProperties.spoutEnabled = false;
|
||||
|
||||
//Register events
|
||||
pm.registerEvents(playerListener, this);
|
||||
pm.registerEvents(blockListener, this);
|
||||
pm.registerEvents(entityListener, this);
|
||||
/**
|
||||
* Things to be run when the plugin is enabled.
|
||||
*/
|
||||
public void onEnable() {
|
||||
final Plugin thisPlugin = this;
|
||||
mcmmo = this.getFile();
|
||||
new File(maindirectory).mkdir();
|
||||
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
if (!versionFile.exists()) {
|
||||
updateVersion();
|
||||
}
|
||||
else {
|
||||
String vnum = readVersion();
|
||||
|
||||
if(LoadProperties.useMySQL)
|
||||
{
|
||||
database = new Database(this);
|
||||
database.createStructure();
|
||||
} else
|
||||
Leaderboard.makeLeaderboards(); //Make the leaderboards
|
||||
//This will be changed to whatever version preceded when we actually need updater code.
|
||||
//Version 1.0.48 is the first to implement this, no checking before that version can be done.
|
||||
if (vnum.equalsIgnoreCase("1.0.48")) {
|
||||
updateFrom(1);
|
||||
}
|
||||
|
||||
for(Player player : getServer().getOnlinePlayers()){Users.addUser(player);} //In case of reload add all users back into PlayerProfile
|
||||
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||
|
||||
//Periodic save timer (Saves every 10 minutes)
|
||||
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, mcMMO_SaveTimer, 0, LoadProperties.saveInterval * 1200);
|
||||
|
||||
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, mcMMO_Timer, 0, 20);
|
||||
//R2+ block place fix
|
||||
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, ChangeDataValueTimer, 0, 10);
|
||||
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, FastChangeDataValueTimer, 0, 1);
|
||||
|
||||
registerCommands();
|
||||
|
||||
//Spout Stuff
|
||||
if(LoadProperties.spoutEnabled)
|
||||
{
|
||||
SpoutStuff.setupSpoutConfigs();
|
||||
SpoutStuff.registerCustomEvent();
|
||||
SpoutStuff.extractFiles(); //Extract source materials
|
||||
|
||||
FileManager FM = SpoutManager.getFileManager();
|
||||
FM.addToPreLoginCache(this, SpoutStuff.getFiles());
|
||||
}
|
||||
|
||||
if(LoadProperties.statsTracking) {
|
||||
//Plugin Metrics running in a new thread
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
// create a new metrics object
|
||||
Metrics metrics = new Metrics();
|
||||
|
||||
// 'this' in this context is the Plugin object
|
||||
metrics.beginMeasuringPlugin(thisPlugin);
|
||||
} catch (IOException e) {
|
||||
// Failed to submit the stats :-(
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
//Just add in more else if blocks for versions that need updater code. Increment the updateFrom age int as we do so.
|
||||
//Catch all for versions not matching and no specific code being needed
|
||||
else if (!vnum.equalsIgnoreCase(this.getDescription().getVersion())) {
|
||||
updateFrom(-1);
|
||||
}
|
||||
}
|
||||
|
||||
public PlayerProfile getPlayerProfile(Player player)
|
||||
{
|
||||
return Users.getProfile(player);
|
||||
}
|
||||
|
||||
public void checkXp(Player player, SkillType skillType)
|
||||
{
|
||||
if(skillType == SkillType.ALL)
|
||||
Skills.XpCheckAll(player);
|
||||
else
|
||||
Skills.XpCheckSkill(skillType, player);
|
||||
}
|
||||
|
||||
public boolean inSameParty(Player playera, Player playerb)
|
||||
{
|
||||
if(Users.getProfile(playera).inParty() && Users.getProfile(playerb).inParty()){
|
||||
if(Users.getProfile(playera).getParty().equals(Users.getProfile(playerb).getParty())){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public ArrayList<String> getParties(){
|
||||
String location = "plugins/mcMMO/mcmmo.users";
|
||||
ArrayList<String> parties = new ArrayList<String>();
|
||||
try {
|
||||
//Open the users file
|
||||
FileReader file = new FileReader(location);
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
String line = "";
|
||||
while((line = in.readLine()) != null)
|
||||
{
|
||||
String[] character = line.split(":");
|
||||
String theparty = null;
|
||||
//Party
|
||||
if(character.length > 3)
|
||||
theparty = character[3];
|
||||
if(!parties.contains(theparty))
|
||||
parties.add(theparty);
|
||||
}
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Exception while reading "
|
||||
+ location + " (Are you sure you formatted it correctly?)", e);
|
||||
}
|
||||
return parties;
|
||||
}
|
||||
public static String getPartyName(Player player){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
return PP.getParty();
|
||||
}
|
||||
public static boolean inParty(Player player){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
return PP.inParty();
|
||||
}
|
||||
this.config = new LoadProperties(this);
|
||||
this.config.load();
|
||||
|
||||
public void onDisable()
|
||||
{
|
||||
//Make sure to save player information if the server shuts down
|
||||
for(Player x : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
Users.getProfile(x).save();
|
||||
}
|
||||
|
||||
Bukkit.getServer().getScheduler().cancelTasks(this); //This removes our tasks
|
||||
|
||||
System.out.println("mcMMO was disabled."); //How informative!
|
||||
}
|
||||
|
||||
private void registerCommands() {
|
||||
//Register aliases with the aliasmap (used in the playercommandpreprocessevent to ugly alias them to actual commands)
|
||||
//Skills commands
|
||||
aliasMap.put(mcLocale.getString("m.SkillAcrobatics").toLowerCase(), "acrobatics");
|
||||
aliasMap.put(mcLocale.getString("m.SkillArchery").toLowerCase(), "archery");
|
||||
aliasMap.put(mcLocale.getString("m.SkillAxes").toLowerCase(), "axes");
|
||||
aliasMap.put(mcLocale.getString("m.SkillExcavation").toLowerCase(), "excavation");
|
||||
aliasMap.put(mcLocale.getString("m.SkillFishing").toLowerCase(), "fishing");
|
||||
aliasMap.put(mcLocale.getString("m.SkillHerbalism").toLowerCase(), "herbalism");
|
||||
aliasMap.put(mcLocale.getString("m.SkillMining").toLowerCase(), "mining");
|
||||
aliasMap.put(mcLocale.getString("m.SkillRepair").toLowerCase(), "repair");
|
||||
aliasMap.put(mcLocale.getString("m.SkillSwords").toLowerCase(), "swords");
|
||||
aliasMap.put(mcLocale.getString("m.SkillTaming").toLowerCase(), "taming");
|
||||
aliasMap.put(mcLocale.getString("m.SkillUnarmed").toLowerCase(), "unarmed");
|
||||
aliasMap.put(mcLocale.getString("m.SkillWoodCutting").toLowerCase(), "woodcutting");
|
||||
|
||||
|
||||
//Register commands
|
||||
//Skills commands
|
||||
getCommand("acrobatics").setExecutor(new AcrobaticsCommand());
|
||||
getCommand("archery").setExecutor(new ArcheryCommand());
|
||||
getCommand("axes").setExecutor(new AxesCommand());
|
||||
getCommand("excavation").setExecutor(new ExcavationCommand());
|
||||
getCommand("fishing").setExecutor(new FishingCommand());
|
||||
getCommand("herbalism").setExecutor(new HerbalismCommand());
|
||||
getCommand("mining").setExecutor(new MiningCommand());
|
||||
getCommand("repair").setExecutor(new RepairCommand());
|
||||
getCommand("swords").setExecutor(new SwordsCommand());
|
||||
getCommand("taming").setExecutor(new TamingCommand());
|
||||
getCommand("unarmed").setExecutor(new UnarmedCommand());
|
||||
getCommand("woodcutting").setExecutor(new WoodcuttingCommand());
|
||||
|
||||
//Mc* commands
|
||||
if(LoadProperties.mcremoveEnable) getCommand("mcremove").setExecutor(new McremoveCommand());
|
||||
if(LoadProperties.mcabilityEnable) getCommand("mcability").setExecutor(new McabilityCommand());
|
||||
if(LoadProperties.mccEnable) getCommand("mcc").setExecutor(new MccCommand());
|
||||
if(LoadProperties.mcgodEnable) getCommand("mcgod").setExecutor(new McgodCommand());
|
||||
if(LoadProperties.mcmmoEnable) getCommand("mcmmo").setExecutor(new McmmoCommand());
|
||||
if(LoadProperties.mcrefreshEnable) getCommand("mcrefresh").setExecutor(new McrefreshCommand(this));
|
||||
if(LoadProperties.mctopEnable) getCommand("mctop").setExecutor(new MctopCommand());
|
||||
|
||||
//Party commands
|
||||
if(LoadProperties.acceptEnable) getCommand("accept").setExecutor(new AcceptCommand());
|
||||
if(LoadProperties.aEnable) getCommand("a").setExecutor(new ACommand());
|
||||
if(LoadProperties.inviteEnable) getCommand("invite").setExecutor(new InviteCommand(this));
|
||||
if(LoadProperties.partyEnable) getCommand("party").setExecutor(new PartyCommand());
|
||||
if(LoadProperties.pEnable) getCommand("p").setExecutor(new PCommand());
|
||||
if(LoadProperties.ptpEnable) getCommand("ptp").setExecutor(new PtpCommand(this));
|
||||
|
||||
//Other commands
|
||||
if(LoadProperties.addxpEnable) getCommand("addxp").setExecutor(new AddxpCommand(this));
|
||||
if(LoadProperties.addlevelsEnable) getCommand("addlevels").setExecutor(new AddlevelsCommand(this));
|
||||
if(LoadProperties.mmoeditEnable) getCommand("mmoedit").setExecutor(new MmoeditCommand(this));
|
||||
getCommand("mmoupdate").setExecutor(new MmoupdateCommand());
|
||||
if(LoadProperties.mcstatsEnable) getCommand("mcstats").setExecutor(new McstatsCommand());
|
||||
if(LoadProperties.inspectEnable) getCommand("inspect").setExecutor(new InspectCommand(this));
|
||||
if(LoadProperties.xprateEnable) getCommand("xprate").setExecutor(new XprateCommand());
|
||||
|
||||
//Spout commands
|
||||
getCommand("mchud").setExecutor(new MchudCommand());
|
||||
if(LoadProperties.xplockEnable) getCommand("xplock").setExecutor(new XplockCommand());
|
||||
|
||||
}
|
||||
this.config2 = new LoadTreasures(this);
|
||||
this.config2.load();
|
||||
|
||||
/*
|
||||
* It is important to always assume that you are updating from the lowest possible version.
|
||||
* Thus, every block of updater code should be complete and self-contained; finishing all
|
||||
* SQL transactions and closing all file handlers, such that the next block of updater code
|
||||
* if called will handle updating as expected.
|
||||
*/
|
||||
public void updateFrom(int age) {
|
||||
//No updater code needed, just update the version.
|
||||
if(age == -1) {
|
||||
updateVersion();
|
||||
return;
|
||||
}
|
||||
//Updater code from age 1 goes here
|
||||
if(age <= 1) {
|
||||
//Since age 1 is an example for now, we will just let it do nothing.
|
||||
|
||||
}
|
||||
//If we are updating from age 1 but we need more to reach age 2, this will run too.
|
||||
if(age <= 2) {
|
||||
|
||||
}
|
||||
updateVersion();
|
||||
}
|
||||
|
||||
public void updateVersion() {
|
||||
try {
|
||||
versionFile.createNewFile();
|
||||
BufferedWriter vout = new BufferedWriter(new FileWriter(versionFile));
|
||||
vout.write(this.getDescription().getVersion());
|
||||
vout.close();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
} catch (SecurityException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
Party.getInstance().loadParties();
|
||||
new Party(this);
|
||||
|
||||
public String readVersion() {
|
||||
byte[] buffer = new byte[(int) versionFile.length()];
|
||||
BufferedInputStream f = null;
|
||||
try {
|
||||
f = new BufferedInputStream(new FileInputStream(versionFile));
|
||||
f.read(buffer);
|
||||
} catch (FileNotFoundException ex) {
|
||||
ex.printStackTrace();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
if (f != null) try { f.close(); } catch (IOException ignored) { }
|
||||
}
|
||||
|
||||
return new String(buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Boilerplate Custom Config Stuff
|
||||
*/
|
||||
|
||||
private FileConfiguration treasuresConfig = null;
|
||||
private File treasuresConfigFile = null;
|
||||
|
||||
public void reloadTreasuresConfig() {
|
||||
if (treasuresConfigFile == null) {
|
||||
treasuresConfigFile = new File(getDataFolder(), "treasures.yml");
|
||||
}
|
||||
treasuresConfig = YamlConfiguration.loadConfiguration(treasuresConfigFile);
|
||||
|
||||
// Look for defaults in the jar
|
||||
InputStream defConfigStream = getResource("treasures.yml");
|
||||
if (defConfigStream != null) {
|
||||
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
|
||||
treasuresConfig.setDefaults(defConfig);
|
||||
}
|
||||
}
|
||||
|
||||
public FileConfiguration getTreasuresConfig() {
|
||||
if (treasuresConfig == null) {
|
||||
reloadTreasuresConfig();
|
||||
}
|
||||
return treasuresConfig;
|
||||
}
|
||||
|
||||
public void saveTreasuresConfig() {
|
||||
if (treasuresConfig == null || treasuresConfigFile == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
treasuresConfig.save(treasuresConfigFile);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE, "Could not save config to " + treasuresConfigFile, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!LoadProperties.useMySQL) {
|
||||
Users.getInstance().loadUsers();
|
||||
}
|
||||
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
|
||||
if (pm.getPlugin("Spout") != null) {
|
||||
LoadProperties.spoutEnabled = true;
|
||||
}
|
||||
else {
|
||||
LoadProperties.spoutEnabled = false;
|
||||
}
|
||||
|
||||
//Register events
|
||||
pm.registerEvents(playerListener, this);
|
||||
pm.registerEvents(blockListener, this);
|
||||
pm.registerEvents(entityListener, this);
|
||||
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
|
||||
//Setup the leaderboards
|
||||
if (LoadProperties.useMySQL) {
|
||||
database = new Database(this);
|
||||
database.createStructure();
|
||||
}
|
||||
else {
|
||||
Leaderboard.makeLeaderboards();
|
||||
}
|
||||
|
||||
for (Player player : getServer().getOnlinePlayers()) {
|
||||
Users.addUser(player); //In case of reload add all users back into PlayerProfile
|
||||
}
|
||||
|
||||
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||
|
||||
BukkitScheduler scheduler = getServer().getScheduler();
|
||||
|
||||
//Periodic save timer (Saves every 10 minutes)
|
||||
scheduler.scheduleSyncRepeatingTask(this, new mcSaveTimer(this), 0, LoadProperties.saveInterval * 1200);
|
||||
//Regen & Cooldown timer (Runs every second)
|
||||
scheduler.scheduleSyncRepeatingTask(this, new mcTimer(this), 0, 20);
|
||||
//Bleed timer (Runs every two seconds)
|
||||
scheduler.scheduleSyncRepeatingTask(this, new mcBleedTimer(this), 0, 40);
|
||||
|
||||
registerCommands();
|
||||
|
||||
//Spout Stuff
|
||||
if (LoadProperties.spoutEnabled) {
|
||||
SpoutStuff.setupSpoutConfigs();
|
||||
SpoutStuff.registerCustomEvent();
|
||||
SpoutStuff.extractFiles(); //Extract source materials
|
||||
|
||||
FileManager FM = SpoutManager.getFileManager();
|
||||
FM.addToPreLoginCache(this, SpoutStuff.getFiles());
|
||||
}
|
||||
|
||||
if (LoadProperties.statsTracking) {
|
||||
//Plugin Metrics running in a new thread
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
// create a new metrics object
|
||||
Metrics metrics = new Metrics();
|
||||
|
||||
// 'this' in this context is the Plugin object
|
||||
metrics.beginMeasuringPlugin(thisPlugin);
|
||||
}
|
||||
catch (IOException e) {
|
||||
System.out.println("Failed to submit stats.");
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile of the player.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player Player whose profile to get
|
||||
* @return the PlayerProfile object
|
||||
*/
|
||||
public PlayerProfile getPlayerProfile(Player player) {
|
||||
return Users.getProfile(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the XP of a player.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player
|
||||
* @param skillType
|
||||
*/
|
||||
public void checkXp(Player player, SkillType skillType) {
|
||||
if (skillType == SkillType.ALL) {
|
||||
Skills.XpCheckAll(player);
|
||||
}
|
||||
else {
|
||||
Skills.XpCheckSkill(skillType, player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if two players are in the same party.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playera The first player to check
|
||||
* @param playerb The second player to check
|
||||
* @return true if the two players are in the same party, false otherwise
|
||||
*/
|
||||
public boolean inSameParty(Player playera, Player playerb) {
|
||||
if (Users.getProfile(playera).inParty() && Users.getProfile(playerb).inParty()) {
|
||||
if (Users.getProfile(playera).getParty().equals(Users.getProfile(playerb).getParty())) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all current party names.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @return the list of parties.
|
||||
*/
|
||||
public ArrayList<String> getParties() {
|
||||
String location = "plugins/mcMMO/mcmmo.users";
|
||||
ArrayList<String> parties = new ArrayList<String>();
|
||||
|
||||
try {
|
||||
|
||||
//Open the users file
|
||||
FileReader file = new FileReader(location);
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
String line = "";
|
||||
|
||||
while((line = in.readLine()) != null) {
|
||||
String[] character = line.split(":");
|
||||
String theparty = null;
|
||||
|
||||
//Party
|
||||
if (character.length > 3) {
|
||||
theparty = character[3];
|
||||
}
|
||||
|
||||
if (!parties.contains(theparty)) {
|
||||
parties.add(theparty);
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Bukkit.getLogger().severe("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
return parties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the party a player is in.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to check the party name of
|
||||
* @return the name of the player's party
|
||||
*/
|
||||
public static String getPartyName(Player player) {
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
return PP.getParty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a player is in a party.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param player The player to check
|
||||
* @return true if the player is in a party, false otherwise
|
||||
*/
|
||||
public static boolean inParty(Player player) {
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
return PP.inParty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Things to be run when the plugin is disabled.
|
||||
*/
|
||||
public void onDisable() {
|
||||
|
||||
//Make sure to save player information if the server shuts down
|
||||
for (PlayerProfile x : Users.getProfiles().values()) {
|
||||
x.save();
|
||||
}
|
||||
|
||||
Bukkit.getServer().getScheduler().cancelTasks(this); //This removes our tasks
|
||||
System.out.println("mcMMO was disabled."); //How informative!
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands.
|
||||
*/
|
||||
private void registerCommands() {
|
||||
|
||||
//Register aliases with the aliasmap (used in the playercommandpreprocessevent to ugly alias them to actual commands)
|
||||
//Skills commands
|
||||
aliasMap.put(mcLocale.getString("m.SkillAcrobatics").toLowerCase(), "acrobatics");
|
||||
aliasMap.put(mcLocale.getString("m.SkillArchery").toLowerCase(), "archery");
|
||||
aliasMap.put(mcLocale.getString("m.SkillAxes").toLowerCase(), "axes");
|
||||
aliasMap.put(mcLocale.getString("m.SkillExcavation").toLowerCase(), "excavation");
|
||||
aliasMap.put(mcLocale.getString("m.SkillFishing").toLowerCase(), "fishing");
|
||||
aliasMap.put(mcLocale.getString("m.SkillHerbalism").toLowerCase(), "herbalism");
|
||||
aliasMap.put(mcLocale.getString("m.SkillMining").toLowerCase(), "mining");
|
||||
aliasMap.put(mcLocale.getString("m.SkillRepair").toLowerCase(), "repair");
|
||||
aliasMap.put(mcLocale.getString("m.SkillSwords").toLowerCase(), "swords");
|
||||
aliasMap.put(mcLocale.getString("m.SkillTaming").toLowerCase(), "taming");
|
||||
aliasMap.put(mcLocale.getString("m.SkillUnarmed").toLowerCase(), "unarmed");
|
||||
aliasMap.put(mcLocale.getString("m.SkillWoodCutting").toLowerCase(), "woodcutting");
|
||||
|
||||
//Register commands
|
||||
//Skills commands
|
||||
getCommand("acrobatics").setExecutor(new AcrobaticsCommand());
|
||||
getCommand("archery").setExecutor(new ArcheryCommand());
|
||||
getCommand("axes").setExecutor(new AxesCommand());
|
||||
getCommand("excavation").setExecutor(new ExcavationCommand());
|
||||
getCommand("fishing").setExecutor(new FishingCommand());
|
||||
getCommand("herbalism").setExecutor(new HerbalismCommand());
|
||||
getCommand("mining").setExecutor(new MiningCommand());
|
||||
getCommand("repair").setExecutor(new RepairCommand());
|
||||
getCommand("swords").setExecutor(new SwordsCommand());
|
||||
getCommand("taming").setExecutor(new TamingCommand());
|
||||
getCommand("unarmed").setExecutor(new UnarmedCommand());
|
||||
getCommand("woodcutting").setExecutor(new WoodcuttingCommand());
|
||||
|
||||
//mc* commands
|
||||
if (LoadProperties.mcremoveEnable) {
|
||||
getCommand("mcremove").setExecutor(new McremoveCommand());
|
||||
}
|
||||
|
||||
if (LoadProperties.mcabilityEnable) {
|
||||
getCommand("mcability").setExecutor(new McabilityCommand());
|
||||
}
|
||||
|
||||
if (LoadProperties.mccEnable) {
|
||||
getCommand("mcc").setExecutor(new MccCommand());
|
||||
}
|
||||
|
||||
if (LoadProperties.mcgodEnable) {
|
||||
getCommand("mcgod").setExecutor(new McgodCommand());
|
||||
}
|
||||
|
||||
if (LoadProperties.mcmmoEnable) {
|
||||
getCommand("mcmmo").setExecutor(new McmmoCommand());
|
||||
}
|
||||
|
||||
if (LoadProperties.mcrefreshEnable) {
|
||||
getCommand("mcrefresh").setExecutor(new McrefreshCommand(this));
|
||||
}
|
||||
|
||||
if (LoadProperties.mctopEnable) {
|
||||
getCommand("mctop").setExecutor(new MctopCommand());
|
||||
}
|
||||
|
||||
if (LoadProperties.mcstatsEnable) {
|
||||
getCommand("mcstats").setExecutor(new McstatsCommand());
|
||||
}
|
||||
|
||||
//Party commands
|
||||
if (LoadProperties.acceptEnable) {
|
||||
getCommand("accept").setExecutor(new AcceptCommand());
|
||||
}
|
||||
|
||||
if (LoadProperties.aEnable) {
|
||||
getCommand("a").setExecutor(new ACommand());
|
||||
}
|
||||
|
||||
if (LoadProperties.inviteEnable) {
|
||||
getCommand("invite").setExecutor(new InviteCommand(this));
|
||||
}
|
||||
|
||||
if (LoadProperties.partyEnable) {
|
||||
getCommand("party").setExecutor(new PartyCommand());
|
||||
}
|
||||
|
||||
if (LoadProperties.pEnable) {
|
||||
getCommand("p").setExecutor(new PCommand());
|
||||
}
|
||||
|
||||
if (LoadProperties.ptpEnable) {
|
||||
getCommand("ptp").setExecutor(new PtpCommand(this));
|
||||
}
|
||||
|
||||
//Other commands
|
||||
if (LoadProperties.addxpEnable) {
|
||||
getCommand("addxp").setExecutor(new AddxpCommand(this));
|
||||
}
|
||||
|
||||
if (LoadProperties.addlevelsEnable) {
|
||||
getCommand("addlevels").setExecutor(new AddlevelsCommand(this));
|
||||
}
|
||||
|
||||
if (LoadProperties.mmoeditEnable) {
|
||||
getCommand("mmoedit").setExecutor(new MmoeditCommand());
|
||||
}
|
||||
|
||||
if (LoadProperties.inspectEnable) {
|
||||
getCommand("inspect").setExecutor(new InspectCommand(this));
|
||||
}
|
||||
|
||||
if (LoadProperties.xprateEnable) {
|
||||
getCommand("xprate").setExecutor(new XprateCommand());
|
||||
}
|
||||
|
||||
getCommand("mmoupdate").setExecutor(new MmoupdateCommand());
|
||||
|
||||
//Spout commands
|
||||
if (LoadProperties.xplockEnable) {
|
||||
getCommand("xplock").setExecutor(new XplockCommand());
|
||||
}
|
||||
|
||||
getCommand("mchud").setExecutor(new MchudCommand());
|
||||
}
|
||||
|
||||
/**
|
||||
* Update mcMMO from a given version
|
||||
* </p>
|
||||
* It is important to always assume that you are updating from the lowest possible version.
|
||||
* Thus, every block of updater code should be complete and self-contained; finishing all
|
||||
* SQL transactions and closing all file handlers, such that the next block of updater code
|
||||
* if called will handle updating as expected.
|
||||
*
|
||||
* @param age Specifies which updater code to run
|
||||
*/
|
||||
public void updateFrom(int age) {
|
||||
|
||||
//No updater code needed, just update the version.
|
||||
if (age == -1) {
|
||||
updateVersion();
|
||||
return;
|
||||
}
|
||||
|
||||
//Updater code from age 1 goes here
|
||||
if (age <= 1) {
|
||||
//Since age 1 is an example for now, we will just let it do nothing.
|
||||
}
|
||||
|
||||
//If we are updating from age 1 but we need more to reach age 2, this will run too.
|
||||
if (age <= 2) {
|
||||
|
||||
}
|
||||
updateVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the version file.
|
||||
*/
|
||||
public void updateVersion() {
|
||||
try {
|
||||
versionFile.createNewFile();
|
||||
BufferedWriter vout = new BufferedWriter(new FileWriter(versionFile));
|
||||
vout.write(this.getDescription().getVersion());
|
||||
vout.close();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
catch (SecurityException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current mcMMO version.
|
||||
*
|
||||
* @return a String representing the current mcMMO version
|
||||
*/
|
||||
public String readVersion() {
|
||||
byte[] buffer = new byte[(int) versionFile.length()];
|
||||
BufferedInputStream f = null;
|
||||
|
||||
try {
|
||||
f = new BufferedInputStream(new FileInputStream(versionFile));
|
||||
f.read(buffer);
|
||||
}
|
||||
catch (FileNotFoundException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
if (f != null) {
|
||||
try {
|
||||
f.close();
|
||||
}
|
||||
catch (IOException ignored) {}
|
||||
}
|
||||
}
|
||||
return new String(buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Boilerplate Custom Config Stuff
|
||||
*/
|
||||
|
||||
private FileConfiguration treasuresConfig = null;
|
||||
private File treasuresConfigFile = null;
|
||||
|
||||
/**
|
||||
* Reload the Treasures.yml file.
|
||||
*/
|
||||
public void reloadTreasuresConfig() {
|
||||
if (treasuresConfigFile == null) {
|
||||
treasuresConfigFile = new File(getDataFolder(), "treasures.yml");
|
||||
}
|
||||
|
||||
treasuresConfig = YamlConfiguration.loadConfiguration(treasuresConfigFile);
|
||||
InputStream defConfigStream = getResource("treasures.yml"); // Look for defaults in the jar
|
||||
|
||||
if (defConfigStream != null) {
|
||||
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
|
||||
treasuresConfig.setDefaults(defConfig);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Treasures config information.
|
||||
*
|
||||
* @return the configuration object for treasures.yml
|
||||
*/
|
||||
public FileConfiguration getTreasuresConfig() {
|
||||
if (treasuresConfig == null) {
|
||||
reloadTreasuresConfig();
|
||||
}
|
||||
|
||||
return treasuresConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the Treasures config informtion.
|
||||
*/
|
||||
public void saveTreasuresConfig() {
|
||||
if (treasuresConfig == null || treasuresConfigFile == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
treasuresConfig.save(treasuresConfigFile);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
Bukkit.getLogger().severe("Could not save config to " + treasuresConfigFile + ex.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,135 +1,394 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class mcPermissions
|
||||
{
|
||||
public class mcPermissions {
|
||||
private static volatile mcPermissions instance;
|
||||
|
||||
|
||||
public boolean permission(Player player, String perm) {
|
||||
return player.hasPermission(perm);
|
||||
}
|
||||
public boolean admin(Player player){
|
||||
return player.hasPermission("mcmmo.admin");
|
||||
}
|
||||
public boolean mcrefresh(Player player) {
|
||||
return player.hasPermission("mcmmo.tools.mcrefresh");
|
||||
}
|
||||
public boolean mcremove(Player player) {
|
||||
return player.hasPermission("mcmmo.tools.mcremove");
|
||||
}
|
||||
public boolean mmoedit(Player player) {
|
||||
return player.hasPermission("mcmmo.tools.mmoedit");
|
||||
}
|
||||
public boolean herbalismAbility(Player player){
|
||||
return player.hasPermission("mcmmo.ability.herbalism");
|
||||
}
|
||||
public boolean excavationAbility(Player player){
|
||||
return player.hasPermission("mcmmo.ability.excavation");
|
||||
}
|
||||
public boolean unarmedAbility(Player player){
|
||||
return player.hasPermission("mcmmo.ability.unarmed");
|
||||
}
|
||||
public boolean chimaeraWing(Player player){
|
||||
return player.hasPermission("mcmmo.item.chimaerawing");
|
||||
}
|
||||
public boolean miningAbility(Player player){
|
||||
return player.hasPermission("mcmmo.ability.mining");
|
||||
}
|
||||
public boolean axesAbility(Player player){
|
||||
return player.hasPermission("mcmmo.ability.axes");
|
||||
}
|
||||
public boolean swordsAbility(Player player){
|
||||
return player.hasPermission("mcmmo.ability.swords");
|
||||
}
|
||||
public boolean woodCuttingAbility(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.woodcutting");
|
||||
}
|
||||
public boolean mcgod(Player player) {
|
||||
return player.hasPermission("mcmmo.tools.mcgod");
|
||||
|
||||
public static mcPermissions getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new mcPermissions();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
/*
|
||||
* GENERIC PERMISSIONS
|
||||
*/
|
||||
|
||||
public boolean motd(Player player) {
|
||||
return player.hasPermission("mcmmo.motd");
|
||||
}
|
||||
|
||||
public boolean admin(Player player) {
|
||||
return player.hasPermission("mcmmo.admin");
|
||||
}
|
||||
|
||||
public boolean arcaneBypass(Player player) {
|
||||
return player.hasPermission(("mcmmo.repair.arcanebypass"));
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.TOOLS.*
|
||||
*/
|
||||
|
||||
public boolean mcrefresh(Player player) {
|
||||
return player.hasPermission("mcmmo.tools.mcrefresh");
|
||||
}
|
||||
|
||||
public boolean mcremove(Player player) {
|
||||
return player.hasPermission("mcmmo.tools.mcremove");
|
||||
}
|
||||
|
||||
public boolean mmoedit(Player player) {
|
||||
return player.hasPermission("mcmmo.tools.mmoedit");
|
||||
}
|
||||
|
||||
public boolean mcgod(Player player) {
|
||||
return player.hasPermission("mcmmo.tools.mcgod");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.ABILITY.TAMING.*
|
||||
*/
|
||||
|
||||
public boolean fastFoodService(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.taming.fastfoodservice");
|
||||
}
|
||||
|
||||
public boolean sharpenedclaws(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.taming.sharpenedclaws");
|
||||
}
|
||||
|
||||
public boolean gore(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.taming.gore");
|
||||
}
|
||||
|
||||
public boolean callOfTheWild(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.taming.callofthewild");
|
||||
}
|
||||
|
||||
public boolean environmentallyAware(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.taming.environmentallyaware");
|
||||
}
|
||||
|
||||
public boolean thickFur(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.taming.thickfur");
|
||||
}
|
||||
|
||||
public boolean shockProof(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.taming.shockproof");
|
||||
}
|
||||
|
||||
public boolean beastLore(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.taming.beastlore");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.ABILITY.FISHING.*
|
||||
*/
|
||||
|
||||
public boolean shakeMob(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.fishing.shakemob");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.ABILITY.MINING.*
|
||||
*/
|
||||
|
||||
public boolean superBreaker(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.mining.superbreaker");
|
||||
}
|
||||
|
||||
public boolean miningDoubleDrops(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.mining.doubledrops");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.ABILITY.WOODCUTTING.*
|
||||
*/
|
||||
|
||||
public boolean treeFeller(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.woodcutting.treefeller");
|
||||
}
|
||||
|
||||
public boolean leafBlower(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.woodcutting.leafblower");
|
||||
}
|
||||
|
||||
public boolean woodcuttingDoubleDrops(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.woodcutting.doubledrops");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.ABILITY.REPAIR.*
|
||||
*/
|
||||
|
||||
public boolean repairBonus(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.repair.repairbonus");
|
||||
}
|
||||
|
||||
public boolean arcaneForging(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.repair.arcaneforging");
|
||||
}
|
||||
|
||||
public boolean stoneRepair(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.repair.stonerepair");
|
||||
}
|
||||
|
||||
public boolean ironRepair(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.repair.ironrepair");
|
||||
}
|
||||
|
||||
public boolean goldRepair(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.repair.goldrepair");
|
||||
}
|
||||
|
||||
public boolean diamondRepair(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.repair.diamondrepair");
|
||||
}
|
||||
|
||||
public boolean armorRepair(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.repair.armorrepair");
|
||||
}
|
||||
|
||||
public boolean toolRepair(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.repair.toolrepair");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.ABILITY.UNARMED.*
|
||||
*/
|
||||
|
||||
public boolean unarmedBonus(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.unarmed.bonusdamage");
|
||||
}
|
||||
|
||||
public boolean disarm(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.unarmed.disarm");
|
||||
}
|
||||
|
||||
public boolean berserk(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.unarmed.berserk");
|
||||
}
|
||||
|
||||
public boolean deflect(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.unarmed.deflect");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.ABILITY.ARCHERY.*
|
||||
*/
|
||||
|
||||
public boolean trackArrows(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.archery.trackarrows");
|
||||
}
|
||||
|
||||
public boolean ignition(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.archery.ignition");
|
||||
}
|
||||
|
||||
public boolean daze(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.archery.daze");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.ABILITY.HERBALISM.*
|
||||
*/
|
||||
|
||||
public boolean herbalismDoubleDrops(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.herbalism.doubledrops");
|
||||
}
|
||||
|
||||
public boolean greenTerra(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.herbalism.greenterra");
|
||||
}
|
||||
|
||||
public boolean greenThumbBlocks(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.herbalism.greenthumbblocks");
|
||||
}
|
||||
|
||||
public boolean greenThumbWheat(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.herbalism.greenthumbwheat");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.ABILITY.EXCAVATION.*
|
||||
*/
|
||||
|
||||
public boolean gigaDrillBreaker(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.excavation.gigadrillbreaker");
|
||||
}
|
||||
|
||||
public boolean excavationTreasures(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.excavation.treasures");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.ABILITY.SWORDS.*
|
||||
*/
|
||||
|
||||
public boolean swordsBleed(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.swords.bleed");
|
||||
}
|
||||
|
||||
public boolean serratedStrikes(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.swords.serratedstrikes");
|
||||
}
|
||||
|
||||
public boolean counterAttack(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.swords.counterattack");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.ABILITY.AXES.*
|
||||
*/
|
||||
|
||||
public boolean skullSplitter(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.axes.skullsplitter");
|
||||
}
|
||||
|
||||
public boolean axeBonus(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.axes.bonusdamage");
|
||||
}
|
||||
|
||||
public boolean criticalHit(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.axes.criticalhit");
|
||||
}
|
||||
|
||||
public boolean impact(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.axes.impact");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.ABILITY.ACROBATICS.*
|
||||
*/
|
||||
|
||||
public boolean roll(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.acrobatics.roll");
|
||||
}
|
||||
|
||||
public boolean gracefulRoll(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.acrobatics.gracefulroll");
|
||||
}
|
||||
|
||||
public boolean dodge(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.acrobatics.dodge");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.ABILITY.BLASTMINING.*
|
||||
*/
|
||||
|
||||
public boolean biggerBombs(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.blastmining.biggerbombs");
|
||||
}
|
||||
|
||||
public boolean demolitionsExpertise(Player player) {
|
||||
return player.hasPermission("mcmmo.ability.blastmining.demolitionsexpertise");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.ITEM.*
|
||||
*/
|
||||
|
||||
public boolean chimaeraWing(Player player) {
|
||||
return player.hasPermission("mcmmo.item.chimaerawing");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.COMMANDS.*
|
||||
*/
|
||||
|
||||
public boolean mcAbility(Player player) {
|
||||
return player.hasPermission("mcmmo.commands.ability");
|
||||
}
|
||||
public boolean partyChat(Player player) {
|
||||
return player.hasPermission("mcmmo.chat.partychat");
|
||||
}
|
||||
public boolean partyLock(Player player) {
|
||||
return player.hasPermission("mcmmo.chat.partylock");
|
||||
}
|
||||
|
||||
public boolean partyTeleport(Player player) {
|
||||
return player.hasPermission("mcmmo.commands.ptp");
|
||||
}
|
||||
|
||||
public boolean inspect(Player player) {
|
||||
return player.hasPermission("mcmmo.commands.inspect");
|
||||
}
|
||||
|
||||
public boolean party(Player player) {
|
||||
return player.hasPermission("mcmmo.commands.party");
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.CHAT.*
|
||||
*/
|
||||
|
||||
public boolean partyChat(Player player) {
|
||||
return player.hasPermission("mcmmo.chat.partychat");
|
||||
}
|
||||
|
||||
public boolean partyLock(Player player) {
|
||||
return player.hasPermission("mcmmo.chat.partylock");
|
||||
}
|
||||
|
||||
public boolean adminChat(Player player) {
|
||||
return player.hasPermission("mcmmo.chat.adminchat");
|
||||
}
|
||||
public static mcPermissions getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new mcPermissions();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/*
|
||||
* MCMMO.SKILLS.*
|
||||
*/
|
||||
|
||||
public boolean taming(Player player) {
|
||||
return player.hasPermission("mcmmo.skills.taming");
|
||||
}
|
||||
|
||||
public boolean mining(Player player) {
|
||||
return player.hasPermission("mcmmo.skills.mining");
|
||||
}
|
||||
|
||||
public boolean blastMining(Player player) {
|
||||
return player.hasPermission("mcmmo.skills.blastmining");
|
||||
}
|
||||
|
||||
public boolean fishing(Player player) {
|
||||
return player.hasPermission("mcmmo.skills.fishing");
|
||||
}
|
||||
|
||||
public boolean woodcutting(Player player) {
|
||||
return player.hasPermission("mcmmo.skills.woodcutting");
|
||||
}
|
||||
|
||||
public boolean repair(Player player) {
|
||||
return player.hasPermission("mcmmo.skills.repair");
|
||||
}
|
||||
|
||||
public boolean unarmed(Player player) {
|
||||
return player.hasPermission("mcmmo.skills.unarmed");
|
||||
}
|
||||
|
||||
public boolean archery(Player player) {
|
||||
return player.hasPermission("mcmmo.skills.archery");
|
||||
}
|
||||
|
||||
public boolean herbalism(Player player) {
|
||||
return player.hasPermission("mcmmo.skills.herbalism");
|
||||
}
|
||||
|
||||
public boolean excavation(Player player) {
|
||||
return player.hasPermission("mcmmo.skills.excavation");
|
||||
}
|
||||
|
||||
public boolean swords(Player player) {
|
||||
return player.hasPermission("mcmmo.skills.swords");
|
||||
}
|
||||
|
||||
public boolean axes(Player player) {
|
||||
return player.hasPermission("mcmmo.skills.axes");
|
||||
}
|
||||
|
||||
public boolean acrobatics(Player player) {
|
||||
return player.hasPermission("mcmmo.skills.acrobatics");
|
||||
}
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.party;
|
||||
|
||||
import java.io.EOFException;
|
||||
@@ -30,14 +14,14 @@ import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
|
||||
public class Party
|
||||
{
|
||||
public class Party {
|
||||
/*
|
||||
* This file is part of mmoMinecraft (http://code.google.com/p/mmo-minecraft/).
|
||||
*
|
||||
@@ -393,7 +377,7 @@ public class Party
|
||||
ObjectInputStream obj = new ObjectInputStream(new FileInputStream(partyPlayersFile));
|
||||
this.partyPlayers = (HashMap<String, HashMap<String, Boolean>>)obj.readObject();
|
||||
} catch (FileNotFoundException e) { e.printStackTrace();
|
||||
} catch (EOFException e) { mcMMO.log.info("partyPlayersFile empty.");
|
||||
} catch (EOFException e) { Bukkit.getLogger().info("partyPlayersFile empty.");
|
||||
} catch (IOException e) { e.printStackTrace();
|
||||
} catch (ClassNotFoundException e) { e.printStackTrace(); }
|
||||
}
|
||||
@@ -403,7 +387,7 @@ public class Party
|
||||
ObjectInputStream obj = new ObjectInputStream(new FileInputStream(partyLocksFile));
|
||||
this.partyLocks = (HashMap<String, Boolean>)obj.readObject();
|
||||
} catch (FileNotFoundException e) { e.printStackTrace();
|
||||
} catch (EOFException e) { mcMMO.log.info("partyLocksFile empty.");
|
||||
} catch (EOFException e) { Bukkit.getLogger().info("partyLocksFile empty.");
|
||||
} catch (IOException e) { e.printStackTrace();
|
||||
} catch (ClassNotFoundException e) { e.printStackTrace(); }
|
||||
}
|
||||
@@ -413,7 +397,7 @@ public class Party
|
||||
ObjectInputStream obj = new ObjectInputStream(new FileInputStream(partyPasswordsFile));
|
||||
this.partyPasswords = (HashMap<String, String>)obj.readObject();
|
||||
} catch (FileNotFoundException e) { e.printStackTrace();
|
||||
} catch (EOFException e) { mcMMO.log.info("partyPasswordsFile empty.");
|
||||
} catch (EOFException e) { Bukkit.getLogger().info("partyPasswordsFile empty.");
|
||||
} catch (IOException e) { e.printStackTrace();
|
||||
} catch (ClassNotFoundException e) { e.printStackTrace(); }
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
/*
|
||||
* This file was created for a breakage introduced in 1.1-R2
|
||||
* It should be removed afterwards if the breakage is removed.
|
||||
*/
|
||||
public class ChangeDataValueTimer implements Runnable {
|
||||
private ArrayDeque<Block> queue;
|
||||
|
||||
public ChangeDataValueTimer(ArrayDeque<Block> queue) {
|
||||
this.queue = queue;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
int size = queue.size();
|
||||
if(size == 0) return;
|
||||
if(size > 25) {
|
||||
size = (int) Math.floor(size / 10);
|
||||
}
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
Block change = queue.poll();
|
||||
if(change == null) continue;
|
||||
change.setData((byte) 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
45
src/main/java/com/gmail/nossr50/runnables/GainXp.java
Normal file
45
src/main/java/com/gmail/nossr50/runnables/GainXp.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
|
||||
public class GainXp implements Runnable {
|
||||
private Player player = null;
|
||||
private PlayerProfile PP = null;
|
||||
private double baseXp = 0;
|
||||
private SkillType skillType = null;
|
||||
private LivingEntity target = null;
|
||||
private int baseHealth = 0;
|
||||
|
||||
public GainXp(Player player, PlayerProfile PP, SkillType skillType, double baseXp, LivingEntity target) {
|
||||
this.player = player;
|
||||
this.PP = PP;
|
||||
this.skillType = skillType;
|
||||
this.baseXp = baseXp;
|
||||
this.target = target;
|
||||
baseHealth = target.getHealth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
int health = target.getHealth();
|
||||
int damage = baseHealth - health;
|
||||
|
||||
//May avoid negative xp, we don't know what other plugins do with the entity health
|
||||
if (damage <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Don't reward the player for overkills
|
||||
if (health < 0) {
|
||||
damage += health;
|
||||
}
|
||||
|
||||
PP.addXP(skillType, (int) (damage * baseXp), player);
|
||||
Skills.XpCheckSkill(skillType, player);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import org.bukkit.CropState;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
|
||||
public class GreenThumbTimer implements Runnable {
|
||||
private Block block;
|
||||
private PlayerProfile PP;
|
||||
|
||||
public GreenThumbTimer(Block block, PlayerProfile PP) {
|
||||
this.block = block;
|
||||
this.PP = PP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
block.setType(Material.CROPS);
|
||||
|
||||
//This replants the wheat at a certain stage in development based on Herbalism Skill
|
||||
if (!PP.getGreenTerraMode()) {
|
||||
if (PP.getSkillLevel(SkillType.HERBALISM) >= 600) {
|
||||
block.setData(CropState.MEDIUM.getData());
|
||||
}
|
||||
else if (PP.getSkillLevel(SkillType.HERBALISM) >= 400) {
|
||||
block.setData(CropState.SMALL.getData());
|
||||
}
|
||||
else if (PP.getSkillLevel(SkillType.HERBALISM) >= 200) {
|
||||
block.setData(CropState.VERY_SMALL.getData());
|
||||
}
|
||||
else {
|
||||
block.setData(CropState.GERMINATED.getData());
|
||||
}
|
||||
}
|
||||
else {
|
||||
block.setData(CropState.MEDIUM.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ public class RemoveProfileFromMemoryTask implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Users.removeUser(player);
|
||||
Users.getProfile(player.getName()).save(); //We save here so players don't quit/reconnect to cause lag
|
||||
Users.removeUserByName(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
284
src/main/java/com/gmail/nossr50/runnables/SQLConversionTask.java
Normal file
284
src/main/java/com/gmail/nossr50/runnables/SQLConversionTask.java
Normal file
@@ -0,0 +1,284 @@
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
|
||||
public class SQLConversionTask implements Runnable {
|
||||
public SQLConversionTask() {}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
|
||||
|
||||
try {
|
||||
FileReader file = new FileReader(location);
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
String line = "";
|
||||
String playerName = null;
|
||||
String party = null;
|
||||
String mining = null;
|
||||
String woodcutting = null;
|
||||
String repair = null;
|
||||
String unarmed = null;
|
||||
String herbalism = null;
|
||||
String excavation = null;
|
||||
String archery = null;
|
||||
String swords = null;
|
||||
String axes = null;
|
||||
String acrobatics = null;
|
||||
String taming = null;
|
||||
String fishing = null;
|
||||
String miningXP = null;
|
||||
String woodCuttingXP = null;
|
||||
String repairXP = null;
|
||||
String unarmedXP = null;
|
||||
String herbalismXP = null;
|
||||
String excavationXP = null;
|
||||
String archeryXP = null;
|
||||
String swordsXP = null;
|
||||
String axesXP = null;
|
||||
String acrobaticsXP = null;
|
||||
String tamingXP = null;
|
||||
String fishingXP = null;
|
||||
int id = 0;
|
||||
int theCount = 0;
|
||||
|
||||
while ((line = in.readLine()) != null) {
|
||||
|
||||
//Find if the line contains the player we want.
|
||||
String[] character = line.split(":");
|
||||
playerName = character[0];
|
||||
|
||||
//Check for things we don't want put in the DB
|
||||
if (playerName == null || playerName.equals("null") || playerName.equals("#Storage place for user information")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (character.length > 1) {
|
||||
mining = character[1];
|
||||
}
|
||||
|
||||
if (character.length > 3) {
|
||||
party = character[3];
|
||||
}
|
||||
|
||||
if (character.length > 4) {
|
||||
miningXP = character[4];
|
||||
}
|
||||
|
||||
if (character.length > 5) {
|
||||
woodcutting = character[5];
|
||||
}
|
||||
|
||||
if (character.length > 6) {
|
||||
woodCuttingXP = character[6];
|
||||
}
|
||||
|
||||
if (character.length > 7) {
|
||||
repair = character[7];
|
||||
}
|
||||
|
||||
if (character.length > 8) {
|
||||
unarmed = character[8];
|
||||
}
|
||||
|
||||
if (character.length > 9) {
|
||||
herbalism = character[9];
|
||||
}
|
||||
|
||||
if (character.length > 10) {
|
||||
excavation = character[10];
|
||||
}
|
||||
|
||||
if (character.length > 11) {
|
||||
archery = character[11];
|
||||
}
|
||||
|
||||
if (character.length > 12) {
|
||||
swords = character[12];
|
||||
}
|
||||
|
||||
if (character.length > 13) {
|
||||
axes = character[13];
|
||||
}
|
||||
|
||||
if (character.length > 14) {
|
||||
acrobatics = character[14];
|
||||
}
|
||||
|
||||
if (character.length > 15) {
|
||||
repairXP = character[15];
|
||||
}
|
||||
|
||||
if (character.length > 16) {
|
||||
unarmedXP = character[16];
|
||||
}
|
||||
|
||||
if (character.length > 17) {
|
||||
herbalismXP = character[17];
|
||||
}
|
||||
|
||||
if (character.length > 18) {
|
||||
excavationXP = character[18];
|
||||
}
|
||||
|
||||
if (character.length > 19) {
|
||||
archeryXP = character[19];
|
||||
}
|
||||
|
||||
if (character.length > 20) {
|
||||
swordsXP = character[20];
|
||||
}
|
||||
|
||||
if (character.length > 21) {
|
||||
axesXP = character[21];
|
||||
}
|
||||
|
||||
if (character.length > 22) {
|
||||
acrobaticsXP = character[22];
|
||||
}
|
||||
|
||||
if (character.length > 24) {
|
||||
taming = character[24];
|
||||
}
|
||||
|
||||
if (character.length > 25) {
|
||||
tamingXP = character[25];
|
||||
}
|
||||
|
||||
if (character.length > 34) {
|
||||
fishing = character[34];
|
||||
}
|
||||
|
||||
if (character.length > 35) {
|
||||
fishingXP = character[35];
|
||||
}
|
||||
|
||||
//Check to see if the user is in the DB
|
||||
id = mcMMO.database.getInt("SELECT id FROM "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "users WHERE user = '" + playerName + "'");
|
||||
|
||||
if (id > 0) {
|
||||
theCount++;
|
||||
|
||||
//Update the skill values
|
||||
mcMMO.database.write("UPDATE "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "users SET lastlogin = " + 0
|
||||
+ " WHERE id = " + id);
|
||||
mcMMO.database.write("UPDATE "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "skills SET " + " taming = taming+"
|
||||
+ m.getInt(taming) + ", mining = mining+"
|
||||
+ m.getInt(mining) + ", repair = repair+"
|
||||
+ m.getInt(repair)
|
||||
+ ", woodcutting = woodcutting+"
|
||||
+ m.getInt(woodcutting)
|
||||
+ ", unarmed = unarmed+" + m.getInt(unarmed)
|
||||
+ ", herbalism = herbalism+"
|
||||
+ m.getInt(herbalism)
|
||||
+ ", excavation = excavation+"
|
||||
+ m.getInt(excavation)
|
||||
+ ", archery = archery+" + m.getInt(archery)
|
||||
+ ", swords = swords+" + m.getInt(swords)
|
||||
+ ", axes = axes+" + m.getInt(axes)
|
||||
+ ", acrobatics = acrobatics+"
|
||||
+ m.getInt(acrobatics)
|
||||
+ ", fishing = fishing+" + m.getInt(fishing)
|
||||
+ " WHERE user_id = " + id);
|
||||
mcMMO.database.write("UPDATE "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "experience SET " + " taming = "
|
||||
+ m.getInt(tamingXP) + ", mining = "
|
||||
+ m.getInt(miningXP) + ", repair = "
|
||||
+ m.getInt(repairXP) + ", woodcutting = "
|
||||
+ m.getInt(woodCuttingXP) + ", unarmed = "
|
||||
+ m.getInt(unarmedXP) + ", herbalism = "
|
||||
+ m.getInt(herbalismXP) + ", excavation = "
|
||||
+ m.getInt(excavationXP) + ", archery = "
|
||||
+ m.getInt(archeryXP) + ", swords = "
|
||||
+ m.getInt(swordsXP) + ", axes = "
|
||||
+ m.getInt(axesXP) + ", acrobatics = "
|
||||
+ m.getInt(acrobaticsXP) + ", fishing = "
|
||||
+ m.getInt(fishingXP) + " WHERE user_id = "
|
||||
+ id);
|
||||
}
|
||||
else {
|
||||
theCount++;
|
||||
|
||||
//Create the user in the DB
|
||||
mcMMO.database.write("INSERT INTO "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "users (user, lastlogin) VALUES ('"
|
||||
+ playerName + "',"
|
||||
+ System.currentTimeMillis() / 1000 + ")");
|
||||
id = mcMMO.database.getInt("SELECT id FROM "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "users WHERE user = '"
|
||||
+ playerName + "'");
|
||||
mcMMO.database.write("INSERT INTO "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "skills (user_id) VALUES (" + id + ")");
|
||||
mcMMO.database.write("INSERT INTO "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "experience (user_id) VALUES (" + id
|
||||
+ ")");
|
||||
//Update the skill values
|
||||
mcMMO.database.write("UPDATE "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "users SET lastlogin = " + 0
|
||||
+ " WHERE id = " + id);
|
||||
mcMMO.database.write("UPDATE "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "users SET party = '" + party
|
||||
+ "' WHERE id = " + id);
|
||||
mcMMO.database.write("UPDATE "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "skills SET " + " taming = "
|
||||
+ m.getInt(taming) + ", mining = "
|
||||
+ m.getInt(mining) + ", repair = "
|
||||
+ m.getInt(repair) + ", woodcutting = "
|
||||
+ m.getInt(woodcutting) + ", unarmed = "
|
||||
+ m.getInt(unarmed) + ", herbalism = "
|
||||
+ m.getInt(herbalism) + ", excavation = "
|
||||
+ m.getInt(excavation) + ", archery = "
|
||||
+ m.getInt(archery) + ", swords = "
|
||||
+ m.getInt(swords) + ", axes = "
|
||||
+ m.getInt(axes) + ", acrobatics = "
|
||||
+ m.getInt(acrobatics) + ", fishing = "
|
||||
+ m.getInt(fishing) + " WHERE user_id = "
|
||||
+ id);
|
||||
mcMMO.database.write("UPDATE "
|
||||
+ LoadProperties.MySQLtablePrefix
|
||||
+ "experience SET " + " taming = "
|
||||
+ m.getInt(tamingXP) + ", mining = "
|
||||
+ m.getInt(miningXP) + ", repair = "
|
||||
+ m.getInt(repairXP) + ", woodcutting = "
|
||||
+ m.getInt(woodCuttingXP) + ", unarmed = "
|
||||
+ m.getInt(unarmedXP) + ", herbalism = "
|
||||
+ m.getInt(herbalismXP) + ", excavation = "
|
||||
+ m.getInt(excavationXP) + ", archery = "
|
||||
+ m.getInt(archeryXP) + ", swords = "
|
||||
+ m.getInt(swordsXP) + ", axes = "
|
||||
+ m.getInt(axesXP) + ", acrobatics = "
|
||||
+ m.getInt(acrobaticsXP) + ", fishing = "
|
||||
+ m.getInt(fishingXP) + " WHERE user_id = "
|
||||
+ id);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("[mcMMO] MySQL Updated from users file, " + theCount + " items added/updated to MySQL DB");
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Bukkit.getLogger().severe("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
142
src/main/java/com/gmail/nossr50/runnables/mcBleedTimer.java
Normal file
142
src/main/java/com/gmail/nossr50/runnables/mcBleedTimer.java
Normal file
@@ -0,0 +1,142 @@
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Combat;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class mcBleedTimer implements Runnable {
|
||||
private final mcMMO plugin;
|
||||
|
||||
private static HashSet<LivingEntity> bleedList = new HashSet<LivingEntity>();
|
||||
private static HashSet<LivingEntity> bleedAddList = new HashSet<LivingEntity>();
|
||||
private static HashSet<LivingEntity> bleedRemoveList = new HashSet<LivingEntity>();
|
||||
|
||||
private static boolean lock = false;
|
||||
|
||||
public mcBleedTimer(final mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
updateBleedList();
|
||||
|
||||
// Player bleed simulation
|
||||
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if (PP == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (PP.getBleedTicks() >= 1) {
|
||||
|
||||
//Never kill with Bleeding
|
||||
if (player.getHealth() - 2 < 0) {
|
||||
if (player.getHealth() - 1 > 0) {
|
||||
Combat.dealDamage(player, 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Combat.dealDamage(player, 2);
|
||||
}
|
||||
|
||||
PP.decreaseBleedTicks();
|
||||
|
||||
if (PP.getBleedTicks() == 0) {
|
||||
player.sendMessage(mcLocale.getString("Swords.StoppedBleeding"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Non-player bleed simulation
|
||||
bleedSimulate();
|
||||
}
|
||||
|
||||
private void bleedSimulate() {
|
||||
lock = true;
|
||||
|
||||
// Bleed monsters/animals
|
||||
for (LivingEntity entity : bleedList) {
|
||||
if ((entity == null || entity.isDead())) {
|
||||
remove(entity);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
Combat.dealDamage(entity, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Unlock list now that we are done
|
||||
lock = false;
|
||||
}
|
||||
|
||||
private void updateBleedList() {
|
||||
if (lock) {
|
||||
plugin.getLogger().warning("mcBleedTimer attempted to update the bleedList but the list was locked!");
|
||||
}
|
||||
else {
|
||||
bleedList.removeAll(bleedRemoveList);
|
||||
bleedRemoveList.clear();
|
||||
|
||||
bleedList.addAll(bleedAddList);
|
||||
bleedAddList.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a LivingEntity from the bleedList if it is in it
|
||||
*
|
||||
* @param entity LivingEntity to remove
|
||||
*/
|
||||
public static void remove(LivingEntity entity) {
|
||||
if (lock) {
|
||||
if (!bleedRemoveList.contains(entity)) {
|
||||
bleedRemoveList.add(entity);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (bleedList.contains(entity)) {
|
||||
bleedList.remove(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a LivingEntity to the bleedList if it is not in it.
|
||||
*
|
||||
* @param entity LivingEntity to add
|
||||
*/
|
||||
public static void add(LivingEntity entity) {
|
||||
if (lock) {
|
||||
if (!bleedAddList.contains(entity)) {
|
||||
bleedAddList.add(entity);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!bleedList.contains(entity)){
|
||||
bleedList.add(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if a LivingEntity is in the bleedList
|
||||
*
|
||||
* @param entity LivingEntity to check if in the bleedList
|
||||
* @return true if in the list, false if not
|
||||
*/
|
||||
public static boolean contains(LivingEntity entity) {
|
||||
return (bleedList.contains(entity) || bleedAddList.contains(entity));
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -29,6 +13,7 @@ public class mcSaveTimer implements Runnable {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
//All player data will be saved periodically through this
|
||||
|
||||
@@ -1,37 +1,17 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import org.bukkit.entity.*;
|
||||
|
||||
import com.gmail.nossr50.Combat;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
import com.gmail.nossr50.skills.Swords;
|
||||
|
||||
|
||||
public class mcTimer implements Runnable
|
||||
{
|
||||
private final mcMMO plugin;
|
||||
int thecount = 1;
|
||||
|
||||
public mcTimer(final mcMMO plugin)
|
||||
{
|
||||
@@ -72,37 +52,6 @@ public class mcTimer implements Runnable
|
||||
Skills.watchCooldown(player, PP, curTime, AbilityType.BERSERK);
|
||||
Skills.watchCooldown(player, PP, curTime, AbilityType.TREE_FELLER);
|
||||
Skills.watchCooldown(player, PP, curTime, AbilityType.BLAST_MINING);
|
||||
|
||||
/*
|
||||
* PLAYER BLEED MONITORING
|
||||
*/
|
||||
if(thecount % 2 == 0 && PP.getBleedTicks() >= 1)
|
||||
{
|
||||
//Never kill with Bleeding
|
||||
if(player.getHealth() - 2 < 0)
|
||||
{
|
||||
if(player.getHealth() - 1 > 0)
|
||||
Combat.dealDamage(player, 1);
|
||||
} else
|
||||
Combat.dealDamage(player, 2);
|
||||
|
||||
PP.decreaseBleedTicks();
|
||||
|
||||
if(PP.getBleedTicks() == 0)
|
||||
player.sendMessage(mcLocale.getString("Swords.StoppedBleeding"));
|
||||
}
|
||||
|
||||
/*
|
||||
* NON-PLAYER BLEED MONITORING
|
||||
*/
|
||||
|
||||
if(thecount % 2 == 0)
|
||||
Swords.bleedSimulate(plugin);
|
||||
|
||||
//SETUP FOR HP REGEN/BLEED
|
||||
thecount++;
|
||||
if(thecount >= 81)
|
||||
thecount = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -21,85 +5,121 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public class Acrobatics {
|
||||
public static void acrobaticsCheck(Player player, EntityDamageEvent event)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int acrovar = PP.getSkillLevel(SkillType.ACROBATICS);
|
||||
|
||||
if(player.isSneaking())
|
||||
acrovar = acrovar * 2;
|
||||
|
||||
if(Math.random() * 1000 <= acrovar)
|
||||
{
|
||||
int threshold = 7;
|
||||
|
||||
if(player.isSneaking())
|
||||
threshold = 14;
|
||||
|
||||
int newDamage = event.getDamage() - threshold;
|
||||
|
||||
if(newDamage < 0)
|
||||
newDamage = 0;
|
||||
|
||||
/*
|
||||
* Check for death
|
||||
*/
|
||||
if(player.getHealth() - newDamage >= 1)
|
||||
{
|
||||
PP.addXP(SkillType.ACROBATICS, (event.getDamage() * 8)*10, player);
|
||||
Skills.XpCheckSkill(SkillType.ACROBATICS, player);
|
||||
event.setDamage(newDamage);
|
||||
if(event.getDamage() <= 0)
|
||||
event.setCancelled(true);
|
||||
if(player.isSneaking()){
|
||||
player.sendMessage(mcLocale.getString("Acrobatics.GracefulRoll"));
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("Acrobatics.Roll"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(player.getHealth() - event.getDamage() >= 1)
|
||||
{
|
||||
PP.addXP(SkillType.ACROBATICS, (event.getDamage() * 12)*10, player);
|
||||
Skills.XpCheckSkill(SkillType.ACROBATICS, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for fall damage reduction.
|
||||
*
|
||||
* @param player The player whose fall damage to modify
|
||||
* @param event The event to check
|
||||
*/
|
||||
public static void acrobaticsCheck(Player player, EntityDamageEvent event) {
|
||||
final int ROLL_XP_MODIFIER = 80;
|
||||
final int FALL_XP_MODIFIER = 120;
|
||||
final int MAX_BONUS_LEVEL = 1000;
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int acrovar = PP.getSkillLevel(SkillType.ACROBATICS);
|
||||
boolean gracefulRoll = player.isSneaking();
|
||||
int damage = event.getDamage();
|
||||
int health = player.getHealth();
|
||||
|
||||
if (!mcPermissions.getInstance().gracefulRoll(player)) {
|
||||
gracefulRoll = false;
|
||||
}
|
||||
|
||||
if (gracefulRoll) {
|
||||
acrovar = acrovar * 2;
|
||||
}
|
||||
|
||||
if ((acrovar > MAX_BONUS_LEVEL || Math.random() * 1000 <= acrovar) && mcPermissions.getInstance().roll(player)) {
|
||||
int threshold = 7;
|
||||
|
||||
if (gracefulRoll) {
|
||||
threshold = threshold * 2;
|
||||
}
|
||||
|
||||
int newDamage = damage - threshold;
|
||||
|
||||
if (newDamage < 0) {
|
||||
newDamage = 0;
|
||||
}
|
||||
|
||||
/* Check for death */
|
||||
if (health - damage >= 1) {
|
||||
PP.addXP(SkillType.ACROBATICS, damage * ROLL_XP_MODIFIER, player);
|
||||
Skills.XpCheckSkill(SkillType.ACROBATICS, player);
|
||||
|
||||
event.setDamage(newDamage);
|
||||
|
||||
if (event.getDamage() <= 0) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (gracefulRoll) {
|
||||
player.sendMessage(mcLocale.getString("Acrobatics.GracefulRoll"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(mcLocale.getString("Acrobatics.Roll"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (health - damage >= 1) {
|
||||
PP.addXP(SkillType.ACROBATICS, event.getDamage() * FALL_XP_MODIFIER, player);
|
||||
Skills.XpCheckSkill(SkillType.ACROBATICS, player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for dodge damage reduction.
|
||||
*
|
||||
* @param event The event to check
|
||||
*/
|
||||
public static void dodgeChecks(EntityDamageByEntityEvent event) {
|
||||
final int DODGE_MODIFIER = 120;
|
||||
final int MAX_BONUS_LEVEL = 800;
|
||||
|
||||
Player defender = (Player) event.getEntity();
|
||||
PlayerProfile PPd = Users.getProfile(defender);
|
||||
int damage = event.getDamage();
|
||||
|
||||
/* PARTY CHECK */
|
||||
if (event.getDamager() instanceof Player) {
|
||||
Player attacker = (Player) event.getDamager();
|
||||
|
||||
if (Party.getInstance().inSameParty(defender, attacker)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (mcPermissions.getInstance().acrobatics(defender)) {
|
||||
int skillLevel = PPd.getSkillLevel(SkillType.ACROBATICS);
|
||||
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL);
|
||||
|
||||
if (Math.random() * 4000 <= skillCheck && mcPermissions.getInstance().dodge(defender)) {
|
||||
defender.sendMessage(mcLocale.getString("Acrobatics.Dodge"));
|
||||
|
||||
if (System.currentTimeMillis() >= (5000 + PPd.getRespawnATS()) && defender.getHealth() >= 1) {
|
||||
PPd.addXP(SkillType.ACROBATICS, damage * DODGE_MODIFIER, defender);
|
||||
Skills.XpCheckSkill(SkillType.ACROBATICS, defender);
|
||||
}
|
||||
|
||||
int newDamage = damage / 2;
|
||||
|
||||
if (newDamage <= 0) {
|
||||
event.setDamage(1);
|
||||
}
|
||||
else {
|
||||
event.setDamage(newDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void dodgeChecks(EntityDamageByEntityEvent event){
|
||||
Player defender = (Player) event.getEntity();
|
||||
PlayerProfile PPd = Users.getProfile(defender);
|
||||
|
||||
if(mcPermissions.getInstance().acrobatics(defender)){
|
||||
if(PPd.getSkillLevel(SkillType.ACROBATICS) <= 800){
|
||||
if(Math.random() * 4000 <= PPd.getSkillLevel(SkillType.ACROBATICS)){
|
||||
defender.sendMessage(mcLocale.getString("Acrobatics.Dodge"));
|
||||
if(System.currentTimeMillis() >= 5000 + PPd.getRespawnATS() && defender.getHealth() >= 1){
|
||||
PPd.addXP(SkillType.ACROBATICS, (event.getDamage() * 12)*1, defender);
|
||||
Skills.XpCheckSkill(SkillType.ACROBATICS, defender);
|
||||
}
|
||||
event.setDamage(event.getDamage() / 2);
|
||||
//Needs to do minimal damage
|
||||
if(event.getDamage() <= 0)
|
||||
event.setDamage(1);
|
||||
}
|
||||
} else if(Math.random() * 4000 <= 800) {
|
||||
defender.sendMessage(mcLocale.getString("Acrobatics.Dodge"));
|
||||
if(System.currentTimeMillis() >= 5000 + PPd.getRespawnATS() && defender.getHealth() >= 1){
|
||||
PPd.addXP(SkillType.ACROBATICS, (event.getDamage() * 12)*10, defender);
|
||||
Skills.XpCheckSkill(SkillType.ACROBATICS, defender);
|
||||
}
|
||||
event.setDamage(event.getDamage() / 2);
|
||||
//Needs to deal minimal damage
|
||||
if(event.getDamage() <= 0)
|
||||
event.setDamage(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,22 +1,7 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -24,93 +9,116 @@ import org.bukkit.inventory.ItemStack;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public class Archery
|
||||
{
|
||||
public static void trackArrows(mcMMO pluginx, Entity x, PlayerProfile PPa)
|
||||
{
|
||||
int skillLevel = PPa.getSkillLevel(SkillType.ARCHERY);
|
||||
if(!pluginx.misc.arrowTracker.containsKey(x))
|
||||
pluginx.misc.arrowTracker.put(x, 0);
|
||||
if(skillLevel > 1000 || (Math.random() * 1000 <= skillLevel))
|
||||
pluginx.misc.arrowTracker.put(x, 1);
|
||||
}
|
||||
|
||||
public static void ignitionCheck(Entity x, Player attacker)
|
||||
{
|
||||
//Check to see if PVP for this world is disabled before executing
|
||||
if(!x.getWorld().getPVP())
|
||||
return;
|
||||
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
if(Math.random() * 100 >= 75)
|
||||
{
|
||||
int ignition = 20;
|
||||
ignition += (PPa.getSkillLevel(SkillType.ARCHERY)/200)*20;
|
||||
|
||||
if(ignition > 120)
|
||||
ignition = 120;
|
||||
|
||||
if(x instanceof Player)
|
||||
{
|
||||
Player defender = (Player)x;
|
||||
if(!Party.getInstance().inSameParty(attacker, defender))
|
||||
{
|
||||
defender.setFireTicks(defender.getFireTicks() + ignition);
|
||||
attacker.sendMessage(mcLocale.getString("Combat.Ignition")); //$NON-NLS-1$
|
||||
defender.sendMessage(mcLocale.getString("Combat.BurningArrowHit")); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x.setFireTicks(x.getFireTicks() + ignition);
|
||||
attacker.sendMessage(mcLocale.getString("Combat.Ignition")); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void dazeCheck(Player defender, Player attacker)
|
||||
{
|
||||
int skillLevel = Users.getProfile(attacker).getSkillLevel(SkillType.ARCHERY);
|
||||
|
||||
Location loc = defender.getLocation();
|
||||
if(Math.random() * 10 > 5)
|
||||
loc.setPitch(90);
|
||||
else
|
||||
loc.setPitch(-90);
|
||||
|
||||
if(skillLevel >= 1000)
|
||||
{
|
||||
if(Math.random() * 1000 <= 500)
|
||||
{
|
||||
defender.teleport(loc);
|
||||
defender.sendMessage(mcLocale.getString("Combat.TouchedFuzzy")); //$NON-NLS-1$
|
||||
attacker.sendMessage(mcLocale.getString("Combat.TargetDazed")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
else if(Math.random() * 2000 <= skillLevel)
|
||||
{
|
||||
defender.teleport(loc);
|
||||
defender.sendMessage(mcLocale.getString("Combat.TouchedFuzzy")); //$NON-NLS-1$
|
||||
attacker.sendMessage(mcLocale.getString("Combat.TargetDazed")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
|
||||
public static void arrowRetrievalCheck(Entity entity, mcMMO plugin)
|
||||
{
|
||||
if(plugin.misc.arrowTracker.containsKey(entity))
|
||||
{
|
||||
Integer x = 0;
|
||||
while(x < plugin.misc.arrowTracker.get(entity))
|
||||
{
|
||||
m.mcDropItem(entity.getLocation(), new ItemStack(262, 1));
|
||||
x++;
|
||||
}
|
||||
}
|
||||
plugin.misc.arrowTracker.remove(entity);
|
||||
public class Archery {
|
||||
|
||||
/**
|
||||
* Track arrows fired for later retrieval.
|
||||
*
|
||||
* @param plugin mcMMO plugin instance
|
||||
* @param entity Entity damaged by the arrow
|
||||
* @param PPa PlayerProfile of the player firing the arrow
|
||||
*/
|
||||
public static void trackArrows(mcMMO plugin, Entity entity, PlayerProfile PPa) {
|
||||
final int MAX_BONUS_LEVEL = 1000;
|
||||
int skillLevel = PPa.getSkillLevel(SkillType.ARCHERY);
|
||||
|
||||
if (!plugin.arrowTracker.containsKey(entity)) {
|
||||
plugin.arrowTracker.put(entity, 0);
|
||||
}
|
||||
|
||||
if (skillLevel > MAX_BONUS_LEVEL || (Math.random() * 1000 <= skillLevel)) {
|
||||
plugin.arrowTracker.put(entity, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for ignition on arrow hit.
|
||||
*
|
||||
* @param entity Entity damaged by the arrow
|
||||
* @param attacker Player who fired the arrow
|
||||
*/
|
||||
public static void ignitionCheck(Entity entity, Player attacker) {
|
||||
|
||||
//Check to see if PVP for this world is disabled before executing
|
||||
if (!entity.getWorld().getPVP()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int IGNITION_CHANCE = 25;
|
||||
final int MAX_IGNITION_TICKS = 120;
|
||||
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
|
||||
if (Math.random() * 100 <= IGNITION_CHANCE) {
|
||||
int ignition = 20;
|
||||
|
||||
/* Add 20 ticks for every 200 skill levels */
|
||||
ignition += (PPa.getSkillLevel(SkillType.ARCHERY) / 200) * 20;
|
||||
|
||||
if (ignition > MAX_IGNITION_TICKS) {
|
||||
ignition = MAX_IGNITION_TICKS;
|
||||
}
|
||||
|
||||
if (entity instanceof Player) {
|
||||
Player defender = (Player) entity;
|
||||
|
||||
if (!Party.getInstance().inSameParty(attacker, defender)) {
|
||||
defender.setFireTicks(defender.getFireTicks() + ignition);
|
||||
attacker.sendMessage(mcLocale.getString("Combat.Ignition"));
|
||||
defender.sendMessage(mcLocale.getString("Combat.BurningArrowHit"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
entity.setFireTicks(entity.getFireTicks() + ignition);
|
||||
attacker.sendMessage(mcLocale.getString("Combat.Ignition"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for Daze.
|
||||
*
|
||||
* @param defender Defending player
|
||||
* @param attacker Attacking player
|
||||
*/
|
||||
public static void dazeCheck(Player defender, Player attacker) {
|
||||
final int MAX_BONUS_LEVEL = 1000;
|
||||
|
||||
int skillLevel = Users.getProfile(attacker).getSkillLevel(SkillType.ARCHERY);
|
||||
Location loc = defender.getLocation();
|
||||
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL);
|
||||
|
||||
if (Math.random() * 10 > 5) {
|
||||
loc.setPitch(90);
|
||||
}
|
||||
else {
|
||||
loc.setPitch(-90);
|
||||
}
|
||||
|
||||
if (Math.random() * 2000 <= skillCheck && mcPermissions.getInstance().daze(attacker)) {
|
||||
defender.teleport(loc);
|
||||
defender.sendMessage(mcLocale.getString("Combat.TouchedFuzzy"));
|
||||
attacker.sendMessage(mcLocale.getString("Combat.TargetDazed"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for arrow retrieval.
|
||||
*
|
||||
* @param entity The entity hit by the arrows
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void arrowRetrievalCheck(Entity entity, mcMMO plugin) {
|
||||
if (plugin.arrowTracker.containsKey(entity)) {
|
||||
m.mcDropItems(entity.getLocation(), new ItemStack(Material.ARROW), plugin.arrowTracker.get(entity));
|
||||
}
|
||||
|
||||
plugin.arrowTracker.remove(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,203 +1,159 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import com.gmail.nossr50.Combat;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public class Axes {
|
||||
public static void axesBonus(Player attacker, EntityDamageByEntityEvent event)
|
||||
{
|
||||
|
||||
/**
|
||||
* Apply bonus to damage done by axes.
|
||||
*
|
||||
* @param attacker The attacking player
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static void axesBonus(Player attacker, EntityDamageByEntityEvent event) {
|
||||
final int MAX_BONUS = 4;
|
||||
|
||||
int bonus = 0;
|
||||
|
||||
//Add 1 DMG for every 50 skill levels
|
||||
bonus += Users.getProfile(attacker).getSkillLevel(SkillType.AXES)/50;
|
||||
|
||||
if(bonus > 4)
|
||||
bonus = 4;
|
||||
|
||||
|
||||
/* Add 1 DMG for every 50 skill levels */
|
||||
bonus += Users.getProfile(attacker).getSkillLevel(SkillType.AXES) / 50;
|
||||
|
||||
if (bonus > MAX_BONUS) {
|
||||
bonus = MAX_BONUS;
|
||||
}
|
||||
|
||||
event.setDamage(event.getDamage() + bonus);
|
||||
}
|
||||
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx)
|
||||
{
|
||||
Entity x = event.getEntity();
|
||||
|
||||
if(x instanceof Wolf){
|
||||
Wolf wolf = (Wolf)x;
|
||||
if(wolf.getOwner() instanceof Player)
|
||||
{
|
||||
Player owner = (Player) wolf.getOwner();
|
||||
if(owner == attacker)
|
||||
return;
|
||||
if(Party.getInstance().inSameParty(attacker, owner))
|
||||
return;
|
||||
}
|
||||
}
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
|
||||
if(PPa.getSkillLevel(SkillType.AXES) >= 750){
|
||||
if(Math.random() * 2000 <= 750 && !x.isDead()){
|
||||
if(x instanceof Player){
|
||||
int damage = (event.getDamage() * 2) - (event.getDamage() / 2);
|
||||
event.setDamage(damage);
|
||||
Player player = (Player)x;
|
||||
player.sendMessage(mcLocale.getString("Axes.HitCritically"));
|
||||
}
|
||||
else {
|
||||
int damage = event.getDamage() * 2;
|
||||
event.setDamage(damage);
|
||||
}
|
||||
attacker.sendMessage(mcLocale.getString("Axes.CriticalHit"));
|
||||
}
|
||||
} else if(Math.random() * 2000 <= PPa.getSkillLevel(SkillType.AXES) && !x.isDead()){
|
||||
if(x instanceof Player){
|
||||
int damage = (event.getDamage() * 2) - (event.getDamage() / 2);
|
||||
event.setDamage(damage);
|
||||
Player player = (Player)x;
|
||||
player.sendMessage(mcLocale.getString("Axes.HitCritically"));
|
||||
}
|
||||
else {
|
||||
int damage = event.getDamage() * 2;
|
||||
event.setDamage(damage);
|
||||
}
|
||||
attacker.sendMessage(mcLocale.getString("Axes.CriticalHit"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for critical chances on axe damage.
|
||||
*
|
||||
* @param attacker The attacking player
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (entity instanceof Wolf) {
|
||||
Wolf wolf = (Wolf) entity;
|
||||
|
||||
if (wolf.isTamed()) {
|
||||
AnimalTamer tamer = wolf.getOwner();
|
||||
|
||||
if (tamer instanceof Player) {
|
||||
Player owner = (Player) tamer;
|
||||
|
||||
if (owner == attacker || Party.getInstance().inSameParty(attacker, owner)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final int MAX_BONUS_LEVEL = 750;
|
||||
final double PVP_MODIFIER = 1.5;
|
||||
final int PVE_MODIFIER = 2;
|
||||
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
int skillLevel = PPa.getSkillLevel(SkillType.AXES);
|
||||
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL);
|
||||
|
||||
if (Math.random() * 2000 <= skillCheck && !entity.isDead()){
|
||||
int damage = event.getDamage();
|
||||
|
||||
if (entity instanceof Player){
|
||||
event.setDamage((int) (damage * PVP_MODIFIER));
|
||||
Player player = (Player) entity;
|
||||
player.sendMessage(mcLocale.getString("Axes.HitCritically"));
|
||||
}
|
||||
else {
|
||||
event.setDamage(damage * PVE_MODIFIER);
|
||||
}
|
||||
attacker.sendMessage(mcLocale.getString("Axes.CriticalHit"));
|
||||
}
|
||||
}
|
||||
|
||||
public static void impact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event)
|
||||
{
|
||||
//TODO: Finish this skill, the idea is you will greatly damage an opponents armor and when they are armor less you have a proc that will stun them and deal additional damage.
|
||||
if(target instanceof Player)
|
||||
{
|
||||
Player targetPlayer = (Player) target;
|
||||
int emptySlots = 0;
|
||||
short durDmg = 5; //Start with 5 durability dmg
|
||||
|
||||
durDmg+=Users.getProfile(attacker).getSkillLevel(SkillType.AXES)/30; //Every 30 Skill Levels you gain 1 durability dmg
|
||||
|
||||
for(ItemStack x : targetPlayer.getInventory().getArmorContents())
|
||||
{
|
||||
if(x.getType() == Material.AIR)
|
||||
{
|
||||
emptySlots++;
|
||||
} else {
|
||||
x.setDurability((short) (x.getDurability()+durDmg)); //Damage armor piece
|
||||
}
|
||||
}
|
||||
|
||||
if(emptySlots == 4)
|
||||
applyImpact(attacker, target, event);
|
||||
}
|
||||
else
|
||||
//Since mobs are technically unarmored this will always trigger
|
||||
applyImpact(attacker, target, event);
|
||||
}
|
||||
|
||||
public static void applyImpact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event)
|
||||
{
|
||||
if(Math.random() * 100 > 75)
|
||||
{
|
||||
event.setDamage(event.getDamage()+2);
|
||||
target.setVelocity(attacker.getLocation().getDirection().normalize().multiply(1.5D));
|
||||
|
||||
/**
|
||||
* Check for Impact ability.
|
||||
*
|
||||
* @param attacker The attacking player
|
||||
* @param target The defending entity
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static void impact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
|
||||
|
||||
/*
|
||||
* TODO: Finish this skill. The idea is you will greatly damage an opponents armor.
|
||||
* When they are unarmored, you have a proc that will stun them and deal additional damage.
|
||||
*/
|
||||
if (target instanceof Player) {
|
||||
Player targetPlayer = (Player) target;
|
||||
short durabilityDamage = 5; //Start with 5 durability damage
|
||||
|
||||
/* Every 30 Skill Levels you gain 1 durability damage */
|
||||
durabilityDamage += Users.getProfile(attacker).getSkillLevel(SkillType.AXES)/30;
|
||||
|
||||
if (!hasArmor(targetPlayer)) {
|
||||
applyImpact(attacker, target, event);
|
||||
}
|
||||
else {
|
||||
for (ItemStack armor : targetPlayer.getInventory().getArmorContents()) {
|
||||
armor.setDurability((short) (armor.getDurability() + durabilityDamage)); //Damage armor piece
|
||||
}
|
||||
targetPlayer.updateInventory();
|
||||
}
|
||||
}
|
||||
else {
|
||||
applyImpact(attacker, target, event); //Since mobs are technically unarmored, this will always trigger
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply impact ability.
|
||||
*
|
||||
* @param attacker The attacking player
|
||||
* @param target The defending entity
|
||||
* @param event The event to modify
|
||||
*/
|
||||
private static void applyImpact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
|
||||
final int GREATER_IMPACT_CHANCE = 25;
|
||||
final double GREATER_IMPACT_MULTIPLIER = 1.5;
|
||||
|
||||
if (Math.random() * 100 <= GREATER_IMPACT_CHANCE) {
|
||||
event.setDamage(event.getDamage() + 2);
|
||||
target.setVelocity(attacker.getLocation().getDirection().normalize().multiply(GREATER_IMPACT_MULTIPLIER));
|
||||
attacker.sendMessage(mcLocale.getString("Axes.GreaterImpactOnEnemy"));
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyAoeDamage(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx)
|
||||
{
|
||||
int targets = 0;
|
||||
|
||||
int dmgAmount = (event.getDamage()/2);
|
||||
|
||||
//Setup minimum damage
|
||||
if(dmgAmount < 1)
|
||||
dmgAmount = 1;
|
||||
|
||||
if(event.getEntity() instanceof LivingEntity)
|
||||
{
|
||||
LivingEntity x = (LivingEntity) event.getEntity();
|
||||
targets = m.getTier(attacker);
|
||||
|
||||
for(Entity derp : x.getNearbyEntities(2.5, 2.5, 2.5))
|
||||
{
|
||||
//Make sure the Wolf is not friendly
|
||||
if(derp instanceof Wolf)
|
||||
{
|
||||
Wolf hurrDurr = (Wolf)derp;
|
||||
if(hurrDurr.getOwner() instanceof Player)
|
||||
{
|
||||
Player owner = (Player) hurrDurr.getOwner();
|
||||
if(owner == attacker)
|
||||
return;
|
||||
if(Party.getInstance().inSameParty(attacker, owner))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Damage nearby LivingEntities
|
||||
if(derp instanceof LivingEntity && targets >= 1)
|
||||
{
|
||||
if(derp instanceof Player)
|
||||
{
|
||||
Player target = (Player)derp;
|
||||
|
||||
if(Users.getProfile(target).getGodMode())
|
||||
continue;
|
||||
}
|
||||
|
||||
if(target.getName().equals(attacker.getName()))
|
||||
continue;
|
||||
|
||||
if(Party.getInstance().inSameParty(attacker, target))
|
||||
continue;
|
||||
|
||||
if(target.isDead())
|
||||
continue;
|
||||
|
||||
if(targets >= 1 && derp.getWorld().getPVP())
|
||||
{
|
||||
Combat.dealDamage(target, dmgAmount, attacker);
|
||||
target.sendMessage(mcLocale.getString("Axes.HitByCleave"));
|
||||
targets--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LivingEntity target = (LivingEntity)derp;
|
||||
Combat.dealDamage(target, dmgAmount, attacker);
|
||||
targets--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Check if a player has armor.
|
||||
*
|
||||
* @param player Player whose armor to check
|
||||
* @return true if the player has armor, false otherwise
|
||||
*/
|
||||
private static boolean hasArmor(Player player) {
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
|
||||
if (inventory.getBoots() != null || inventory.getChestplate() != null || inventory.getHelmet() != null || inventory.getLeggings() != null) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,281 +1,285 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
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 com.gmail.nossr50.BlockChecks;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class BlastMining{
|
||||
|
||||
public static void explosionBlockDrops(Block block, Location loc)
|
||||
{
|
||||
int id = block.getTypeId();
|
||||
ItemStack item = new ItemStack(id, 1);
|
||||
|
||||
switch (id){
|
||||
//GLOWSTONE
|
||||
case 89:
|
||||
item = new ItemStack(348, 1);
|
||||
m.mcDropItems(loc, item, 2);
|
||||
m.mcRandomDropItems(loc, item, 50, 2);
|
||||
break;
|
||||
//REDSTONE
|
||||
case 73:
|
||||
item = new ItemStack(331, 1);
|
||||
m.mcDropItems(loc, item, 4);
|
||||
m.mcRandomDropItem(loc, item, 50);
|
||||
break;
|
||||
case 74:
|
||||
item = new ItemStack(331, 1);
|
||||
m.mcDropItems(loc, item, 4);
|
||||
m.mcRandomDropItem(loc, item, 50);
|
||||
break;
|
||||
//LAPIS
|
||||
case 21:
|
||||
item = new ItemStack(351, 1, (byte)0,(byte)0x4);
|
||||
m.mcDropItems(loc, item, 4);
|
||||
m.mcRandomDropItems(loc, item, 50, 4);
|
||||
break;
|
||||
//DIAMOND
|
||||
case 56:
|
||||
item = new ItemStack(264, 1);
|
||||
m.mcDropItem(loc, item);
|
||||
break;
|
||||
//STONE
|
||||
case 1:
|
||||
item = new ItemStack(4, 1);
|
||||
m.mcDropItem(loc, item);
|
||||
break;
|
||||
//COAL
|
||||
case 16:
|
||||
item = new ItemStack(263, 1);
|
||||
m.mcDropItem(loc, item);
|
||||
break;
|
||||
default:
|
||||
m.mcDropItem(loc, item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Block> explosionYields(List<Block> ores, List<Block> debris, float yield, float oreBonus, float debrisReduction, Location location, int extraDrops)
|
||||
{
|
||||
Iterator<Block> iterator2 = ores.iterator();
|
||||
List<Block> blocksDropped = new ArrayList<Block>();
|
||||
while(iterator2.hasNext())
|
||||
{
|
||||
Block temp = iterator2.next();
|
||||
if((float)Math.random() < (yield + oreBonus))
|
||||
{
|
||||
blocksDropped.add(temp);
|
||||
explosionBlockDrops(temp, location);
|
||||
if(extraDrops == 2)
|
||||
blocksDropped.add(temp);
|
||||
explosionBlockDrops(temp, location);
|
||||
if(extraDrops == 3)
|
||||
blocksDropped.add(temp);
|
||||
explosionBlockDrops(temp, location);
|
||||
}
|
||||
}
|
||||
|
||||
if(yield - debrisReduction != 0)
|
||||
{
|
||||
Iterator<Block> iterator3 = debris.iterator();
|
||||
while(iterator3.hasNext())
|
||||
{
|
||||
Block temp = iterator3.next();
|
||||
if((float)Math.random() < (yield - debrisReduction))
|
||||
explosionBlockDrops(temp, location);
|
||||
}
|
||||
}
|
||||
return blocksDropped;
|
||||
}
|
||||
|
||||
/*
|
||||
* Process the drops from the explosion
|
||||
*/
|
||||
public static void dropProcessing(Player player, EntityExplodeEvent event, mcMMO plugin)
|
||||
{
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);
|
||||
float yield = event.getYield();
|
||||
Location location = event.getLocation();
|
||||
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(temp.getData() != 5 && !plugin.misc.blockWatchList.contains(temp))
|
||||
{
|
||||
if(m.isOre(temp))
|
||||
ores.add(temp);
|
||||
else
|
||||
debris.add(temp);
|
||||
}
|
||||
}
|
||||
|
||||
//Normal explosion
|
||||
if(skillLevel < 125)
|
||||
return;
|
||||
|
||||
event.setYield(0);
|
||||
//+35% ores, -10% debris
|
||||
if(skillLevel >= 125 && skillLevel < 250)
|
||||
xp = explosionYields(ores, debris, yield, .35f, .10f, location, 1);
|
||||
|
||||
//+40% ores, -20% debris
|
||||
if(skillLevel >= 250 && skillLevel < 375)
|
||||
xp = explosionYields(ores, debris, yield, .40f, .20f, location, 1);
|
||||
|
||||
//No debris, +45% ores
|
||||
if(skillLevel >= 375 && skillLevel < 500)
|
||||
xp = explosionYields(ores, debris, yield, .45f, .30f, location, 1);
|
||||
|
||||
//No debris, +50% ores
|
||||
if(skillLevel >= 500 && skillLevel < 625)
|
||||
xp = explosionYields(ores, debris, yield, .50f, .30f, location, 1);
|
||||
|
||||
//Double Drops, No Debris, +55% ores
|
||||
if(skillLevel >= 625 && skillLevel < 750)
|
||||
xp = explosionYields(ores, debris, yield, .55f, .30f, location, 2);
|
||||
|
||||
//Double Drops, No Debris, +60% ores
|
||||
if(skillLevel >= 750 && skillLevel < 875)
|
||||
xp = explosionYields(ores, debris, yield, .60f, .30f, location, 2);
|
||||
|
||||
//Triple Drops, No debris, +65% ores
|
||||
if(skillLevel >= 875 && skillLevel < 1000)
|
||||
xp = explosionYields(ores, debris, yield, .65f, .30f, location, 3);
|
||||
public class BlastMining {
|
||||
|
||||
//Triple Drops, No debris, +70% ores
|
||||
if(skillLevel >= 1000)
|
||||
xp = explosionYields(ores, debris, yield, .70f, .30f, location, 3);
|
||||
|
||||
for(Block block : xp)
|
||||
{
|
||||
blastMiningXP(player, block, plugin);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Bigger Bombs (Unlocked at Mining 250)
|
||||
*
|
||||
* Increases radius of explosion by 1 at 250.
|
||||
* Increases radius of explosion by 2 at 500.
|
||||
* Increases radius of explosion by 3 at 750.
|
||||
* Increases radius of explosion by 4 at 1000.
|
||||
*/
|
||||
public static void biggerBombs(Player player, ExplosionPrimeEvent event)
|
||||
{
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);
|
||||
float radius = event.getRadius();
|
||||
if(skillLevel < 250)
|
||||
return;
|
||||
if(skillLevel >= 250)
|
||||
radius++;
|
||||
if(skillLevel >= 500)
|
||||
radius++;
|
||||
if(skillLevel >= 750)
|
||||
radius++;
|
||||
if(skillLevel >= 1000)
|
||||
radius++;
|
||||
|
||||
event.setRadius(radius);
|
||||
}
|
||||
|
||||
/*
|
||||
* Demolitions Expertise (Unlocked at Mining 500)
|
||||
*
|
||||
* Reduces explosion damage to 1/4 of normal at 500.
|
||||
* Reduces explosion damage to 1/2 of normal at 750.
|
||||
* Reduces explosion damage to 0 at 1000.
|
||||
*/
|
||||
public static void demolitionsExpertise(Player player, EntityDamageEvent event)
|
||||
{
|
||||
int skill = Users.getProfile(player).getSkillLevel(SkillType.MINING);
|
||||
int damage = event.getDamage();
|
||||
if(skill < 500)
|
||||
return;
|
||||
if(skill >= 500 && skill < 750)
|
||||
damage = damage/4;
|
||||
if(skill >= 750 && skill < 1000)
|
||||
damage = damage/2;
|
||||
if(skill >= 1000)
|
||||
damage = 0;
|
||||
|
||||
event.setDamage(damage);
|
||||
}
|
||||
/**
|
||||
* 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> iterator2 = ores.iterator();
|
||||
List<Block> blocksDropped = new ArrayList<Block>();
|
||||
|
||||
public static void blastMiningXP(Player player, Block block, mcMMO plugin)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(plugin.misc.blockWatchList.contains(block) || block.getData() == (byte) 5)
|
||||
return;
|
||||
int xp = 0;
|
||||
|
||||
switch (block.getType()) {
|
||||
//COAL
|
||||
case COAL_ORE:
|
||||
xp += LoadProperties.mcoal;
|
||||
break;
|
||||
//GOLD
|
||||
case GOLD_ORE:
|
||||
xp += LoadProperties.mgold;
|
||||
break;
|
||||
//DIAMOND
|
||||
case DIAMOND_ORE:
|
||||
xp += LoadProperties.mdiamond;
|
||||
break;
|
||||
//IRON
|
||||
case IRON_ORE:
|
||||
xp += LoadProperties.miron;
|
||||
break;
|
||||
//REDSTONE
|
||||
case REDSTONE_ORE:
|
||||
xp += LoadProperties.mredstone;
|
||||
break;
|
||||
//LAPIS
|
||||
case LAPIS_ORE:
|
||||
xp += LoadProperties.mlapis;
|
||||
break;
|
||||
}
|
||||
|
||||
PP.addXP(SkillType.MINING, xp, player);
|
||||
Skills.XpCheckSkill(SkillType.MINING, player);
|
||||
while (iterator2.hasNext()) {
|
||||
Block temp = iterator2.next();
|
||||
|
||||
if ((float) Math.random() < (yield + oreBonus)) {
|
||||
blocksDropped.add(temp);
|
||||
Mining.miningDrops(temp);
|
||||
|
||||
if (!temp.hasMetadata("mcmmoPlacedBlock")) {
|
||||
if (extraDrops == 2) {
|
||||
blocksDropped.add(temp);
|
||||
Mining.miningDrops(temp);
|
||||
}
|
||||
if (extraDrops == 3) {
|
||||
blocksDropped.add(temp);
|
||||
Mining.miningDrops(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (yield - debrisReduction != 0) {
|
||||
Iterator<Block> iterator3 = debris.iterator();
|
||||
|
||||
while (iterator3.hasNext()) {
|
||||
Block temp = iterator3.next();
|
||||
|
||||
if ((float) Math.random() < (yield - debrisReduction))
|
||||
Mining.miningDrops(temp);
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
final int RANK_1_LEVEL = 125;
|
||||
final int RANK_2_LEVEL = 250;
|
||||
final int RANK_3_LEVEL = 375;
|
||||
final int RANK_4_LEVEL = 500;
|
||||
final int RANK_5_LEVEL = 625;
|
||||
final int RANK_6_LEVEL = 750;
|
||||
final int RANK_7_LEVEL = 875;
|
||||
final int RANK_8_LEVEL = 1000;
|
||||
|
||||
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.getType())) {
|
||||
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 (!block.hasMetadata("mcmmoPlacedBlock")) {
|
||||
Mining.miningXP(player, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
final int RANK_1_LEVEL = 250;
|
||||
final int RANK_2_LEVEL = 500;
|
||||
final int RANK_3_LEVEL = 750;
|
||||
final int RANK_4_LEVEL = 1000;
|
||||
|
||||
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) {
|
||||
final int RANK_1_LEVEL = 500;
|
||||
final int RANK_2_LEVEL = 750;
|
||||
final int RANK_3_LEVEL = 1000;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remotely detonate TNT for Blast Mining.
|
||||
*
|
||||
* @param player Player detonating the TNT
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void remoteDetonation(Player player, mcMMO plugin) {
|
||||
final byte SNOW = 78;
|
||||
final byte AIR = 0;
|
||||
final int BLOCKS_AWAY = 100;
|
||||
final int TIME_CONVERSION_FACTOR = 1000;
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
HashSet<Byte> transparent = new HashSet<Byte>();
|
||||
|
||||
transparent.add(SNOW);
|
||||
transparent.add(AIR);
|
||||
|
||||
Block block = player.getTargetBlock(transparent, BLOCKS_AWAY);
|
||||
|
||||
if (block.getType().equals(Material.TNT) && m.blockBreakSimulate(block, player, true) && PP.getSkillLevel(SkillType.MINING) >= 125) {
|
||||
final int MAX_DISTANCE_AWAY = 10;
|
||||
AbilityType ability = AbilityType.BLAST_MINING;
|
||||
|
||||
/* Check Cooldown */
|
||||
if(!Skills.cooldownOver(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown())) {
|
||||
player.sendMessage(mcLocale.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + Skills.calculateTimeLeft(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Send message to nearby players */
|
||||
for(Player y : player.getWorld().getPlayers()) {
|
||||
if(y != player && m.isNear(player.getLocation(), y.getLocation(), MAX_DISTANCE_AWAY)) {
|
||||
y.sendMessage(ability.getAbilityPlayer(player));
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(mcLocale.getString("BlastMining.Boom"));
|
||||
|
||||
/* Create the TNT entity */
|
||||
TNTPrimed tnt = player.getWorld().spawn(block.getLocation(), TNTPrimed.class);
|
||||
plugin.tntTracker.put(tnt.getEntityId(), player);
|
||||
block.setType(Material.AIR);
|
||||
tnt.setFuseTicks(0);
|
||||
|
||||
PP.setSkillDATS(ability, System.currentTimeMillis()); //Save DATS for Blast Mining
|
||||
PP.setBlastMiningInformed(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,7 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@@ -24,12 +9,12 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.spout.SpoutSounds;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.config.LoadTreasures;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
@@ -38,162 +23,123 @@ import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||
|
||||
import org.getspout.spoutapi.sound.SoundEffect;
|
||||
|
||||
public class Excavation
|
||||
{
|
||||
public static boolean canBeGigaDrillBroken(Block block)
|
||||
{
|
||||
switch(block.getType()){
|
||||
case CLAY:
|
||||
case DIRT:
|
||||
case GRASS:
|
||||
case GRAVEL:
|
||||
case MYCEL:
|
||||
case SAND:
|
||||
case SOUL_SAND:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void excavationProcCheck(Block block, Player player)
|
||||
{
|
||||
Material type = block.getType();
|
||||
Location loc = block.getLocation();
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int skillLevel = PP.getSkillLevel(SkillType.EXCAVATION);
|
||||
ArrayList<ItemStack> is = new ArrayList<ItemStack>();
|
||||
int xp = LoadProperties.mbase;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case DIRT:
|
||||
for(ExcavationTreasure treasure : LoadTreasures.excavationFromDirt)
|
||||
{
|
||||
if(skillLevel >= treasure.getDropLevel())
|
||||
{
|
||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
||||
{
|
||||
xp += treasure.getXp();
|
||||
is.add(treasure.getDrop());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GRASS:
|
||||
for(ExcavationTreasure treasure : LoadTreasures.excavationFromGrass)
|
||||
{
|
||||
if(skillLevel >= treasure.getDropLevel())
|
||||
{
|
||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
||||
{
|
||||
xp += treasure.getXp();
|
||||
is.add(treasure.getDrop());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SAND:
|
||||
for(ExcavationTreasure treasure : LoadTreasures.excavationFromSand)
|
||||
{
|
||||
if(skillLevel >= treasure.getDropLevel())
|
||||
{
|
||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
||||
{
|
||||
xp += treasure.getXp();
|
||||
is.add(treasure.getDrop());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GRAVEL:
|
||||
for(ExcavationTreasure treasure : LoadTreasures.excavationFromGravel)
|
||||
{
|
||||
if(skillLevel >= treasure.getDropLevel())
|
||||
{
|
||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
||||
{
|
||||
xp += treasure.getXp();
|
||||
is.add(treasure.getDrop());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CLAY:
|
||||
for(ExcavationTreasure treasure : LoadTreasures.excavationFromClay)
|
||||
{
|
||||
if(skillLevel >= treasure.getDropLevel())
|
||||
{
|
||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
||||
{
|
||||
xp += treasure.getXp();
|
||||
is.add(treasure.getDrop());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MYCEL:
|
||||
for(ExcavationTreasure treasure : LoadTreasures.excavationFromMycel)
|
||||
{
|
||||
if(skillLevel >= treasure.getDropLevel())
|
||||
{
|
||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
||||
{
|
||||
xp += treasure.getXp();
|
||||
is.add(treasure.getDrop());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SOUL_SAND:
|
||||
for(ExcavationTreasure treasure : LoadTreasures.excavationFromSoulSand)
|
||||
{
|
||||
if(skillLevel >= treasure.getDropLevel())
|
||||
{
|
||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
||||
{
|
||||
xp += treasure.getXp();
|
||||
is.add(treasure.getDrop());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//Drop items
|
||||
for(ItemStack x : is)
|
||||
{
|
||||
if(x != null)
|
||||
m.mcDropItem(loc, x);
|
||||
}
|
||||
|
||||
//Handle XP related tasks
|
||||
PP.addXP(SkillType.EXCAVATION, xp, player);
|
||||
Skills.XpCheckSkill(SkillType.EXCAVATION, player);
|
||||
public class Excavation {
|
||||
|
||||
/**
|
||||
* Check to see if a block can be broken by Giga Drill Breaker.
|
||||
*
|
||||
* @param material The type of block to check
|
||||
* @return
|
||||
*/
|
||||
public static boolean canBeGigaDrillBroken(Material type) {
|
||||
switch (type) {
|
||||
case CLAY:
|
||||
case DIRT:
|
||||
case GRASS:
|
||||
case GRAVEL:
|
||||
case MYCEL:
|
||||
case SAND:
|
||||
case SOUL_SAND:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if treasures were found.
|
||||
*
|
||||
* @param block The block to check
|
||||
* @param player The player who broke the block
|
||||
*/
|
||||
public static void excavationProcCheck(Block block, Player player) {
|
||||
Material type = block.getType();
|
||||
Location loc = block.getLocation();
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int skillLevel = PP.getSkillLevel(SkillType.EXCAVATION);
|
||||
ArrayList<ItemStack> is = new ArrayList<ItemStack>();
|
||||
|
||||
List<ExcavationTreasure> treasures = new ArrayList<ExcavationTreasure>();
|
||||
|
||||
int xp = LoadProperties.mbase;
|
||||
|
||||
if (mcPermissions.getInstance().excavationTreasures(player)) {
|
||||
switch (type) {
|
||||
case DIRT:
|
||||
treasures = LoadTreasures.excavationFromDirt;
|
||||
break;
|
||||
|
||||
case GRASS:
|
||||
treasures = LoadTreasures.excavationFromGrass;
|
||||
break;
|
||||
|
||||
case SAND:
|
||||
treasures = LoadTreasures.excavationFromSand;
|
||||
break;
|
||||
|
||||
case GRAVEL:
|
||||
treasures = LoadTreasures.excavationFromGravel;
|
||||
break;
|
||||
|
||||
case CLAY:
|
||||
treasures = LoadTreasures.excavationFromClay;
|
||||
break;
|
||||
|
||||
case MYCEL:
|
||||
treasures = LoadTreasures.excavationFromMycel;
|
||||
break;
|
||||
|
||||
case SOUL_SAND:
|
||||
treasures = LoadTreasures.excavationFromSoulSand;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (ExcavationTreasure treasure : treasures) {
|
||||
if (skillLevel >= treasure.getDropLevel()) {
|
||||
if (Math.random() * 100 <= treasure.getDropChance()) {
|
||||
xp += treasure.getXp();
|
||||
is.add(treasure.getDrop());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Drop items
|
||||
for (ItemStack x : is) {
|
||||
if (x != null) {
|
||||
m.mcDropItem(loc, x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Handle XP related tasks
|
||||
PP.addXP(SkillType.EXCAVATION, xp, player);
|
||||
Skills.XpCheckSkill(SkillType.EXCAVATION, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle triple drops from Giga Drill Breaker.
|
||||
*
|
||||
* @param player The player using the ability
|
||||
* @param block The block to check
|
||||
*/
|
||||
public static void gigaDrillBreaker(Player player, Block block) {
|
||||
Skills.abilityDurabilityLoss(player.getItemInHand(), LoadProperties.abilityDurabilityLoss);
|
||||
|
||||
if (!block.hasMetadata("mcmmoPlacedBlock")) {
|
||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
|
||||
Excavation.excavationProcCheck(block, player);
|
||||
Excavation.excavationProcCheck(block, player);
|
||||
}
|
||||
|
||||
if (LoadProperties.spoutEnabled) {
|
||||
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
public static void gigaDrillBreaker(Player player, Block block)
|
||||
{
|
||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||
{
|
||||
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
||||
{
|
||||
short durability = player.getItemInHand().getDurability();
|
||||
durability += LoadProperties.abilityDurabilityLoss;
|
||||
player.getItemInHand().setDurability(durability);
|
||||
}
|
||||
}
|
||||
|
||||
if(block.getData() != (byte)5)
|
||||
{
|
||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
Excavation.excavationProcCheck(block, player);
|
||||
Excavation.excavationProcCheck(block, player);
|
||||
Excavation.excavationProcCheck(block, player);
|
||||
}
|
||||
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,24 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.Wool;
|
||||
|
||||
import com.gmail.nossr50.Combat;
|
||||
import com.gmail.nossr50.ItemChecks;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
@@ -38,346 +30,302 @@ import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class Fishing {
|
||||
|
||||
//Return the fishing tier for the player
|
||||
public static int getFishingLootTier(PlayerProfile PP)
|
||||
{
|
||||
int lvl = PP.getSkillLevel(SkillType.FISHING);
|
||||
/**
|
||||
* Get the player's current fishing loot tier.
|
||||
*
|
||||
* @param PP The profile of the player
|
||||
* @return the player's current fishing rank
|
||||
*/
|
||||
public static int getFishingLootTier(PlayerProfile PP) {
|
||||
int level = PP.getSkillLevel(SkillType.FISHING);
|
||||
int fishingTier;
|
||||
|
||||
if(lvl >= LoadProperties.fishingTier1 && lvl < LoadProperties.fishingTier2)
|
||||
return 1;
|
||||
else if (lvl >= LoadProperties.fishingTier2 && lvl < LoadProperties.fishingTier3)
|
||||
return 2;
|
||||
else if (lvl >= LoadProperties.fishingTier3 && lvl < LoadProperties.fishingTier4)
|
||||
return 3;
|
||||
else if (lvl >= LoadProperties.fishingTier4 && lvl < LoadProperties.fishingTier5)
|
||||
return 4;
|
||||
else
|
||||
return 5;
|
||||
}
|
||||
if (level >= LoadProperties.fishingTier5) {
|
||||
fishingTier = 5;
|
||||
}
|
||||
else if (level >= LoadProperties.fishingTier4) {
|
||||
fishingTier = 4;
|
||||
}
|
||||
else if (level >= LoadProperties.fishingTier3) {
|
||||
fishingTier = 3;
|
||||
}
|
||||
else if (level >= LoadProperties.fishingTier2) {
|
||||
fishingTier = 2;
|
||||
}
|
||||
else {
|
||||
fishingTier = 1;
|
||||
}
|
||||
|
||||
public static void getFishingResults(Player player, PlayerFishEvent event)
|
||||
{
|
||||
switch(getFishingLootTier(Users.getProfile(player)))
|
||||
{
|
||||
case 1:
|
||||
getFishingResultsTier1(player, event);
|
||||
break;
|
||||
case 2:
|
||||
getFishingResultsTier2(player, event);
|
||||
break;
|
||||
case 3:
|
||||
getFishingResultsTier3(player, event);
|
||||
break;
|
||||
case 4:
|
||||
getFishingResultsTier4(player, event);
|
||||
break;
|
||||
case 5:
|
||||
getFishingResultsTier5(player, event);
|
||||
break;
|
||||
}
|
||||
m.mcDropItem(player.getLocation(), new ItemStack(Material.RAW_FISH, 1));
|
||||
Users.getProfile(player).addXP(SkillType.FISHING, LoadProperties.mfishing, player);
|
||||
Skills.XpCheckSkill(SkillType.FISHING, player);
|
||||
}
|
||||
return fishingTier;
|
||||
}
|
||||
|
||||
private static void getFishingResultsTier1(Player player, PlayerFishEvent event)
|
||||
{
|
||||
Item theCatch = (Item)event.getCaught();
|
||||
if(LoadProperties.fishingDrops)
|
||||
{
|
||||
List<FishingTreasure> rewards = LoadTreasures.fishingRewardsTier1;
|
||||
FishingTreasure treasure = rewards.get((int)(Math.random() * rewards.size()));
|
||||
|
||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
||||
{
|
||||
Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player);
|
||||
theCatch.setItemStack(treasure.getDrop());
|
||||
}
|
||||
}
|
||||
else
|
||||
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
|
||||
|
||||
//Change durability to random value
|
||||
theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value
|
||||
}
|
||||
/**
|
||||
* Get item results from Fishing.
|
||||
*
|
||||
* @param player The player that was fishing
|
||||
* @param event The event to modify
|
||||
*/
|
||||
private static void getFishingResults(Player player, PlayerFishEvent event) {
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
List<FishingTreasure> rewards = new ArrayList<FishingTreasure>();
|
||||
Item theCatch = (Item) event.getCaught();
|
||||
|
||||
private static void getFishingResultsTier2(Player player, PlayerFishEvent event)
|
||||
{
|
||||
Item theCatch = (Item)event.getCaught();
|
||||
if(LoadProperties.fishingDrops)
|
||||
{
|
||||
List<FishingTreasure> rewards = LoadTreasures.fishingRewardsTier2;
|
||||
FishingTreasure treasure = rewards.get((int)(Math.random() * rewards.size()));
|
||||
|
||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
||||
{
|
||||
Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player);
|
||||
theCatch.setItemStack(treasure.getDrop());
|
||||
}
|
||||
}
|
||||
else
|
||||
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
|
||||
|
||||
//Change durability to random value
|
||||
theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value
|
||||
}
|
||||
switch (getFishingLootTier(PP)) {
|
||||
case 1:
|
||||
rewards = LoadTreasures.fishingRewardsTier1;
|
||||
break;
|
||||
|
||||
private static void getFishingResultsTier3(Player player, PlayerFishEvent event)
|
||||
{
|
||||
Item theCatch = (Item)event.getCaught();
|
||||
if(LoadProperties.fishingDrops)
|
||||
{
|
||||
List<FishingTreasure> rewards = LoadTreasures.fishingRewardsTier3;
|
||||
FishingTreasure treasure = rewards.get((int)(Math.random() * rewards.size()));
|
||||
|
||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
||||
{
|
||||
Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player);
|
||||
theCatch.setItemStack(treasure.getDrop());
|
||||
}
|
||||
}
|
||||
else
|
||||
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
|
||||
|
||||
//Change durability to random value
|
||||
theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value
|
||||
}
|
||||
case 2:
|
||||
rewards = LoadTreasures.fishingRewardsTier2;
|
||||
break;
|
||||
|
||||
private static void getFishingResultsTier4(Player player, PlayerFishEvent event)
|
||||
{
|
||||
Item theCatch = (Item)event.getCaught();
|
||||
if(LoadProperties.fishingDrops)
|
||||
{
|
||||
List<FishingTreasure> rewards = LoadTreasures.fishingRewardsTier4;
|
||||
FishingTreasure treasure = rewards.get((int)(Math.random() * rewards.size()));
|
||||
|
||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
||||
{
|
||||
Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player);
|
||||
theCatch.setItemStack(treasure.getDrop());
|
||||
}
|
||||
}
|
||||
else
|
||||
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
|
||||
|
||||
//Change durability to random value
|
||||
theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value
|
||||
}
|
||||
case 3:
|
||||
rewards = LoadTreasures.fishingRewardsTier3;
|
||||
break;
|
||||
|
||||
private static void getFishingResultsTier5(Player player, PlayerFishEvent event)
|
||||
{
|
||||
Item theCatch = (Item)event.getCaught();
|
||||
if(LoadProperties.fishingDrops)
|
||||
{
|
||||
List<FishingTreasure> rewards = LoadTreasures.fishingRewardsTier5;
|
||||
FishingTreasure treasure = rewards.get((int)(Math.random() * rewards.size()));
|
||||
|
||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
||||
{
|
||||
Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player);
|
||||
theCatch.setItemStack(treasure.getDrop());
|
||||
}
|
||||
}
|
||||
else
|
||||
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
|
||||
|
||||
//Change durability to random value
|
||||
theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value
|
||||
}
|
||||
|
||||
public static void processResults(PlayerFishEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
case 4:
|
||||
rewards = LoadTreasures.fishingRewardsTier4;
|
||||
break;
|
||||
|
||||
Fishing.getFishingResults(player, event);
|
||||
Item theCatch = (Item)event.getCaught();
|
||||
case 5:
|
||||
rewards = LoadTreasures.fishingRewardsTier5;
|
||||
break;
|
||||
|
||||
if(theCatch.getItemStack().getType() != Material.RAW_FISH)
|
||||
{
|
||||
//Inform the player they retrieved a treasure...
|
||||
player.sendMessage(mcLocale.getString("Fishing.ItemFound"));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//Keep track of whether or not the treasure is enchanted
|
||||
boolean enchanted = false;
|
||||
if (LoadProperties.fishingDrops) {
|
||||
FishingTreasure treasure = rewards.get((int) (Math.random() * rewards.size()));
|
||||
|
||||
ItemStack fishingResults = theCatch.getItemStack();
|
||||
if(Repair.isArmor(fishingResults) || Repair.isTools(fishingResults))
|
||||
{
|
||||
//Fishing up items will have a 10% chance to enter them into random enchantment lottery
|
||||
if(Math.random() * 100 < 10)
|
||||
{
|
||||
for(Enchantment x : Enchantment.values())
|
||||
{
|
||||
if(x.canEnchantItem(fishingResults))
|
||||
{
|
||||
//Prevent impossible enchantment combinations
|
||||
if((fishingResults.containsEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL) || fishingResults.containsEnchantment(Enchantment.PROTECTION_EXPLOSIONS) ||
|
||||
fishingResults.containsEnchantment(Enchantment.PROTECTION_FIRE) || fishingResults.containsEnchantment(Enchantment.PROTECTION_PROJECTILE)) &&
|
||||
(x.equals(Enchantment.PROTECTION_EXPLOSIONS) || x.equals(Enchantment.PROTECTION_PROJECTILE) || x.equals(Enchantment.PROTECTION_FIRE) || x.equals(Enchantment.PROTECTION_ENVIRONMENTAL))){
|
||||
return;
|
||||
}
|
||||
|
||||
//More impossible enchantment combinations
|
||||
else if((fishingResults.containsEnchantment(Enchantment.DAMAGE_ALL) || fishingResults.containsEnchantment(Enchantment.DAMAGE_ARTHROPODS) || fishingResults.containsEnchantment(Enchantment.DAMAGE_UNDEAD)) &&
|
||||
(x.equals(Enchantment.DAMAGE_ALL) || x.equals(Enchantment.DAMAGE_ARTHROPODS) || x.equals(Enchantment.DAMAGE_UNDEAD))){
|
||||
return;
|
||||
}
|
||||
|
||||
//Even more impossible enchantment combinations
|
||||
else if((fishingResults.containsEnchantment(Enchantment.SILK_TOUCH) || fishingResults.containsEnchantment(Enchantment.LOOT_BONUS_BLOCKS)) &&
|
||||
(x.equals(Enchantment.SILK_TOUCH) || x.equals(Enchantment.LOOT_BONUS_BLOCKS))){
|
||||
return;
|
||||
}
|
||||
|
||||
else{
|
||||
//Actual chance to have an enchantment is related to your fishing skill
|
||||
if(Math.random() * 15 < Fishing.getFishingLootTier(PP))
|
||||
{
|
||||
enchanted = true;
|
||||
int randomEnchantLevel = (int)(Math.random() * x.getMaxLevel()) + 1;
|
||||
|
||||
if(randomEnchantLevel == 0)
|
||||
randomEnchantLevel = 1;
|
||||
if (Math.random() * 100 <= treasure.getDropChance()) {
|
||||
Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player);
|
||||
theCatch.setItemStack(treasure.getDrop());
|
||||
}
|
||||
}
|
||||
else {
|
||||
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
|
||||
}
|
||||
|
||||
fishingResults.addEnchantment(x, randomEnchantLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Inform the player of magical properties
|
||||
if(enchanted)
|
||||
{
|
||||
player.sendMessage(mcLocale.getString("Fishing.MagicFound"));
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void shakeMob(PlayerFishEvent event)
|
||||
{
|
||||
|
||||
LivingEntity le = (LivingEntity) event.getCaught();
|
||||
EntityType type = le.getType();
|
||||
Location loc = le.getLocation();
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case BLAZE:
|
||||
m.mcDropItem(loc, new ItemStack(Material.BLAZE_ROD, 1));
|
||||
break;
|
||||
case CAVE_SPIDER:
|
||||
if(Math.random() * 10 < 5)
|
||||
m.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE, 1));
|
||||
else
|
||||
m.mcDropItem(loc, new ItemStack(Material.STRING, 1));
|
||||
break;
|
||||
case CHICKEN:
|
||||
if(Math.random() * 10 <= 7)
|
||||
{
|
||||
if(Math.random() * 10 < 5)
|
||||
m.mcDropItem(loc, new ItemStack(Material.FEATHER, 1));
|
||||
else
|
||||
m.mcDropItem(loc, new ItemStack(Material.RAW_CHICKEN, 1));
|
||||
}
|
||||
else
|
||||
m.mcDropItem(loc, new ItemStack(Material.EGG, 1));
|
||||
break;
|
||||
case COW:
|
||||
if(Math.random() * 100 >= 99)
|
||||
m.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET, 1)); //rare chance to drop milk
|
||||
else if(Math.random() * 10 < 5)
|
||||
m.mcDropItem(loc, new ItemStack(Material.LEATHER, 1));
|
||||
else
|
||||
m.mcDropItem(loc, new ItemStack(Material.RAW_BEEF, 1));
|
||||
break;
|
||||
case CREEPER:
|
||||
m.mcDropItem(loc, new ItemStack(Material.SULPHUR, 1));
|
||||
break;
|
||||
case ENDERMAN:
|
||||
m.mcDropItem(loc, new ItemStack(Material.ENDER_PEARL, 1));
|
||||
break;
|
||||
case GHAST:
|
||||
if(Math.random() * 10 < 5)
|
||||
m.mcDropItem(loc, new ItemStack(Material.SULPHUR, 1));
|
||||
else
|
||||
m.mcDropItem(loc, new ItemStack(Material.GHAST_TEAR, 1));
|
||||
break;
|
||||
case MAGMA_CUBE:
|
||||
m.mcDropItem(loc, new ItemStack(Material.MAGMA_CREAM, 1));
|
||||
break;
|
||||
case MUSHROOM_COW:
|
||||
if(Math.random() * 100 >= 99)
|
||||
{
|
||||
if(Math.random() * 10 < 5)
|
||||
m.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET, 1)); //rare chance to drop milk
|
||||
else
|
||||
m.mcDropItem(loc, new ItemStack(Material.MUSHROOM_SOUP, 1)); //rare chance to drop soup
|
||||
}
|
||||
else if(Math.random() * 10 <= 7)
|
||||
{
|
||||
if(Math.random() * 10 < 5)
|
||||
m.mcDropItem(loc, new ItemStack(Material.LEATHER, 1));
|
||||
else
|
||||
m.mcDropItem(loc, new ItemStack(Material.RAW_BEEF, 1));
|
||||
}
|
||||
else
|
||||
m.mcDropItem(loc, new ItemStack(Material.RED_MUSHROOM, 3));
|
||||
//need some way to remove MushroomCow & replace with regular cow when sheared
|
||||
break;
|
||||
case PIG:
|
||||
m.mcDropItem(loc, new ItemStack(Material.PORK, 1));
|
||||
break;
|
||||
case PIG_ZOMBIE:
|
||||
if(Math.random() * 10 < 5)
|
||||
m.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH, 1));
|
||||
else
|
||||
m.mcDropItem(loc, new ItemStack(Material.GOLD_NUGGET, 1));
|
||||
break;
|
||||
case SHEEP:
|
||||
Sheep sheep = (Sheep)le;
|
||||
if(!sheep.isSheared())
|
||||
{
|
||||
Wool wool = new Wool();
|
||||
wool.setColor(sheep.getColor());
|
||||
ItemStack theWool = wool.toItemStack();
|
||||
theWool.setAmount((int)(Math.random() * 6));
|
||||
m.mcDropItem(loc, theWool);
|
||||
sheep.setSheared(true);
|
||||
}
|
||||
break;
|
||||
case SKELETON:
|
||||
if(Math.random() * 10 < 5)
|
||||
m.mcDropItem(loc, new ItemStack(Material.BONE, 1));
|
||||
else
|
||||
m.mcDropItem(loc, new ItemStack(Material.ARROW, 3));
|
||||
break;
|
||||
case SLIME:
|
||||
m.mcDropItem(loc, new ItemStack(Material.SLIME_BALL, 1));
|
||||
break;
|
||||
case SNOWMAN:
|
||||
if(Math.random() * 100 >= 99)
|
||||
m.mcDropItem(loc, new ItemStack(Material.PUMPKIN, 1)); //rare chance to drop pumpkin
|
||||
else
|
||||
m.mcDropItem(loc, new ItemStack(Material.SNOW_BALL, 5));
|
||||
break;
|
||||
case SPIDER:
|
||||
if(Math.random() * 10 < 5)
|
||||
m.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE, 1));
|
||||
else
|
||||
m.mcDropItem(loc, new ItemStack(Material.STRING, 1));
|
||||
break;
|
||||
case SQUID:
|
||||
m.mcDropItem(loc, new ItemStack(Material.INK_SACK, 1, (byte)0, (byte)0));
|
||||
break;
|
||||
case ZOMBIE:
|
||||
m.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH, 1));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
Combat.dealDamage(le, 1);
|
||||
}
|
||||
theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change durability to random value
|
||||
|
||||
m.mcDropItem(player.getLocation(), new ItemStack(Material.RAW_FISH)); //Always drop a fish
|
||||
PP.addXP(SkillType.FISHING, LoadProperties.mfishing, player);
|
||||
Skills.XpCheckSkill(SkillType.FISHING, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process results from Fishing.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static void processResults(PlayerFishEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
getFishingResults(player, event);
|
||||
Item theCatch = (Item)event.getCaught();
|
||||
|
||||
if (theCatch.getItemStack().getType() != Material.RAW_FISH) {
|
||||
final int ENCHANTMENT_CHANCE = 10;
|
||||
boolean enchanted = false;
|
||||
ItemStack fishingResults = theCatch.getItemStack();
|
||||
|
||||
player.sendMessage(mcLocale.getString("Fishing.ItemFound"));
|
||||
if (ItemChecks.isArmor(fishingResults) || ItemChecks.isTool(fishingResults)) {
|
||||
if (Math.random() * 100 <= ENCHANTMENT_CHANCE) {
|
||||
for (Enchantment newEnchant : Enchantment.values()) {
|
||||
if (newEnchant.canEnchantItem(fishingResults)) {
|
||||
Map<Enchantment, Integer> resultEnchantments = fishingResults.getEnchantments();
|
||||
|
||||
for (Enchantment oldEnchant : resultEnchantments.keySet()) {
|
||||
if (oldEnchant.conflictsWith(newEnchant)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Actual chance to have an enchantment is related to your fishing skill */
|
||||
if (Math.random() * 15 < Fishing.getFishingLootTier(PP)) {
|
||||
enchanted = true;
|
||||
int randomEnchantLevel = (int) (Math.random() * newEnchant.getMaxLevel()) + 1;
|
||||
|
||||
if (randomEnchantLevel < newEnchant.getStartLevel()) {
|
||||
randomEnchantLevel = newEnchant.getStartLevel();
|
||||
}
|
||||
|
||||
fishingResults.addEnchantment(newEnchant, randomEnchantLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (enchanted) {
|
||||
player.sendMessage(mcLocale.getString("Fishing.MagicFound"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shake a mob, have them drop an item.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static void shakeMob(PlayerFishEvent event) {
|
||||
final int DROP_NUMBER = (int) (Math.random() * 101);
|
||||
|
||||
LivingEntity le = (LivingEntity) event.getCaught();
|
||||
EntityType type = le.getType();
|
||||
Location loc = le.getLocation();
|
||||
|
||||
switch (type) {
|
||||
case BLAZE:
|
||||
m.mcDropItem(loc, new ItemStack(Material.BLAZE_ROD));
|
||||
break;
|
||||
|
||||
case CAVE_SPIDER:
|
||||
if (DROP_NUMBER > 50) {
|
||||
m.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE));
|
||||
}
|
||||
else {
|
||||
m.mcDropItem(loc, new ItemStack(Material.STRING));
|
||||
}
|
||||
break;
|
||||
|
||||
case CHICKEN:
|
||||
if (DROP_NUMBER > 66) {
|
||||
m.mcDropItem(loc, new ItemStack(Material.FEATHER));
|
||||
}
|
||||
else if (DROP_NUMBER > 33) {
|
||||
m.mcDropItem(loc, new ItemStack(Material.RAW_CHICKEN));
|
||||
}
|
||||
else {
|
||||
m.mcDropItem(loc, new ItemStack(Material.EGG));
|
||||
}
|
||||
break;
|
||||
|
||||
case COW:
|
||||
if (DROP_NUMBER > 99) {
|
||||
m.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET));
|
||||
}
|
||||
else if (DROP_NUMBER > 50) {
|
||||
m.mcDropItem(loc, new ItemStack(Material.LEATHER));
|
||||
}
|
||||
else {
|
||||
m.mcDropItem(loc, new ItemStack(Material.RAW_BEEF));
|
||||
}
|
||||
break;
|
||||
|
||||
case CREEPER:
|
||||
m.mcDropItem(loc, new ItemStack(Material.SULPHUR));
|
||||
break;
|
||||
|
||||
case ENDERMAN:
|
||||
m.mcDropItem(loc, new ItemStack(Material.ENDER_PEARL));
|
||||
break;
|
||||
|
||||
case GHAST:
|
||||
if (DROP_NUMBER > 50) {
|
||||
m.mcDropItem(loc, new ItemStack(Material.SULPHUR));
|
||||
}
|
||||
else {
|
||||
m.mcDropItem(loc, new ItemStack(Material.GHAST_TEAR));
|
||||
}
|
||||
break;
|
||||
|
||||
case MAGMA_CUBE:
|
||||
m.mcDropItem(loc, new ItemStack(Material.MAGMA_CREAM));
|
||||
break;
|
||||
|
||||
case MUSHROOM_COW:
|
||||
if (DROP_NUMBER > 99) {
|
||||
m.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET));
|
||||
}
|
||||
else if (DROP_NUMBER > 98) {
|
||||
m.mcDropItem(loc, new ItemStack(Material.MUSHROOM_SOUP));
|
||||
}
|
||||
else if (DROP_NUMBER > 66) {
|
||||
m.mcDropItem(loc, new ItemStack(Material.LEATHER));
|
||||
}
|
||||
else if (DROP_NUMBER > 33) {
|
||||
m.mcDropItem(loc, new ItemStack(Material.RAW_BEEF));
|
||||
}
|
||||
else {
|
||||
m.mcDropItems(loc, new ItemStack(Material.RED_MUSHROOM), 3);
|
||||
}
|
||||
break;
|
||||
|
||||
case PIG:
|
||||
m.mcDropItem(loc, new ItemStack(Material.PORK));
|
||||
break;
|
||||
|
||||
case PIG_ZOMBIE:
|
||||
if (DROP_NUMBER > 50) {
|
||||
m.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH));
|
||||
}
|
||||
else {
|
||||
m.mcDropItem(loc, new ItemStack(Material.GOLD_NUGGET));
|
||||
}
|
||||
break;
|
||||
|
||||
case SHEEP:
|
||||
Sheep sheep = (Sheep) le;
|
||||
|
||||
if (!sheep.isSheared()) {
|
||||
Wool wool = new Wool();
|
||||
wool.setColor(sheep.getColor());
|
||||
|
||||
ItemStack theWool = wool.toItemStack();
|
||||
theWool.setAmount((int)(Math.random() * 6));
|
||||
|
||||
m.mcDropItem(loc, theWool);
|
||||
sheep.setSheared(true);
|
||||
}
|
||||
break;
|
||||
|
||||
case SKELETON:
|
||||
if (DROP_NUMBER > 50) {
|
||||
m.mcDropItem(loc, new ItemStack(Material.BONE));
|
||||
}
|
||||
else {
|
||||
m.mcDropItems(loc, new ItemStack(Material.ARROW), 3);
|
||||
}
|
||||
break;
|
||||
|
||||
case SLIME:
|
||||
m.mcDropItem(loc, new ItemStack(Material.SLIME_BALL));
|
||||
break;
|
||||
|
||||
case SNOWMAN:
|
||||
if (DROP_NUMBER > 99) {
|
||||
m.mcDropItem(loc, new ItemStack(Material.PUMPKIN));
|
||||
}
|
||||
else {
|
||||
m.mcDropItems(loc, new ItemStack(Material.SNOW_BALL), 5);
|
||||
}
|
||||
break;
|
||||
|
||||
case SPIDER:
|
||||
if (DROP_NUMBER > 50) {
|
||||
m.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE));
|
||||
}
|
||||
else {
|
||||
m.mcDropItem(loc, new ItemStack(Material.STRING));
|
||||
}
|
||||
break;
|
||||
|
||||
case SQUID:
|
||||
m.mcDropItem(loc, new ItemStack(Material.INK_SACK, 1, (short) 0, DyeColor.BLACK.getData()));
|
||||
break;
|
||||
|
||||
case ZOMBIE:
|
||||
m.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Combat.dealDamage(le, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,9 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.CropState;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
@@ -29,285 +13,295 @@ import org.bukkit.inventory.PlayerInventory;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.runnables.GreenThumbTimer;
|
||||
|
||||
public class Herbalism {
|
||||
|
||||
public class Herbalism
|
||||
{
|
||||
public static void greenTerra(Player player, Block block){
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
boolean hasSeeds = inventory.contains(Material.SEEDS);
|
||||
if(block.getType() == Material.COBBLESTONE || block.getType() == Material.DIRT){
|
||||
if(!hasSeeds)
|
||||
player.sendMessage("You need more seeds to spread Green Terra");
|
||||
if(hasSeeds && block.getType() != Material.WHEAT)
|
||||
{
|
||||
inventory.removeItem(new ItemStack(Material.SEEDS, 1));
|
||||
player.updateInventory();
|
||||
if(LoadProperties.enableSmoothToMossy && block.getType() == Material.SMOOTH_BRICK)
|
||||
block.setData((byte)1);
|
||||
if(LoadProperties.enableDirtToGrass && block.getType() == Material.DIRT)
|
||||
block.setType(Material.GRASS);
|
||||
if(LoadProperties.enableCobbleToMossy && block.getType() == Material.COBBLESTONE)
|
||||
block.setType(Material.MOSSY_COBBLESTONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean canBeGreenTerra(Block block){
|
||||
switch(block.getType()){
|
||||
case BROWN_MUSHROOM:
|
||||
case CACTUS:
|
||||
case COBBLESTONE:
|
||||
case CROPS:
|
||||
case DIRT:
|
||||
case JACK_O_LANTERN:
|
||||
case MELON_BLOCK:
|
||||
case PUMPKIN:
|
||||
case RED_MUSHROOM:
|
||||
case RED_ROSE:
|
||||
case SMOOTH_BRICK:
|
||||
case SUGAR_CANE_BLOCK:
|
||||
case VINE:
|
||||
case WATER_LILY:
|
||||
case YELLOW_FLOWER:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
/**
|
||||
* Activate the Green Terra ability.
|
||||
*
|
||||
* @param player The player activating the ability
|
||||
* @param block The block to be changed by Green Terra
|
||||
*/
|
||||
public static void greenTerra(Player player, Block block) {
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
boolean hasSeeds = inventory.contains(Material.SEEDS);
|
||||
Material type = block.getType();
|
||||
|
||||
if (!hasSeeds) {
|
||||
player.sendMessage("You need more seeds to spread Green Terra");
|
||||
}
|
||||
else if (hasSeeds && !block.getType().equals(Material.WHEAT)) {
|
||||
inventory.removeItem(new ItemStack(Material.SEEDS));
|
||||
player.updateInventory();
|
||||
|
||||
if (m.blockBreakSimulate(block, player, false)) {
|
||||
if (LoadProperties.enableSmoothToMossy && type.equals(Material.SMOOTH_BRICK)) {
|
||||
block.setData((byte) 0x1); //Set type of the brick to mossy
|
||||
}
|
||||
else if (LoadProperties.enableDirtToGrass && type.equals(Material.DIRT)) {
|
||||
block.setType(Material.GRASS);
|
||||
}
|
||||
else if (LoadProperties.enableCobbleToMossy && type.equals(Material.COBBLESTONE)) {
|
||||
block.setType(Material.MOSSY_COBBLESTONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void herbalismProcCheck(final Block block, Player player, BlockBreakEvent event, mcMMO plugin)
|
||||
{
|
||||
final PlayerProfile PP = Users.getProfile(player);
|
||||
int herbLevel = PP.getSkillLevel(SkillType.HERBALISM);
|
||||
int type = block.getTypeId();
|
||||
Location loc = block.getLocation();
|
||||
ItemStack is = null;
|
||||
Material mat = null;
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
boolean hasSeeds = inventory.contains(Material.SEEDS);
|
||||
|
||||
if(plugin.misc.blockWatchList.contains(block))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Wheat
|
||||
if(type == 59 && block.getData() == (byte) 0x7)
|
||||
{
|
||||
is = new ItemStack(Material.WHEAT, 1);
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat, player);
|
||||
|
||||
if(player != null)
|
||||
{
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
m.mcDropItem(loc, is);
|
||||
}
|
||||
|
||||
//GREEN THUMB
|
||||
if(hasSeeds && PP.getGreenTerraMode() || hasSeeds && (herbLevel >= 1500 || (Math.random() * 1500 <= herbLevel)))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
m.mcDropItem(loc, is);
|
||||
//DROP SOME SEEDS
|
||||
is = new ItemStack(Material.SEEDS, 1);
|
||||
m.mcDropItem(loc, is);
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
public void run() {
|
||||
block.setType(Material.CROPS);
|
||||
//This replants the wheat at a certain stage in development based on Herbalism Skill
|
||||
if(!PP.getGreenTerraMode())
|
||||
{
|
||||
if (PP.getSkillLevel(SkillType.HERBALISM) >= 600)
|
||||
block.setData((byte) 0x4);
|
||||
else if (PP.getSkillLevel(SkillType.HERBALISM) >= 400)
|
||||
block.setData((byte) 0x3);
|
||||
else if (PP.getSkillLevel(SkillType.HERBALISM) >= 200)
|
||||
block.setData((byte) 0x2);
|
||||
else
|
||||
block.setData((byte) 0x1);
|
||||
} else
|
||||
block.setData((byte) 0x4);
|
||||
|
||||
/**
|
||||
* Check if a block can be made mossy.
|
||||
*
|
||||
* @param material The type of Block to check
|
||||
* @return true if the block can be made mossy, false otherwise
|
||||
*/
|
||||
public static Boolean makeMossy(Material type) {
|
||||
switch (type) {
|
||||
case COBBLESTONE:
|
||||
case DIRT:
|
||||
case SMOOTH_BRICK:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a block is affected by Herbalism abilities.
|
||||
*
|
||||
* @param type The type of Block to check
|
||||
* @return true if the block is affected, false otherwise
|
||||
*/
|
||||
public static Boolean canBeGreenTerra(Material type){
|
||||
switch (type) {
|
||||
case BROWN_MUSHROOM:
|
||||
case CACTUS:
|
||||
case CROPS:
|
||||
case JACK_O_LANTERN:
|
||||
case MELON_BLOCK:
|
||||
case PUMPKIN:
|
||||
case RED_MUSHROOM:
|
||||
case RED_ROSE:
|
||||
case SUGAR_CANE_BLOCK:
|
||||
case VINE:
|
||||
case WATER_LILY:
|
||||
case YELLOW_FLOWER:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for extra Herbalism drops.
|
||||
*
|
||||
* @param block The block to check for extra drops
|
||||
* @param player The player getting extra drops
|
||||
* @param event The event to use for Green Thumb
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void herbalismProcCheck(final Block block, Player player, BlockBreakEvent event, mcMMO plugin) {
|
||||
final PlayerProfile PP = Users.getProfile(player);
|
||||
final int MAX_BONUS_LEVEL = 1000;
|
||||
|
||||
int herbLevel = PP.getSkillLevel(SkillType.HERBALISM);
|
||||
int id = block.getTypeId();
|
||||
Material type = block.getType();
|
||||
|
||||
Byte data = block.getData();
|
||||
Location loc = block.getLocation();
|
||||
Material mat = null;
|
||||
int xp = 0;
|
||||
int catciDrops = 0;
|
||||
int caneDrops = 0;
|
||||
|
||||
switch (type) {
|
||||
case BROWN_MUSHROOM:
|
||||
case RED_MUSHROOM:
|
||||
if (!block.hasMetadata("mcmmoPlacedBlock")) {
|
||||
mat = Material.getMaterial(id);
|
||||
xp = LoadProperties.mmushroom;
|
||||
}
|
||||
break;
|
||||
|
||||
case CACTUS:
|
||||
for (int y = 0; y <= 2; y++) {
|
||||
Block b = block.getRelative(0, y, 0);
|
||||
if (b.getType().equals(Material.CACTUS)) {
|
||||
mat = Material.CACTUS;
|
||||
if (!b.hasMetadata("mcmmoPlacedBlock")) {
|
||||
if(herbLevel > MAX_BONUS_LEVEL || (Math.random() * 1000 <= herbLevel)) {
|
||||
catciDrops++;
|
||||
}
|
||||
xp += LoadProperties.mcactus;
|
||||
}
|
||||
}, 1);
|
||||
|
||||
inventory.removeItem(new ItemStack(Material.SEEDS, 1));
|
||||
player.updateInventory();
|
||||
}
|
||||
}
|
||||
|
||||
//Nether Wart
|
||||
if(type == 115 && block.getData() == (byte) 0x3)
|
||||
{
|
||||
is = new ItemStack(Material.NETHER_STALK, 1);
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mnetherwart, player);
|
||||
if(player != null)
|
||||
{
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
{
|
||||
m.mcDropItems(loc, is, 2);
|
||||
m.mcRandomDropItems(loc, is, 50, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We need to check not-wheat and not-netherwart stuff for if it was placed by the player or not
|
||||
*/
|
||||
if(block.getData() != (byte) 5)
|
||||
{
|
||||
//Cactus
|
||||
if(type == 81){
|
||||
//Setup the loop
|
||||
World world = block.getWorld();
|
||||
Block[] blockArray = new Block[3];
|
||||
blockArray[0] = block;
|
||||
blockArray[1] = world.getBlockAt(block.getX(), block.getY()+1, block.getZ());
|
||||
blockArray[2] = world.getBlockAt(block.getX(), block.getY()+2, block.getZ());
|
||||
|
||||
Material[] materialArray = new Material[3];
|
||||
materialArray[0] = blockArray[0].getType();
|
||||
materialArray[1] = blockArray[1].getType();
|
||||
materialArray[2] = blockArray[2].getType();
|
||||
|
||||
byte[] byteArray = new byte[3];
|
||||
byteArray[0] = blockArray[0].getData();
|
||||
byteArray[1] = blockArray[0].getData();
|
||||
byteArray[2] = blockArray[0].getData();
|
||||
|
||||
int x = 0;
|
||||
for(Block target : blockArray)
|
||||
{
|
||||
if(materialArray[x] == Material.CACTUS)
|
||||
{
|
||||
is = new ItemStack(Material.CACTUS, 1);
|
||||
if(byteArray[x] != (byte) 5)
|
||||
{
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
{
|
||||
m.mcDropItem(target.getLocation(), is);
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mcactus, player);
|
||||
}
|
||||
}
|
||||
x++;
|
||||
}
|
||||
}
|
||||
//Sugar Canes
|
||||
if(type == 83)
|
||||
{
|
||||
//Setup the loop
|
||||
World world = block.getWorld();
|
||||
Block[] blockArray = new Block[3];
|
||||
blockArray[0] = block;
|
||||
blockArray[1] = world.getBlockAt(block.getX(), block.getY()+1, block.getZ());
|
||||
blockArray[2] = world.getBlockAt(block.getX(), block.getY()+2, block.getZ());
|
||||
|
||||
Material[] materialArray = new Material[3];
|
||||
materialArray[0] = blockArray[0].getType();
|
||||
materialArray[1] = blockArray[1].getType();
|
||||
materialArray[2] = blockArray[2].getType();
|
||||
|
||||
byte[] byteArray = new byte[3];
|
||||
byteArray[0] = blockArray[0].getData();
|
||||
byteArray[1] = blockArray[0].getData();
|
||||
byteArray[2] = blockArray[0].getData();
|
||||
|
||||
int x = 0;
|
||||
for(Block target : blockArray)
|
||||
{
|
||||
if(materialArray[x] == Material.SUGAR_CANE_BLOCK)
|
||||
{
|
||||
is = new ItemStack(Material.SUGAR_CANE, 1);
|
||||
//Check for being placed by the player
|
||||
if(byteArray[x] != (byte) 5)
|
||||
{
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
{
|
||||
m.mcDropItem(target.getLocation(), is);
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.msugar, player);
|
||||
}
|
||||
}
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
//Pumpkins
|
||||
if((type == 91 || type == 86))
|
||||
{
|
||||
mat = Material.getMaterial(block.getTypeId());
|
||||
is = new ItemStack(mat, 1);
|
||||
if(player != null)
|
||||
{
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
{
|
||||
m.mcDropItem(loc, is);
|
||||
}
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mpumpkin, player);
|
||||
}
|
||||
//Melon
|
||||
if(type == 103)
|
||||
{
|
||||
is = new ItemStack(Material.MELON, 1);
|
||||
if(player != null)
|
||||
{
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
{
|
||||
m.mcDropItems(loc, is, 3);
|
||||
m.mcRandomDropItems(loc, is, 50, 4);
|
||||
}
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mmelon, player);
|
||||
}
|
||||
//Mushroom
|
||||
if(type == 39 || type == 40)
|
||||
{
|
||||
mat = Material.getMaterial(block.getTypeId());
|
||||
is = new ItemStack(mat, 1);
|
||||
if(player != null)
|
||||
{
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
{
|
||||
m.mcDropItem(loc, is);
|
||||
}
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mmushroom, player);
|
||||
}
|
||||
//Flower
|
||||
if(type == 37 || type == 38){
|
||||
mat = Material.getMaterial(block.getTypeId());
|
||||
is = new ItemStack(mat, 1);
|
||||
if(player != null){
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
m.mcDropItem(loc, is);
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mflower, player);
|
||||
}
|
||||
//Lily Pads
|
||||
if(type == 111)
|
||||
{
|
||||
is = new ItemStack(Material.WATER_LILY, 1);
|
||||
if(player != null){
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
m.mcDropItem(loc, is);
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mlilypad, player);
|
||||
}
|
||||
//Vines
|
||||
if(type == 106){
|
||||
is = new ItemStack(Material.VINE, 1, (byte)0, (byte)0);
|
||||
if(player != null){
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
m.mcDropItem(loc, is);
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mvines, player);
|
||||
}
|
||||
}
|
||||
Skills.XpCheckSkill(SkillType.HERBALISM, player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CROPS:
|
||||
if (data == CropState.RIPE.getData()) {
|
||||
mat = Material.WHEAT;
|
||||
xp = LoadProperties.mwheat;
|
||||
|
||||
if (LoadProperties.wheatRegrowth && mcPermissions.getInstance().greenThumbWheat(player)) {
|
||||
greenThumbWheat(block, player, event, plugin);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MELON_BLOCK:
|
||||
if (!block.hasMetadata("mcmmoPlacedBlock")) {
|
||||
mat = Material.MELON;
|
||||
xp = LoadProperties.mmelon;
|
||||
}
|
||||
break;
|
||||
|
||||
case NETHER_WARTS:
|
||||
if (data == (byte) 0x3) {
|
||||
mat = Material.NETHER_STALK;
|
||||
xp = LoadProperties.mnetherwart;
|
||||
}
|
||||
break;
|
||||
|
||||
case PUMPKIN:
|
||||
case JACK_O_LANTERN:
|
||||
if (!block.hasMetadata("mcmmoPlacedBlock")) {
|
||||
mat = Material.getMaterial(id);
|
||||
xp = LoadProperties.mpumpkin;
|
||||
}
|
||||
break;
|
||||
|
||||
case RED_ROSE:
|
||||
case YELLOW_FLOWER:
|
||||
if (!block.hasMetadata("mcmmoPlacedBlock")) {
|
||||
mat = Material.getMaterial(id);
|
||||
xp = LoadProperties.mflower;
|
||||
}
|
||||
break;
|
||||
|
||||
case SUGAR_CANE_BLOCK:
|
||||
for (int y = 0; y <= 2; y++) {
|
||||
Block b = block.getRelative(0, y, 0);
|
||||
if (b.getType().equals(Material.SUGAR_CANE_BLOCK)) {
|
||||
mat = Material.SUGAR_CANE;
|
||||
if (!b.hasMetadata("mcmmoPlacedBlock")) {
|
||||
if(herbLevel > MAX_BONUS_LEVEL || (Math.random() * 1000 <= herbLevel)) {
|
||||
caneDrops++;
|
||||
}
|
||||
xp += LoadProperties.msugar;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case VINE:
|
||||
if (!block.hasMetadata("mcmmoPlacedBlock")) {
|
||||
mat = type;
|
||||
xp = LoadProperties.mvines;
|
||||
}
|
||||
break;
|
||||
|
||||
case WATER_LILY:
|
||||
if (!block.hasMetadata("mcmmoPlacedBlock")) {
|
||||
mat = type;
|
||||
xp = LoadProperties.mlilypad;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (mat == null) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
ItemStack is = new ItemStack(mat);
|
||||
|
||||
if (herbLevel > MAX_BONUS_LEVEL || (Math.random() * 1000 <= herbLevel)) {
|
||||
if (type.equals(Material.CACTUS)) {
|
||||
m.mcDropItems(loc, is, catciDrops);
|
||||
}
|
||||
else if (type.equals(Material.MELON_BLOCK)) {
|
||||
m.mcDropItems(loc, is, 3);
|
||||
m.mcRandomDropItems(loc, is, 50, 4);
|
||||
}
|
||||
else if (type.equals(Material.NETHER_WARTS)) {
|
||||
m.mcDropItems(loc, is, 2);
|
||||
m.mcRandomDropItems(loc, is, 50, 3);
|
||||
}
|
||||
else if (type.equals(Material.SUGAR_CANE_BLOCK)) {
|
||||
m.mcDropItems(loc, is, caneDrops);
|
||||
}
|
||||
else {
|
||||
m.mcDropItem(loc, is);
|
||||
}
|
||||
}
|
||||
|
||||
PP.addXP(SkillType.HERBALISM, xp, player);
|
||||
Skills.XpCheckSkill(SkillType.HERBALISM, player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Green Thumb ability to crops.
|
||||
*
|
||||
* @param block The block to apply the ability to
|
||||
* @param player The player using the ability
|
||||
* @param event The event triggering the ability
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
private static void greenThumbWheat(Block block, Player player, BlockBreakEvent event, mcMMO plugin) {
|
||||
final int MAX_BONUS_LEVEL = 1500;
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int herbLevel = PP.getSkillLevel(SkillType.HERBALISM);
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
boolean hasSeeds = inventory.contains(Material.SEEDS);
|
||||
Location loc = block.getLocation();
|
||||
|
||||
if (hasSeeds && PP.getGreenTerraMode() || hasSeeds && (herbLevel > MAX_BONUS_LEVEL || (Math.random() * 1500 <= herbLevel))) {
|
||||
event.setCancelled(true);
|
||||
|
||||
m.mcDropItem(loc, new ItemStack(Material.WHEAT));
|
||||
m.mcRandomDropItems(loc, new ItemStack(Material.SEEDS), 50, 3);
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new GreenThumbTimer(block, PP), 1);
|
||||
|
||||
inventory.removeItem(new ItemStack(Material.SEEDS));
|
||||
player.updateInventory();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Green Thumb ability to blocks.
|
||||
*
|
||||
* @param is The item in the player's hand
|
||||
* @param player The player activating the ability
|
||||
* @param block The block being used in the ability
|
||||
*/
|
||||
public static void greenThumbBlocks(ItemStack is, Player player, Block block) {
|
||||
final int MAX_BONUS_LEVEL = 1500;
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int skillLevel = PP.getSkillLevel(SkillType.HERBALISM);
|
||||
int seeds = is.getAmount();
|
||||
|
||||
player.setItemInHand(new ItemStack(Material.SEEDS, seeds - 1));
|
||||
|
||||
if (skillLevel > MAX_BONUS_LEVEL || Math.random() * 1500 <= skillLevel) {
|
||||
greenTerra(player, block);
|
||||
}
|
||||
else {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.GreenThumbFail"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,9 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.CoalType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -27,304 +13,254 @@ import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.spout.SpoutSounds;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
|
||||
|
||||
public class Mining
|
||||
{
|
||||
public class Mining
|
||||
{
|
||||
|
||||
public static void blockProcSimulate(Block block, Player player)
|
||||
{
|
||||
Location loc = block.getLocation();
|
||||
int id = block.getTypeId();
|
||||
ItemStack item = new ItemStack(id, 1);
|
||||
|
||||
//Drop natural block with Silk Touch
|
||||
if(player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)){
|
||||
m.mcDropItem(loc, item);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (id){
|
||||
//GLOWSTONE
|
||||
case 89:
|
||||
item = new ItemStack(348, 1);
|
||||
m.mcDropItems(loc, item, 2);
|
||||
m.mcRandomDropItems(loc, item, 50, 2);
|
||||
break;
|
||||
//REDSTONE
|
||||
case 73:
|
||||
item = new ItemStack(331, 1);
|
||||
m.mcDropItems(loc, item, 4);
|
||||
m.mcRandomDropItem(loc, item, 50);
|
||||
break;
|
||||
case 74:
|
||||
item = new ItemStack(331, 1);
|
||||
m.mcDropItems(loc, item, 4);
|
||||
m.mcRandomDropItem(loc, item, 50);
|
||||
break;
|
||||
//LAPIS
|
||||
case 21:
|
||||
item = new ItemStack(351, 1, (byte)0,(byte)0x4);
|
||||
m.mcDropItems(loc, item, 4);
|
||||
m.mcRandomDropItems(loc, item, 50, 4);
|
||||
break;
|
||||
//DIAMOND
|
||||
case 56:
|
||||
item = new ItemStack(264, 1);
|
||||
m.mcDropItem(loc, item);
|
||||
break;
|
||||
//STONE
|
||||
case 1:
|
||||
item = new ItemStack(4, 1);
|
||||
m.mcDropItem(loc, item);
|
||||
break;
|
||||
//COAL
|
||||
case 16:
|
||||
item = new ItemStack(263, 1);
|
||||
m.mcDropItem(loc, item);
|
||||
break;
|
||||
default:
|
||||
m.mcDropItem(loc, item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void blockProcCheck(Block block, Player player)
|
||||
{
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);
|
||||
|
||||
if(skillLevel > 1000 || (Math.random() * 1000 <= skillLevel))
|
||||
blockProcSimulate(block, player);
|
||||
}
|
||||
|
||||
public static void miningBlockCheck(Player player, Block block, mcMMO plugin)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(plugin.misc.blockWatchList.contains(block) || block.getData() == (byte) 5)
|
||||
return;
|
||||
int xp = 0;
|
||||
int id = block.getTypeId();
|
||||
|
||||
switch (id) {
|
||||
//STONE
|
||||
case 1:
|
||||
xp += LoadProperties.mstone;
|
||||
break;
|
||||
//SANDSTONE
|
||||
case 24:
|
||||
xp += LoadProperties.msandstone;
|
||||
break;
|
||||
//OBSIDIAN
|
||||
case 49:
|
||||
xp += LoadProperties.mobsidian;
|
||||
break;
|
||||
//NETHERRACK
|
||||
case 87:
|
||||
xp += LoadProperties.mnetherrack;
|
||||
break;
|
||||
//GLOWSTONE
|
||||
case 89:
|
||||
xp += LoadProperties.mglowstone;
|
||||
break;
|
||||
//COAL
|
||||
case 16:
|
||||
xp += LoadProperties.mcoal;
|
||||
break;
|
||||
//GOLD
|
||||
case 14:
|
||||
xp += LoadProperties.mgold;
|
||||
break;
|
||||
//DIAMOND
|
||||
case 56:
|
||||
xp += LoadProperties.mdiamond;
|
||||
break;
|
||||
//IRON
|
||||
case 15:
|
||||
xp += LoadProperties.miron;
|
||||
break;
|
||||
//REDSTONE
|
||||
case 73:
|
||||
xp += LoadProperties.mredstone;
|
||||
break;
|
||||
case 74:
|
||||
xp += LoadProperties.mredstone;
|
||||
break;
|
||||
//LAPIS
|
||||
case 21:
|
||||
xp += LoadProperties.mlapis;
|
||||
break;
|
||||
//END STONE
|
||||
case 121:
|
||||
xp += LoadProperties.mendstone;
|
||||
break;
|
||||
//MOSS STONE
|
||||
case 48:
|
||||
xp += LoadProperties.mmossstone;
|
||||
break;
|
||||
}
|
||||
|
||||
if(canBeSuperBroken(block))
|
||||
blockProcCheck(block, player);
|
||||
PP.addXP(SkillType.MINING, xp, player);
|
||||
Skills.XpCheckSkill(SkillType.MINING, player);
|
||||
}
|
||||
|
||||
/*
|
||||
* Handling SuperBreaker stuff
|
||||
/**
|
||||
* Drop items from Mining & Blast Mining skills.
|
||||
*
|
||||
* @param block The block to process drops for
|
||||
*/
|
||||
public static Boolean canBeSuperBroken(Block block)
|
||||
{
|
||||
switch(block.getType()){
|
||||
case COAL_ORE:
|
||||
case DIAMOND_ORE:
|
||||
case ENDER_STONE:
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case GLOWSTONE:
|
||||
case GOLD_ORE:
|
||||
case IRON_ORE:
|
||||
case LAPIS_ORE:
|
||||
case MOSSY_COBBLESTONE:
|
||||
case NETHERRACK:
|
||||
case OBSIDIAN:
|
||||
case REDSTONE_ORE:
|
||||
case SANDSTONE:
|
||||
case STONE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
public static void miningDrops(Block block) {
|
||||
Location loc = block.getLocation();
|
||||
Material type = block.getType();
|
||||
ItemStack item = new ItemStack(type);
|
||||
|
||||
switch (type) {
|
||||
case COAL_ORE:
|
||||
item = new ItemStack(Material.COAL, 1, (short) 0, CoalType.COAL.getData());
|
||||
m.mcDropItem(loc, item);
|
||||
break;
|
||||
|
||||
case DIAMOND_ORE:
|
||||
item = new ItemStack(Material.DIAMOND);
|
||||
m.mcDropItem(loc, item);
|
||||
break;
|
||||
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case REDSTONE_ORE:
|
||||
item = new ItemStack(Material.REDSTONE);
|
||||
m.mcDropItems(loc, item, 4);
|
||||
m.mcRandomDropItem(loc, item, 50);
|
||||
break;
|
||||
|
||||
case GLOWSTONE:
|
||||
item = new ItemStack(Material.GLOWSTONE_DUST);
|
||||
m.mcDropItems(loc, item, 2);
|
||||
m.mcRandomDropItems(loc, item, 50, 2);
|
||||
break;
|
||||
|
||||
case LAPIS_ORE:
|
||||
item = new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x4);
|
||||
m.mcDropItems(loc, item, 4);
|
||||
m.mcRandomDropItems(loc, item, 50, 4);
|
||||
break;
|
||||
|
||||
case STONE:
|
||||
item = new ItemStack(Material.COBBLESTONE);
|
||||
m.mcDropItem(loc, item);
|
||||
break;
|
||||
|
||||
default:
|
||||
m.mcDropItem(loc, item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||
{
|
||||
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
||||
{
|
||||
short durability = player.getItemInHand().getDurability();
|
||||
durability += LoadProperties.abilityDurabilityLoss;
|
||||
player.getItemInHand().setDurability(durability);
|
||||
}
|
||||
}
|
||||
|
||||
//Pre-processing
|
||||
int id = block.getTypeId();
|
||||
int xp = 0;
|
||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||
|
||||
//STONE
|
||||
if(id == 1 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//SANDSTONE
|
||||
else if(id == 24 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.msandstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//NETHERRACK
|
||||
else if(id == 87 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mnetherrack;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//GLOWSTONE
|
||||
else if(id == 89 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mglowstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//COAL
|
||||
else if(id == 16 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mcoal;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//GOLD
|
||||
else if(id == 14 && m.getTier(player) >= 3 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mgold;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//OBSIDIAN
|
||||
else if(id == 49 && m.getTier(player) >= 4 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mobsidian;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//DIAMOND
|
||||
else if(id == 56 && m.getTier(player) >= 3 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mdiamond;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//IRON
|
||||
else if(id == 15 && m.getTier(player) >= 2 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.miron;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//REDSTONE
|
||||
else if((id == 73 || id == 74) && m.getTier(player) >= 3 && !plugin.misc.blockWatchList.contains(block))
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mredstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//LAPIS
|
||||
else if(id == 21 && m.getTier(player) >= 3 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mlapis;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//END STONE
|
||||
else if(id == 121 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mendstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//MOSS STONE
|
||||
else if(id == 48 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mmossstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
if(!plugin.misc.blockWatchList.contains(block) && block.getData() != (byte) 5)
|
||||
PP.addXP(SkillType.MINING, xp, player);
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
Skills.XpCheckSkill(SkillType.MINING, player);
|
||||
|
||||
/**
|
||||
* Award XP for Mining blocks.
|
||||
*
|
||||
* @param player The player to award XP to
|
||||
* @param block The block to award XP for
|
||||
*/
|
||||
public static void miningXP(Player player, Block block) {
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
Material type = block.getType();
|
||||
int xp = 0;
|
||||
|
||||
switch (type) {
|
||||
case COAL_ORE:
|
||||
xp += LoadProperties.mcoal;
|
||||
break;
|
||||
|
||||
case DIAMOND_ORE:
|
||||
xp += LoadProperties.mdiamond;
|
||||
break;
|
||||
|
||||
case ENDER_STONE:
|
||||
xp += LoadProperties.mendstone;
|
||||
break;
|
||||
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case REDSTONE_ORE:
|
||||
xp += LoadProperties.mredstone;
|
||||
break;
|
||||
|
||||
case GLOWSTONE:
|
||||
xp += LoadProperties.mglowstone;
|
||||
break;
|
||||
|
||||
case GOLD_ORE:
|
||||
xp += LoadProperties.mgold;
|
||||
break;
|
||||
|
||||
case IRON_ORE:
|
||||
xp += LoadProperties.miron;
|
||||
break;
|
||||
|
||||
case LAPIS_ORE:
|
||||
xp += LoadProperties.mlapis;
|
||||
break;
|
||||
|
||||
case MOSSY_COBBLESTONE:
|
||||
xp += LoadProperties.mmossstone;
|
||||
break;
|
||||
|
||||
case NETHERRACK:
|
||||
xp += LoadProperties.mnetherrack;
|
||||
break;
|
||||
|
||||
case OBSIDIAN:
|
||||
xp += LoadProperties.mobsidian;
|
||||
break;
|
||||
|
||||
case SANDSTONE:
|
||||
xp += LoadProperties.msandstone;
|
||||
break;
|
||||
|
||||
case STONE:
|
||||
xp += LoadProperties.mstone;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
PP.addXP(SkillType.MINING, xp, player);
|
||||
Skills.XpCheckSkill(SkillType.MINING, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process Mining block drops.
|
||||
*
|
||||
* @param player The player mining the block
|
||||
* @param block The block being broken
|
||||
*/
|
||||
public static void miningBlockCheck(Player player, Block block) {
|
||||
if (block.hasMetadata("mcmmoPlacedBlock")) {
|
||||
return;
|
||||
}
|
||||
|
||||
miningXP(player, block);
|
||||
|
||||
if (canBeSuperBroken(block.getType())) {
|
||||
final int MAX_BONUS_LEVEL = 1000;
|
||||
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);
|
||||
|
||||
if ((MAX_BONUS_LEVEL > 1000 || (Math.random() * 1000 <= skillLevel)) && mcPermissions.getInstance().miningDoubleDrops(player)) {
|
||||
if (player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
|
||||
m.mcDropItem(block.getLocation(), new ItemStack(block.getType()));
|
||||
}
|
||||
else {
|
||||
miningDrops(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if a block is broken by Super Breaker.
|
||||
*
|
||||
* @param type The type of Block to check
|
||||
* @return true if the block would be broken by Super Breaker, false otherwise
|
||||
*/
|
||||
public static Boolean canBeSuperBroken(Material type) {
|
||||
switch (type) {
|
||||
case COAL_ORE:
|
||||
case DIAMOND_ORE:
|
||||
case ENDER_STONE:
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case GLOWSTONE:
|
||||
case GOLD_ORE:
|
||||
case IRON_ORE:
|
||||
case LAPIS_ORE:
|
||||
case MOSSY_COBBLESTONE:
|
||||
case NETHERRACK:
|
||||
case OBSIDIAN:
|
||||
case REDSTONE_ORE:
|
||||
case SANDSTONE:
|
||||
case STONE:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Super Breaker ability.
|
||||
*
|
||||
* @param player The player using the ability
|
||||
* @param block The block being affected
|
||||
*/
|
||||
public static void SuperBreakerBlockCheck(Player player, Block block) {
|
||||
Material type = block.getType();
|
||||
int tier = m.getTier(player.getItemInHand());
|
||||
int durabilityLoss = LoadProperties.abilityDurabilityLoss;
|
||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||
|
||||
switch (type) {
|
||||
case OBSIDIAN:
|
||||
if (tier < 4) {
|
||||
return;
|
||||
}
|
||||
durabilityLoss = durabilityLoss * 5; //Obsidian needs to do more damage than normal
|
||||
/* FALL THROUGH */
|
||||
|
||||
case DIAMOND_ORE:
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case GOLD_ORE:
|
||||
case LAPIS_ORE:
|
||||
case REDSTONE_ORE:
|
||||
if (tier < 3) {
|
||||
return;
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
|
||||
case IRON_ORE:
|
||||
if (tier < 2) {
|
||||
return;
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
|
||||
case COAL_ORE:
|
||||
case ENDER_STONE:
|
||||
case GLOWSTONE:
|
||||
case MOSSY_COBBLESTONE:
|
||||
case NETHERRACK:
|
||||
case SANDSTONE:
|
||||
case STONE:
|
||||
if (block.hasMetadata("mcmmoPlacedBlock")) {
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
Skills.abilityDurabilityLoss(player.getItemInHand(), durabilityLoss);
|
||||
|
||||
miningBlockCheck(player, block);
|
||||
miningBlockCheck(player, block);
|
||||
|
||||
if (LoadProperties.spoutEnabled) {
|
||||
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,590 +1,437 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import com.gmail.nossr50.ItemChecks;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.spout.SpoutSounds;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
|
||||
public class Repair {
|
||||
|
||||
private static int rGold = LoadProperties.rGold;
|
||||
private static String nGold = LoadProperties.nGold;
|
||||
private static int rStone = LoadProperties.rStone;
|
||||
private static String nStone = LoadProperties.nStone;
|
||||
private static int rWood = LoadProperties.rWood;
|
||||
private static String nWood = LoadProperties.nWood;
|
||||
private static int rDiamond = LoadProperties.rDiamond;
|
||||
private static String nDiamond = LoadProperties.nDiamond;
|
||||
private static int rIron = LoadProperties.rIron;
|
||||
private static String nIron = LoadProperties.nIron;
|
||||
private static int rString = LoadProperties.rString;
|
||||
private static String nString = LoadProperties.nString;
|
||||
private static int rLeather = LoadProperties.rLeather;
|
||||
private static String nLeather = LoadProperties.nLeather;
|
||||
|
||||
private static int dLevel = LoadProperties.repairdiamondlevel;
|
||||
private static int iLevel = LoadProperties.repairIronLevel;
|
||||
private static int gLevel = LoadProperties.repairGoldLevel;
|
||||
private static int sLevel = LoadProperties.repairStoneLevel;
|
||||
private static boolean spout = LoadProperties.spoutEnabled;
|
||||
|
||||
public static void repairCheck(Player player, ItemStack is, Block block){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
short durabilityBefore = is.getDurability();
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
int skillLevel = PP.getSkillLevel(SkillType.REPAIR);
|
||||
|
||||
//Stuff for keeping enchants
|
||||
Enchantment[] enchants = new Enchantment[is.getEnchantments().size()];
|
||||
int[] enchantsLevel = new int[is.getEnchantments().size()];
|
||||
/**
|
||||
* Handle all the item repair checks.
|
||||
*
|
||||
* @param player Player repairing the item
|
||||
* @param is The item being repaired
|
||||
*/
|
||||
public static void repairCheck(Player player, ItemStack is) {
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
short durabilityBefore = is.getDurability();
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
int skillLevel = PP.getSkillLevel(SkillType.REPAIR);
|
||||
|
||||
int pos = 0;
|
||||
for(Enchantment x : is.getEnchantments().keySet())
|
||||
{
|
||||
enchants[pos] = x;
|
||||
enchantsLevel[pos] = is.getEnchantmentLevel(x);
|
||||
pos++;
|
||||
}
|
||||
if (durabilityBefore > 0 && is.getAmount() == 1) {
|
||||
|
||||
if(block != null && mcPermissions.getInstance().repair(player)){
|
||||
if(durabilityBefore > 0 && is.getAmount() < 2){
|
||||
/*
|
||||
* REPAIR ARMOR
|
||||
*/
|
||||
if (ItemChecks.isArmor(is) && LoadProperties.repairArmor && mcPermissions.getInstance().armorRepair(player)) {
|
||||
if (ItemChecks.isDiamondArmor(is) && inventory.contains(LoadProperties.rDiamond) && skillLevel >= LoadProperties.repairdiamondlevel && mcPermissions.getInstance().diamondRepair(player)) {
|
||||
inventory.removeItem(new ItemStack(LoadProperties.rDiamond));
|
||||
repairItem(player, is);
|
||||
xpHandler(player, PP, is, durabilityBefore, 6, true);
|
||||
}
|
||||
else if (ItemChecks.isIronArmor(is) && inventory.contains(LoadProperties.rIron) && skillLevel >= LoadProperties.repairIronLevel && mcPermissions.getInstance().ironRepair(player)) {
|
||||
inventory.removeItem(new ItemStack(LoadProperties.rIron));
|
||||
repairItem(player, is);
|
||||
xpHandler(player, PP, is, durabilityBefore, 2, true);
|
||||
}
|
||||
else if (ItemChecks.isGoldArmor(is) && inventory.contains(LoadProperties.rGold) && skillLevel >= LoadProperties.repairGoldLevel && mcPermissions.getInstance().goldRepair(player)) {
|
||||
inventory.removeItem(new ItemStack(LoadProperties.rGold));
|
||||
repairItem(player, is);
|
||||
xpHandler(player, PP, is, durabilityBefore, 4, true);
|
||||
}
|
||||
else if (ItemChecks.isLeatherArmor(is) && inventory.contains(LoadProperties.rLeather)) {
|
||||
inventory.removeItem(new ItemStack(LoadProperties.rLeather));
|
||||
repairItem(player, is);
|
||||
xpHandler(player, PP, is, durabilityBefore, 1, true);
|
||||
}
|
||||
else {
|
||||
needMoreVespeneGas(is, player); //UNABLE TO REPAIR
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* REPAIR ARMOR
|
||||
*/
|
||||
if(isArmor(is) && LoadProperties.repairArmor){
|
||||
/*
|
||||
* REPAIR TOOLS
|
||||
*/
|
||||
else if (ItemChecks.isTool(is) && LoadProperties.repairTools && mcPermissions.getInstance().toolRepair(player)) {
|
||||
if (ItemChecks.isStoneTool(is) && inventory.contains(LoadProperties.rStone) && skillLevel >= LoadProperties.repairStoneLevel && mcPermissions.getInstance().stoneRepair(player)) {
|
||||
inventory.removeItem(new ItemStack(LoadProperties.rStone));
|
||||
repairItem(player, is);
|
||||
xpHandler(player, PP, is, durabilityBefore, 2, false);
|
||||
}
|
||||
else if (ItemChecks.isWoodTool(is) && inventory.contains(LoadProperties.rWood)) {
|
||||
inventory.removeItem(new ItemStack(LoadProperties.rWood));
|
||||
repairItem(player, is);
|
||||
xpHandler(player, PP, is, durabilityBefore, 2, false);
|
||||
}
|
||||
else if (ItemChecks.isIronTool(is) && inventory.contains(LoadProperties.rIron) && skillLevel >= LoadProperties.repairIronLevel && mcPermissions.getInstance().ironRepair(player)) {
|
||||
inventory.removeItem(new ItemStack(LoadProperties.rIron));
|
||||
repairItem(player, is);
|
||||
xpHandler(player, PP, is, durabilityBefore, 1, true);
|
||||
}
|
||||
else if (ItemChecks.isDiamondTool(is) && inventory.contains(LoadProperties.rDiamond) && skillLevel >= LoadProperties.repairdiamondlevel && mcPermissions.getInstance().diamondRepair(player)) {
|
||||
inventory.removeItem(new ItemStack(LoadProperties.rDiamond));
|
||||
repairItem(player, is);
|
||||
xpHandler(player, PP, is, durabilityBefore, 1, true);
|
||||
}
|
||||
else if (ItemChecks.isGoldTool(is) && inventory.contains(LoadProperties.rGold) && skillLevel >= LoadProperties.repairGoldLevel && mcPermissions.getInstance().goldRepair(player)) {
|
||||
inventory.removeItem(new ItemStack(LoadProperties.rGold));
|
||||
repairItem(player, is);
|
||||
xpHandler(player, PP, is, durabilityBefore, 8, true);
|
||||
}
|
||||
else if (is.getType().equals(Material.BOW) && inventory.contains(LoadProperties.rString)){
|
||||
inventory.removeItem(new ItemStack(LoadProperties.rString));
|
||||
repairItem(player, is);
|
||||
xpHandler(player, PP, is, durabilityBefore, 2, false);
|
||||
}
|
||||
else {
|
||||
needMoreVespeneGas(is, player); //UNABLE TO REPAIR
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
player.sendMessage(mcLocale.getString("Skills.FullDurability"));
|
||||
}
|
||||
}
|
||||
|
||||
//DIAMOND ARMOR
|
||||
if(isDiamondArmor(is) && inventory.contains(rDiamond) && skillLevel >= dLevel){
|
||||
inventory.removeItem(new ItemStack(rDiamond, 1));
|
||||
repairItem(player, enchants, enchantsLevel);
|
||||
xpHandler(player, PP, is, durabilityBefore, 6, true);
|
||||
}
|
||||
/**
|
||||
* Handle the XP gain for repair events.
|
||||
*
|
||||
* @param player Player repairing the item
|
||||
* @param PP PlayerProfile of the repairing player
|
||||
* @param is Item being repaired
|
||||
* @param durabilityBefore Durability of the item before repair
|
||||
* @param modify Amount to modify the durability by
|
||||
* @param boost True if the modifier is a boost, false if the modifier is a reduction
|
||||
*/
|
||||
private static void xpHandler(Player player, PlayerProfile PP, ItemStack is, short durabilityBefore, int modify, boolean boost) {
|
||||
short durabilityAfter = is.getDurability();
|
||||
short dif = (short) (durabilityBefore - durabilityAfter);
|
||||
|
||||
//IRON ARMOR
|
||||
else if (isIronArmor(is) && inventory.contains(rIron) && skillLevel >= iLevel){
|
||||
inventory.removeItem(new ItemStack(rIron, 1));
|
||||
repairItem(player, enchants, enchantsLevel);
|
||||
xpHandler(player, PP, is, durabilityBefore, 2, true);
|
||||
}
|
||||
if (boost) {
|
||||
dif = (short) (dif * modify);
|
||||
}
|
||||
else{
|
||||
dif = (short) (dif / modify);
|
||||
}
|
||||
|
||||
//GOLD ARMOR
|
||||
else if (isGoldArmor(is) && inventory.contains(rGold) && skillLevel >= gLevel){
|
||||
inventory.removeItem(new ItemStack(rGold, 1));
|
||||
repairItem(player, enchants, enchantsLevel);
|
||||
xpHandler(player, PP, is, durabilityBefore, 4, true);
|
||||
}
|
||||
if (ItemChecks.isShovel(is)) {
|
||||
dif = (short) (dif / 3);
|
||||
}
|
||||
else if(ItemChecks.isSword(is)) {
|
||||
dif = (short) (dif / 2);
|
||||
}
|
||||
else if(ItemChecks.isHoe(is)) {
|
||||
dif = (short) (dif / 2);
|
||||
}
|
||||
|
||||
//LEATHER ARMOR
|
||||
else if (isLeatherArmor(is) && inventory.contains(rLeather)){
|
||||
inventory.removeItem(new ItemStack(rLeather, 1));
|
||||
repairItem(player, enchants, enchantsLevel);
|
||||
xpHandler(player, PP, is, durabilityBefore, 1, true);
|
||||
}
|
||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
||||
Skills.XpCheckSkill(SkillType.REPAIR, player);
|
||||
|
||||
//UNABLE TO REPAIR
|
||||
else {
|
||||
needMoreVespeneGas(is, player);
|
||||
}
|
||||
}
|
||||
//CLANG CLANG
|
||||
if (LoadProperties.spoutEnabled) {
|
||||
SpoutSounds.playRepairNoise(player);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* REPAIR TOOLS
|
||||
*/
|
||||
if(isTools(is) && LoadProperties.repairTools){
|
||||
/**
|
||||
* Get current Arcane Forging rank.
|
||||
*
|
||||
* @param skillLevel The skill level of the player whose rank is being checked
|
||||
* @return The player's current Arcane Forging rank
|
||||
*/
|
||||
public static int getArcaneForgingRank(int skillLevel) {
|
||||
if (skillLevel >= LoadProperties.arcaneRank4) {
|
||||
return 4;
|
||||
}
|
||||
else if (skillLevel >= LoadProperties.arcaneRank3) {
|
||||
return 3;
|
||||
}
|
||||
else if (skillLevel >= LoadProperties.arcaneRank2) {
|
||||
return 2;
|
||||
}
|
||||
else if (skillLevel >= LoadProperties.arcaneRank1) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//STONE TOOLS
|
||||
if(isStoneTools(is) && inventory.contains(rStone) && skillLevel >= sLevel){
|
||||
inventory.removeItem(new ItemStack(rStone, 1));
|
||||
repairItem(player, enchants, enchantsLevel);
|
||||
xpHandler(player, PP, is, durabilityBefore, 2, false);
|
||||
}
|
||||
/**
|
||||
* Handles removing & downgrading enchants.
|
||||
*
|
||||
* @param player Player repairing the item
|
||||
* @param is Item being repaired
|
||||
*/
|
||||
private static void addEnchants(Player player, ItemStack is) {
|
||||
Map<Enchantment, Integer> enchants = is.getEnchantments();
|
||||
|
||||
//WOOD TOOLS
|
||||
else if(isWoodTools(is) && inventory.contains(rWood)){
|
||||
inventory.removeItem(new ItemStack(rWood, 1));
|
||||
repairItem(player, enchants, enchantsLevel);
|
||||
xpHandler(player, PP, is, durabilityBefore, 2, false);
|
||||
}
|
||||
if (enchants.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
//IRON TOOLS
|
||||
else if(isIronTools(is) && inventory.contains(rIron) && skillLevel >= iLevel){
|
||||
inventory.removeItem(new ItemStack(rIron, 1));
|
||||
repairItem(player, enchants, enchantsLevel);
|
||||
xpHandler(player, PP, is, durabilityBefore, 1, true);
|
||||
}
|
||||
int rank = getArcaneForgingRank(Users.getProfile(player).getSkillLevel(SkillType.REPAIR));
|
||||
|
||||
//DIAMOND TOOLS
|
||||
else if (isDiamondTools(is) && inventory.contains(rDiamond) && skillLevel >= dLevel){
|
||||
inventory.removeItem(new ItemStack(rDiamond, 1));
|
||||
repairItem(player, enchants, enchantsLevel);
|
||||
xpHandler(player, PP, is, durabilityBefore, 1, true);
|
||||
}
|
||||
|
||||
//GOLD TOOLS
|
||||
else if(isGoldTools(is) && inventory.contains(rGold) && skillLevel >= gLevel){
|
||||
inventory.removeItem(new ItemStack(rGold, 1));
|
||||
repairItem(player, enchants, enchantsLevel);
|
||||
xpHandler(player, PP, is, durabilityBefore, 8, true);
|
||||
}
|
||||
|
||||
//BOW
|
||||
else if(isBow(is) && inventory.contains(rString)){
|
||||
inventory.removeItem(new ItemStack(rString, 1));
|
||||
repairItem(player, enchants, enchantsLevel);
|
||||
xpHandler(player, PP, is, durabilityBefore, 2, false);
|
||||
}
|
||||
if (rank == 0 || !mcPermissions.getInstance().arcaneForging(player)) {
|
||||
for (Enchantment x : enchants.keySet()) {
|
||||
is.removeEnchantment(x);
|
||||
}
|
||||
player.sendMessage(mcLocale.getString("Repair.LostEnchants"));
|
||||
return;
|
||||
}
|
||||
|
||||
//UNABLE TO REPAIR
|
||||
else {
|
||||
needMoreVespeneGas(is, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean downgraded = false;
|
||||
|
||||
else {
|
||||
player.sendMessage(mcLocale.getString("Skills.FullDurability"));
|
||||
}
|
||||
for (Entry<Enchantment, Integer> enchant : enchants.entrySet()) {
|
||||
Enchantment enchantment = enchant.getKey();
|
||||
|
||||
/*
|
||||
* GIVE SKILL IF THERE IS ENOUGH XP
|
||||
*/
|
||||
Skills.XpCheckSkill(SkillType.REPAIR, player);
|
||||
}
|
||||
}
|
||||
|
||||
public static void xpHandler(Player player, PlayerProfile PP, ItemStack is, short durabilityBefore, int modify, boolean boost)
|
||||
{
|
||||
short durabilityAfter = is.getDurability();
|
||||
short dif = (short) (durabilityBefore - durabilityAfter);
|
||||
if(boost)
|
||||
dif = (short) (dif * modify);
|
||||
if(!boost)
|
||||
dif = (short) (dif / modify);
|
||||
if(m.isShovel(is))
|
||||
dif = (short) (dif / 3);
|
||||
if(m.isSwords(is))
|
||||
dif = (short) (dif / 2);
|
||||
if(m.isHoe(is))
|
||||
dif = (short) (dif / 2);
|
||||
|
||||
PP.addXP(SkillType.REPAIR, dif*10, player);
|
||||
|
||||
//CLANG CLANG
|
||||
if(spout)
|
||||
SpoutStuff.playRepairNoise(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current Arcane Forging rank.
|
||||
*
|
||||
* @param skillLevel The skill level of the player whose rank is being checked
|
||||
* @return The player's current Arcane Forging rank
|
||||
*/
|
||||
public static int getArcaneForgingRank(int skillLevel)
|
||||
{
|
||||
if(skillLevel >= LoadProperties.arcaneRank4)
|
||||
return 4;
|
||||
if (skillLevel >= LoadProperties.arcaneRank3)
|
||||
return 3;
|
||||
if(skillLevel >= LoadProperties.arcaneRank2)
|
||||
return 2;
|
||||
if (skillLevel >= LoadProperties.arcaneRank1)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void addEnchants(ItemStack is, Enchantment[] enchants, int[] enchantsLvl, PlayerProfile PP, Player player){
|
||||
if(is.getEnchantments().keySet().size() == 0)
|
||||
return;
|
||||
if (Math.random() * 100 <= getEnchantChance(rank)) {
|
||||
int enchantLevel = enchant.getValue();
|
||||
|
||||
int pos = 0;
|
||||
int rank = getArcaneForgingRank(PP.getSkillLevel(SkillType.REPAIR));
|
||||
if (LoadProperties.mayDowngradeEnchants && enchantLevel > 1) {
|
||||
if (Math.random() * 100 <= getDowngradeChance(rank)) {
|
||||
is.addEnchantment(enchantment, enchantLevel--);
|
||||
downgraded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
is.removeEnchantment(enchantment);
|
||||
}
|
||||
}
|
||||
|
||||
if(rank == 0)
|
||||
{
|
||||
if(LoadProperties.mayLoseEnchants)
|
||||
{
|
||||
player.sendMessage(mcLocale.getString("Repair.LostEnchants"));
|
||||
for(Enchantment x : enchants)
|
||||
{
|
||||
is.removeEnchantment(x);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
Map<Enchantment, Integer> newEnchants = is.getEnchantments();
|
||||
|
||||
boolean failure = false, downgrade = false;
|
||||
if (newEnchants.isEmpty()) {
|
||||
player.sendMessage(mcLocale.getString("Repair.ArcaneFailed"));
|
||||
}
|
||||
else if (downgraded || newEnchants.size() < enchants.size()) {
|
||||
player.sendMessage(mcLocale.getString("Repair.Downgraded"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(mcLocale.getString("Repair.ArcanePerfect"));
|
||||
}
|
||||
}
|
||||
|
||||
if(LoadProperties.mayLoseEnchants)
|
||||
{
|
||||
for(Enchantment x : enchants)
|
||||
{
|
||||
//Remove enchant
|
||||
is.removeEnchantment(x);
|
||||
|
||||
if(x.canEnchantItem(is))
|
||||
{
|
||||
if(Math.random() * 100 <= getEnchantChance(rank))
|
||||
{
|
||||
if(enchantsLvl[pos] > 1)
|
||||
{
|
||||
if(LoadProperties.mayDowngradeEnchants)
|
||||
{
|
||||
if(Math.random() * 100 <= getDowngradeChance(rank))
|
||||
{
|
||||
is.addEnchantment(x, enchantsLvl[pos]-1);
|
||||
downgrade = true;
|
||||
} else
|
||||
{
|
||||
is.addEnchantment(x, enchantsLvl[pos]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
is.addEnchantment(x, enchantsLvl[pos]);
|
||||
}
|
||||
} else {
|
||||
failure = true;
|
||||
}
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets chance of keeping enchantment during repair.
|
||||
*
|
||||
* @param rank Arcane Forging rank
|
||||
* @return The chance of keeping the enchantment
|
||||
*/
|
||||
public static int getEnchantChance(int rank) {
|
||||
switch (rank) {
|
||||
case 4:
|
||||
return LoadProperties.keepEnchantsRank4;
|
||||
|
||||
if(failure == false && downgrade == false)
|
||||
{
|
||||
player.sendMessage(mcLocale.getString("Repair.ArcanePerfect"));
|
||||
} else {
|
||||
if(failure == true)
|
||||
player.sendMessage(mcLocale.getString("Repair.ArcaneFailed"));
|
||||
if(downgrade == true)
|
||||
player.sendMessage(mcLocale.getString("Repair.Downgraded"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets chance of keeping enchantment during repair.
|
||||
*
|
||||
* @param rank Arcane Forging rank
|
||||
* @return The chance of keeping the enchantment
|
||||
*/
|
||||
public static int getEnchantChance(int rank)
|
||||
{
|
||||
switch(rank)
|
||||
{
|
||||
case 4:
|
||||
return LoadProperties.keepEnchantsRank4;
|
||||
case 3:
|
||||
return LoadProperties.keepEnchantsRank3;
|
||||
case 2:
|
||||
return LoadProperties.keepEnchantsRank2;
|
||||
case 1:
|
||||
return LoadProperties.keepEnchantsRank1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets chance of enchantment being downgraded during repair.
|
||||
*
|
||||
* @param rank Arcane Forging rank
|
||||
* @return The chance of the enchantment being downgraded
|
||||
*/
|
||||
public static int getDowngradeChance(int rank)
|
||||
{
|
||||
switch(rank)
|
||||
{
|
||||
case 4:
|
||||
return LoadProperties.downgradeRank4;
|
||||
case 3:
|
||||
return LoadProperties.downgradeRank3;
|
||||
case 2:
|
||||
return LoadProperties.downgradeRank2;
|
||||
case 1:
|
||||
return LoadProperties.downgradeRank1;
|
||||
default:
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isArmor(ItemStack is){
|
||||
return isLeatherArmor(is) || isGoldArmor(is) || isIronArmor(is) || isDiamondArmor(is);
|
||||
}
|
||||
|
||||
public static boolean isLeatherArmor(ItemStack is){
|
||||
switch(is.getType()){
|
||||
case LEATHER_BOOTS:
|
||||
case LEATHER_CHESTPLATE:
|
||||
case LEATHER_HELMET:
|
||||
case LEATHER_LEGGINGS:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isGoldArmor(ItemStack is){
|
||||
switch(is.getType()){
|
||||
case GOLD_BOOTS:
|
||||
case GOLD_CHESTPLATE:
|
||||
case GOLD_HELMET:
|
||||
case GOLD_LEGGINGS:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isIronArmor(ItemStack is){
|
||||
switch(is.getType()){
|
||||
case IRON_BOOTS:
|
||||
case IRON_CHESTPLATE:
|
||||
case IRON_HELMET:
|
||||
case IRON_LEGGINGS:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isDiamondArmor(ItemStack is){
|
||||
switch(is.getType()){
|
||||
case DIAMOND_BOOTS:
|
||||
case DIAMOND_CHESTPLATE:
|
||||
case DIAMOND_HELMET:
|
||||
case DIAMOND_LEGGINGS:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isTools(ItemStack is)
|
||||
{
|
||||
return isStoneTools(is) || isWoodTools(is) || isGoldTools(is) || isIronTools(is) || isDiamondTools(is) || isBow(is);
|
||||
}
|
||||
|
||||
public static boolean isStoneTools(ItemStack is){
|
||||
switch(is.getType()){
|
||||
case STONE_AXE:
|
||||
case STONE_HOE:
|
||||
case STONE_PICKAXE:
|
||||
case STONE_SPADE:
|
||||
case STONE_SWORD:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean isWoodTools(ItemStack is){
|
||||
switch(is.getType()){
|
||||
case WOOD_AXE:
|
||||
case WOOD_HOE:
|
||||
case WOOD_PICKAXE:
|
||||
case WOOD_SPADE:
|
||||
case WOOD_SWORD:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean isGoldTools(ItemStack is){
|
||||
switch(is.getType()){
|
||||
case GOLD_AXE:
|
||||
case GOLD_HOE:
|
||||
case GOLD_PICKAXE:
|
||||
case GOLD_SPADE:
|
||||
case GOLD_SWORD:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean isIronTools(ItemStack is){
|
||||
switch(is.getType()){
|
||||
case IRON_AXE:
|
||||
case IRON_HOE:
|
||||
case IRON_PICKAXE:
|
||||
case IRON_SPADE:
|
||||
case IRON_SWORD:
|
||||
case SHEARS:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean isDiamondTools(ItemStack is){
|
||||
switch(is.getType()){
|
||||
case DIAMOND_AXE:
|
||||
case DIAMOND_HOE:
|
||||
case DIAMOND_PICKAXE:
|
||||
case DIAMOND_SPADE:
|
||||
case DIAMOND_SWORD:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isBow(ItemStack is){
|
||||
return is.getType() == Material.BOW;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes repair bonuses.
|
||||
*
|
||||
* @param player The player repairing an item
|
||||
* @param durability The durability of the item being repaired
|
||||
* @param ramt The base amount of durability repaired to the item
|
||||
* @return The final amount of durability repaired to the item
|
||||
*/
|
||||
public static short repairCalculate(Player player, short durability, int ramt){
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
|
||||
float bonus = (float)(skillLevel/500);
|
||||
bonus = (ramt * bonus);
|
||||
ramt+=bonus;
|
||||
if(checkPlayerProcRepair(player))
|
||||
ramt = (short) (ramt * 2);
|
||||
durability-=ramt;
|
||||
if(durability < 0)
|
||||
durability = 0;
|
||||
return durability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the base durability amount to repair an item.
|
||||
*
|
||||
* @param is The item being repaired
|
||||
* @param player The player repairing the item
|
||||
* @return The final amount of durability repaired to the item
|
||||
*/
|
||||
public static short getRepairAmount(ItemStack is, Player player){
|
||||
short durability = is.getDurability();
|
||||
short maxDurability = is.getType().getMaxDurability();
|
||||
int ramt = 0;
|
||||
|
||||
if(m.isShovel(is))
|
||||
ramt = maxDurability;
|
||||
else if(m.isHoe(is) || m.isSwords(is) || is.getTypeId() == 359)
|
||||
ramt = maxDurability / 2;
|
||||
else if(m.isAxes(is) || m.isMiningPick(is) || isBow(is))
|
||||
ramt = maxDurability / 3;
|
||||
else if(m.isBoots(is))
|
||||
ramt = maxDurability / 4;
|
||||
else if(m.isHelmet(is))
|
||||
ramt = maxDurability / 5;
|
||||
else if(m.isPants(is))
|
||||
ramt = maxDurability / 7;
|
||||
else if(m.isChestplate(is))
|
||||
ramt = maxDurability / 8;
|
||||
|
||||
return repairCalculate(player, durability, ramt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Informs a player that the repair has failed.
|
||||
*
|
||||
* @param is The item being repaired
|
||||
* @param player The player repairing the item
|
||||
*/
|
||||
public static void needMoreVespeneGas(ItemStack is, Player player)
|
||||
{
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
|
||||
|
||||
if(is.getAmount() > 1)
|
||||
player.sendMessage(mcLocale.getString("Skills.StackedItems"));
|
||||
else
|
||||
{
|
||||
if(isDiamondTools(is) || isDiamondArmor(is))
|
||||
{
|
||||
if(skillLevel < LoadProperties.repairdiamondlevel)
|
||||
player.sendMessage(mcLocale.getString("Skills.AdeptDiamond"));
|
||||
else
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.BLUE+ nDiamond);
|
||||
}
|
||||
else if(isIronTools(is) || isIronArmor(is))
|
||||
{
|
||||
if(skillLevel < LoadProperties.repairIronLevel)
|
||||
player.sendMessage(mcLocale.getString("Skills.AdeptIron"));
|
||||
else
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GRAY+ nIron);
|
||||
}
|
||||
else if(isGoldTools(is) || isGoldArmor(is))
|
||||
{
|
||||
if(skillLevel < LoadProperties.repairGoldLevel)
|
||||
player.sendMessage(mcLocale.getString("Skills.AdeptGold"));
|
||||
else
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GOLD+nGold);
|
||||
}
|
||||
else if(isStoneTools(is))
|
||||
{
|
||||
if(skillLevel < LoadProperties.repairStoneLevel)
|
||||
player.sendMessage(mcLocale.getString("Skills.AdeptStone"));
|
||||
else
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GRAY+nStone);
|
||||
}
|
||||
else if(isWoodTools(is))
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.DARK_GREEN+ nWood);
|
||||
else if (isLeatherArmor(is))
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.YELLOW+ nLeather);
|
||||
else if (isBow(is))
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.YELLOW+ nString);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for Super Repair bonus.
|
||||
*
|
||||
* @param player The player repairing an item.
|
||||
* @return true if bonus granted, false otherwise
|
||||
*/
|
||||
public static boolean checkPlayerProcRepair(Player player)
|
||||
{
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
|
||||
if(skillLevel > 1000 || (Math.random() * 1000 <= skillLevel))
|
||||
{
|
||||
player.sendMessage(mcLocale.getString("Skills.FeltEasy"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Repairs an item.
|
||||
*
|
||||
* @param player The player repairing an item
|
||||
* @param enchants The enchantments on the item
|
||||
* @param enchantsLevel The level of the enchantments on the item
|
||||
*/
|
||||
public static void repairItem(Player player, Enchantment[] enchants, int[] enchantsLevel)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
ItemStack is = player.getItemInHand();
|
||||
//Handle the enchantments
|
||||
addEnchants(is, enchants, enchantsLevel, PP, player);
|
||||
is.setDurability(getRepairAmount(is, player));
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
return LoadProperties.keepEnchantsRank3;
|
||||
|
||||
case 2:
|
||||
return LoadProperties.keepEnchantsRank2;
|
||||
|
||||
case 1:
|
||||
return LoadProperties.keepEnchantsRank1;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets chance of enchantment being downgraded during repair.
|
||||
*
|
||||
* @param rank Arcane Forging rank
|
||||
* @return The chance of the enchantment being downgraded
|
||||
*/
|
||||
public static int getDowngradeChance(int rank) {
|
||||
switch (rank) {
|
||||
case 4:
|
||||
return LoadProperties.downgradeRank4;
|
||||
|
||||
case 3:
|
||||
return LoadProperties.downgradeRank3;
|
||||
|
||||
case 2:
|
||||
return LoadProperties.downgradeRank2;
|
||||
|
||||
case 1:
|
||||
return LoadProperties.downgradeRank1;
|
||||
|
||||
default:
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes repair bonuses.
|
||||
*
|
||||
* @param player The player repairing an item
|
||||
* @param durability The durability of the item being repaired
|
||||
* @param ramt The base amount of durability repaired to the item
|
||||
* @return The final amount of durability repaired to the item
|
||||
*/
|
||||
private static short repairCalculate(Player player, short durability, int ramt) {
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
|
||||
float bonus = (float) skillLevel / 500;
|
||||
|
||||
bonus = (ramt * bonus);
|
||||
ramt += bonus;
|
||||
|
||||
if (checkPlayerProcRepair(player)) {
|
||||
ramt = (short) (ramt * 2);
|
||||
}
|
||||
|
||||
durability -= ramt;
|
||||
|
||||
if (durability < 0) {
|
||||
durability = 0;
|
||||
}
|
||||
return durability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the base durability amount to repair an item.
|
||||
*
|
||||
* @param is The item being repaired
|
||||
* @param player The player repairing the item
|
||||
* @return The final amount of durability repaired to the item
|
||||
*/
|
||||
private static short getRepairAmount(ItemStack is, Player player){
|
||||
short maxDurability = is.getType().getMaxDurability();
|
||||
int ramt = 0;
|
||||
|
||||
if (ItemChecks.isShovel(is)) {
|
||||
ramt = maxDurability;
|
||||
}
|
||||
else if (ItemChecks.isHoe(is) || ItemChecks.isSword(is) || is.getType().equals(Material.SHEARS)) {
|
||||
ramt = maxDurability / 2;
|
||||
}
|
||||
else if (ItemChecks.isAxe(is) || ItemChecks.isMiningPick(is) || is.getType().equals(Material.BOW)) {
|
||||
ramt = maxDurability / 3;
|
||||
}
|
||||
else if (ItemChecks.isBoots(is)) {
|
||||
ramt = maxDurability / 4;
|
||||
}
|
||||
else if (ItemChecks.isHelmet(is)) {
|
||||
ramt = maxDurability / 5;
|
||||
}
|
||||
else if (ItemChecks.isPants(is)) {
|
||||
ramt = maxDurability / 7;
|
||||
}
|
||||
else if (ItemChecks.isChestplate(is)) {
|
||||
ramt = maxDurability / 8;
|
||||
}
|
||||
|
||||
return repairCalculate(player, is.getDurability(), ramt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Informs a player that the repair has failed.
|
||||
*
|
||||
* @param is The item being repaired
|
||||
* @param player The player repairing the item
|
||||
*/
|
||||
private static void needMoreVespeneGas(ItemStack is, Player player) {
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
|
||||
|
||||
if (is.getAmount() != 1) {
|
||||
player.sendMessage(mcLocale.getString("Skills.StackedItems"));
|
||||
}
|
||||
else {
|
||||
if (ItemChecks.isDiamondTool(is) || ItemChecks.isDiamondArmor(is)) {
|
||||
if (skillLevel < LoadProperties.repairdiamondlevel) {
|
||||
player.sendMessage(mcLocale.getString("Skills.AdeptDiamond"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.BLUE + m.prettyItemString(LoadProperties.rDiamond));
|
||||
}
|
||||
}
|
||||
else if (ItemChecks.isIronTool(is) || ItemChecks.isIronArmor(is)) {
|
||||
if (skillLevel < LoadProperties.repairIronLevel) {
|
||||
player.sendMessage(mcLocale.getString("Skills.AdeptIron"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(LoadProperties.rIron));
|
||||
}
|
||||
}
|
||||
else if (ItemChecks.isGoldTool(is) || ItemChecks.isGoldArmor(is)) {
|
||||
if (skillLevel < LoadProperties.repairGoldLevel) {
|
||||
player.sendMessage(mcLocale.getString("Skills.AdeptGold"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GOLD + m.prettyItemString(LoadProperties.rGold));
|
||||
}
|
||||
}
|
||||
else if (ItemChecks.isStoneTool(is)) {
|
||||
if (skillLevel < LoadProperties.repairStoneLevel) {
|
||||
player.sendMessage(mcLocale.getString("Skills.AdeptStone"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GRAY + m.prettyItemString(LoadProperties.rStone));
|
||||
}
|
||||
}
|
||||
else if (ItemChecks.isWoodTool(is)) {
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.DARK_GREEN + m.prettyItemString(LoadProperties.rWood));
|
||||
}
|
||||
else if (ItemChecks.isLeatherArmor(is)) {
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(LoadProperties.rLeather));
|
||||
}
|
||||
else if (is.getType().equals(Material.BOW)) {
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(LoadProperties.rString));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for Super Repair bonus.
|
||||
*
|
||||
* @param player The player repairing an item
|
||||
* @return true if bonus granted, false otherwise
|
||||
*/
|
||||
public static boolean checkPlayerProcRepair(Player player) {
|
||||
final int MAX_BONUS_LEVEL = 1000;
|
||||
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
|
||||
|
||||
if ((skillLevel > MAX_BONUS_LEVEL || (Math.random() * 1000 <= skillLevel)) && mcPermissions.getInstance().repairBonus(player)) {
|
||||
player.sendMessage(mcLocale.getString("Skills.FeltEasy"));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Repairs an item.
|
||||
*
|
||||
* @param player The player repairing an item
|
||||
* @param enchants The enchantments on the item
|
||||
* @param enchantsLevel The level of the enchantments on the item
|
||||
*/
|
||||
public static void repairItem(Player player, ItemStack is) {
|
||||
|
||||
/* Handle the enchants */
|
||||
if (LoadProperties.mayLoseEnchants && !mcPermissions.getInstance().arcaneBypass(player)) {
|
||||
addEnchants(player, is);
|
||||
}
|
||||
|
||||
is.setDurability(getRepairAmount(is, player));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,11 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
@@ -38,274 +23,425 @@ import com.gmail.nossr50.datatypes.ToolType;
|
||||
import com.gmail.nossr50.events.McMMOPlayerLevelUpEvent;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class Skills
|
||||
{
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
public static boolean cooldownOver(Player player, long oldTime, int cooldown){
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if(currentTime - oldTime >= (cooldown * 1000))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int calculateTimeLeft(Player player, long deactivatedTimeStamp, int cooldown)
|
||||
{
|
||||
return (int) (((deactivatedTimeStamp + (cooldown * 1000)) - System.currentTimeMillis())/1000);
|
||||
public class Skills {
|
||||
|
||||
private final static int TIME_CONVERSION_FACTOR = 1000;
|
||||
private final static int MAX_DISTANCE_AWAY = 10;
|
||||
|
||||
/**
|
||||
* Checks to see if the cooldown for an item or ability is expired.
|
||||
*
|
||||
* @param oldTime The time the ability or item was last used
|
||||
* @param cooldown The amount of time that must pass between uses
|
||||
* @return true if the cooldown is over, false otherwise
|
||||
*/
|
||||
public static boolean cooldownOver(long oldTime, int cooldown){
|
||||
long currentTime = System.currentTimeMillis();
|
||||
|
||||
if (currentTime - oldTime >= (cooldown * TIME_CONVERSION_FACTOR)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void watchCooldown(Player player, PlayerProfile PP, long curTime, AbilityType ability)
|
||||
{
|
||||
if(!ability.getInformed(PP) && curTime - (PP.getSkillDATS(ability) * 1000) >= (ability.getCooldown() * 1000))
|
||||
{
|
||||
ability.setInformed(PP, true);
|
||||
player.sendMessage(ability.getAbilityRefresh());
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the time remaining until the cooldown expires.
|
||||
*
|
||||
* @param deactivatedTimeStamp Time of deactivation
|
||||
* @param cooldown The length of the cooldown
|
||||
* @return the number of seconds remaining before the cooldown expires
|
||||
*/
|
||||
public static int calculateTimeLeft(long deactivatedTimeStamp, int cooldown) {
|
||||
return (int) (((deactivatedTimeStamp + (cooldown * TIME_CONVERSION_FACTOR)) - System.currentTimeMillis()) / TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
|
||||
public static void activationCheck(Player player, SkillType skill)
|
||||
{
|
||||
if(LoadProperties.enableOnlyActivateWhenSneaking && !player.isSneaking())
|
||||
return;
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
AbilityType ability = skill.getAbility();
|
||||
ToolType tool = skill.getTool();
|
||||
|
||||
if(!PP.getAbilityUse() || PP.getSuperBreakerMode() || PP.getSerratedStrikesMode() || PP.getTreeFellerMode() || PP.getGreenTerraMode() || PP.getBerserkMode() || PP.getGigaDrillBreakerMode())
|
||||
return;
|
||||
|
||||
//Woodcutting & Axes need to be treated differently
|
||||
//Basically the tool always needs to ready and we check to see if the cooldown is over when the user takes action
|
||||
if(skill == SkillType.WOODCUTTING || skill == SkillType.AXES)
|
||||
{
|
||||
if(tool.inHand(player.getItemInHand()) && !tool.getToolMode(PP))
|
||||
{
|
||||
if(LoadProperties.enableAbilityMessages)
|
||||
|
||||
/**
|
||||
* Sends a message to the player when the cooldown expires.
|
||||
*
|
||||
* @param player The player to send a message to
|
||||
* @param PP The profile of the player
|
||||
* @param curTime The current system time
|
||||
* @param ability The ability to watch cooldowns for
|
||||
*/
|
||||
public static void watchCooldown(Player player, PlayerProfile PP, long curTime, AbilityType ability) {
|
||||
if (!ability.getInformed(PP) && curTime - (PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR) >= (ability.getCooldown() * TIME_CONVERSION_FACTOR)) {
|
||||
ability.setInformed(PP, true);
|
||||
player.sendMessage(ability.getAbilityRefresh());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process activating abilities & readying the tool.
|
||||
*
|
||||
* @param player The player using the ability
|
||||
* @param skill The skill the ability is tied to
|
||||
*/
|
||||
public static void activationCheck(Player player, SkillType skill) {
|
||||
if (LoadProperties.enableOnlyActivateWhenSneaking && !player.isSneaking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
AbilityType ability = skill.getAbility();
|
||||
ToolType tool = skill.getTool();
|
||||
ItemStack inHand = player.getItemInHand();
|
||||
|
||||
/* Check if any abilities are active */
|
||||
if (!PP.getAbilityUse() || PP.getSuperBreakerMode() || PP.getSerratedStrikesMode() || PP.getTreeFellerMode() || PP.getGreenTerraMode() || PP.getBerserkMode() || PP.getGigaDrillBreakerMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Woodcutting & Axes need to be treated differently.
|
||||
* Basically the tool always needs to ready and we check to see if the cooldown is over when the user takes action
|
||||
*/
|
||||
if (skill == SkillType.WOODCUTTING || skill == SkillType.AXES) {
|
||||
if (tool.inHand(inHand) && !tool.getToolMode(PP)) {
|
||||
if (LoadProperties.enableAbilityMessages) {
|
||||
player.sendMessage(tool.getRaiseTool());
|
||||
|
||||
}
|
||||
|
||||
tool.setToolATS(PP, System.currentTimeMillis());
|
||||
tool.setToolMode(PP, true);
|
||||
}
|
||||
} else if(ability.getPermissions(player) && tool.inHand(player.getItemInHand()) && !tool.getToolMode(PP))
|
||||
{
|
||||
if(!ability.getMode(PP) && !cooldownOver(player, (PP.getSkillDATS(ability) * 1000), ability.getCooldown()))
|
||||
{
|
||||
player.sendMessage(mcLocale.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(player, (PP.getSkillDATS(ability) * 1000), ability.getCooldown()) + "s)");
|
||||
return;
|
||||
}
|
||||
|
||||
if(LoadProperties.enableAbilityMessages)
|
||||
player.sendMessage(tool.getRaiseTool());
|
||||
|
||||
tool.setToolATS(PP, System.currentTimeMillis());
|
||||
tool.setToolMode(PP, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ability.getPermissions(player) && tool.inHand(inHand) && !tool.getToolMode(PP)) {
|
||||
if (!ability.getMode(PP) && !cooldownOver(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown())) {
|
||||
player.sendMessage(mcLocale.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (LoadProperties.enableAbilityMessages) {
|
||||
player.sendMessage(tool.getRaiseTool());
|
||||
}
|
||||
|
||||
tool.setToolATS(PP, System.currentTimeMillis());
|
||||
tool.setToolMode(PP, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static void monitorSkill(Player player, PlayerProfile PP, long curTime, SkillType skill)
|
||||
{
|
||||
ToolType tool = skill.getTool();
|
||||
AbilityType ability = skill.getAbility();
|
||||
if(tool.getToolMode(PP) && curTime - (tool.getToolATS(PP) * 1000) >= 4000)
|
||||
{
|
||||
tool.setToolMode(PP, false);
|
||||
player.sendMessage(tool.getLowerTool());
|
||||
}
|
||||
|
||||
if(ability.getPermissions(player))
|
||||
{
|
||||
if(ability.getMode(PP) && (PP.getSkillDATS(ability) * 1000) <= curTime)
|
||||
{
|
||||
ability.setMode(PP, false);
|
||||
ability.setInformed(PP, false);
|
||||
player.sendMessage(ability.getAbilityOff());
|
||||
|
||||
for(Player y : player.getWorld().getPlayers())
|
||||
{
|
||||
if(y != player && m.isNear(player.getLocation(), y.getLocation(), 10))
|
||||
|
||||
/**
|
||||
* Monitors various things relating to skill abilities.
|
||||
*
|
||||
* @param player The player using the skill
|
||||
* @param PP The profile of the player
|
||||
* @param curTime The current system time
|
||||
* @param skill The skill being monitored
|
||||
*/
|
||||
public static void monitorSkill(Player player, PlayerProfile PP, long curTime, SkillType skill) {
|
||||
final int FOUR_SECONDS = 4000;
|
||||
|
||||
ToolType tool = skill.getTool();
|
||||
AbilityType ability = skill.getAbility();
|
||||
|
||||
if (tool.getToolMode(PP) && curTime - (tool.getToolATS(PP) * TIME_CONVERSION_FACTOR) >= FOUR_SECONDS) {
|
||||
tool.setToolMode(PP, false);
|
||||
player.sendMessage(tool.getLowerTool());
|
||||
}
|
||||
|
||||
if (ability.getPermissions(player)) {
|
||||
if (ability.getMode(PP) && (PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR) <= curTime) {
|
||||
ability.setMode(PP, false);
|
||||
ability.setInformed(PP, false);
|
||||
player.sendMessage(ability.getAbilityOff());
|
||||
|
||||
for (Player y : player.getWorld().getPlayers()) {
|
||||
if (y != player && m.isNear(player.getLocation(), y.getLocation(), MAX_DISTANCE_AWAY)) {
|
||||
y.sendMessage(ability.getAbilityPlayerOff(player));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ProcessLeaderboardUpdate(SkillType skillType, Player player)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
PlayerStat ps = new PlayerStat();
|
||||
if(skillType != SkillType.ALL)
|
||||
ps.statVal = PP.getSkillLevel(skillType);
|
||||
else
|
||||
ps.statVal = m.getPowerLevel(player);
|
||||
ps.name = player.getName();
|
||||
Leaderboard.updateLeaderboard(ps, skillType);
|
||||
}
|
||||
|
||||
public static void XpCheckSkill(SkillType skillType, Player player)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if(PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType))
|
||||
{
|
||||
int skillups = 0;
|
||||
|
||||
while(PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType))
|
||||
{
|
||||
if(skillType.getMaxLevel() >= PP.getSkillLevel(skillType) + 1)
|
||||
{
|
||||
skillups++;
|
||||
PP.removeXP(skillType, PP.getXpToLevel(skillType));
|
||||
PP.skillUp(skillType, 1);
|
||||
|
||||
McMMOPlayerLevelUpEvent eventToFire = new McMMOPlayerLevelUpEvent(player, skillType);
|
||||
Bukkit.getPluginManager().callEvent(eventToFire);
|
||||
} else
|
||||
{
|
||||
PP.removeXP(skillType, PP.getXpToLevel(skillType));
|
||||
}
|
||||
}
|
||||
|
||||
if(!LoadProperties.useMySQL)
|
||||
{
|
||||
ProcessLeaderboardUpdate(skillType, player);
|
||||
ProcessLeaderboardUpdate(SkillType.ALL, player);
|
||||
}
|
||||
|
||||
String capitalized = m.getCapitalized(skillType.toString());
|
||||
|
||||
//Contrib stuff
|
||||
|
||||
if(LoadProperties.spoutEnabled && player instanceof SpoutPlayer)
|
||||
{
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||
if(sPlayer.isSpoutCraftEnabled())
|
||||
{
|
||||
SpoutStuff.levelUpNotification(skillType, sPlayer);
|
||||
} else
|
||||
{
|
||||
player.sendMessage(mcLocale.getString("Skills."+capitalized+"Up", new Object[] {String.valueOf(skillups), PP.getSkillLevel(skillType)}));
|
||||
}
|
||||
}
|
||||
else
|
||||
player.sendMessage(mcLocale.getString("Skills."+capitalized+"Up", new Object[] {String.valueOf(skillups), PP.getSkillLevel(skillType)}));
|
||||
}
|
||||
if(LoadProperties.xpbar && LoadProperties.spoutEnabled)
|
||||
{
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||
if(sPlayer.isSpoutCraftEnabled())
|
||||
{
|
||||
SpoutStuff.updateXpBar(sPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void XpCheckAll(Player player)
|
||||
{
|
||||
for(SkillType x : SkillType.values())
|
||||
{
|
||||
//Don't want to do anything with this one
|
||||
if(x == SkillType.ALL)
|
||||
continue;
|
||||
|
||||
XpCheckSkill(x, player);
|
||||
}
|
||||
}
|
||||
|
||||
public static SkillType getSkillType(String skillName)
|
||||
{
|
||||
for(SkillType x : SkillType.values())
|
||||
{
|
||||
if(x.toString().equals(skillName.toUpperCase()))
|
||||
return x;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSkill(String skillname){
|
||||
skillname = skillname.toUpperCase();
|
||||
for(SkillType x : SkillType.values())
|
||||
{
|
||||
if(x.toString().equals(skillname))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
/**
|
||||
* Update the leaderboards.
|
||||
*
|
||||
* @param skillType The skill to update the leaderboards for
|
||||
* @param player The player whose skill to update
|
||||
*/
|
||||
public static void ProcessLeaderboardUpdate(SkillType skillType, Player player) {
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
PlayerStat ps = new PlayerStat();
|
||||
|
||||
if (skillType != SkillType.ALL) {
|
||||
ps.statVal = PP.getSkillLevel(skillType);
|
||||
}
|
||||
else {
|
||||
ps.statVal = m.getPowerLevel(player, PP);
|
||||
}
|
||||
|
||||
ps.name = player.getName();
|
||||
Leaderboard.updateLeaderboard(ps, skillType);
|
||||
}
|
||||
|
||||
//We should probably rework this - it's a fairly ugly way to do this, compared to our other command formatting.
|
||||
public static String getSkillStats(String skillname, Integer level, Integer XP, Integer XPToLevel)
|
||||
{
|
||||
ChatColor parColor = ChatColor.DARK_AQUA;
|
||||
ChatColor xpColor = ChatColor.GRAY;
|
||||
ChatColor LvlColor = ChatColor.GREEN;
|
||||
ChatColor skillColor = ChatColor.YELLOW;
|
||||
|
||||
return skillColor+skillname+LvlColor+level+parColor+" XP"+"("+xpColor+XP+parColor+"/"+xpColor+XPToLevel+parColor+")";
|
||||
|
||||
/**
|
||||
* Check the XP of a skill.
|
||||
*
|
||||
* @param skillType The skill to check
|
||||
* @param player The player whose skill to check
|
||||
*/
|
||||
public static void XpCheckSkill(SkillType skillType, Player player) {
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) {
|
||||
int skillups = 0;
|
||||
|
||||
while (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) {
|
||||
if (skillType.getMaxLevel() >= PP.getSkillLevel(skillType) + 1) {
|
||||
skillups++;
|
||||
PP.removeXP(skillType, PP.getXpToLevel(skillType));
|
||||
PP.skillUp(skillType, 1);
|
||||
|
||||
McMMOPlayerLevelUpEvent eventToFire = new McMMOPlayerLevelUpEvent(player, skillType);
|
||||
Bukkit.getPluginManager().callEvent(eventToFire);
|
||||
}
|
||||
else {
|
||||
PP.removeXP(skillType, PP.getXpToLevel(skillType));
|
||||
}
|
||||
}
|
||||
|
||||
if (!LoadProperties.useMySQL) {
|
||||
ProcessLeaderboardUpdate(skillType, player);
|
||||
ProcessLeaderboardUpdate(SkillType.ALL, player);
|
||||
}
|
||||
|
||||
String capitalized = m.getCapitalized(skillType.toString());
|
||||
|
||||
/* Spout Stuff */
|
||||
if (LoadProperties.spoutEnabled && player instanceof SpoutPlayer) {
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||
|
||||
if (sPlayer.isSpoutCraftEnabled()) {
|
||||
if (LoadProperties.xpbar) {
|
||||
SpoutStuff.updateXpBar(sPlayer);
|
||||
}
|
||||
|
||||
SpoutStuff.levelUpNotification(skillType, sPlayer);
|
||||
}
|
||||
else {
|
||||
player.sendMessage(mcLocale.getString("Skills."+capitalized+"Up", new Object[] {String.valueOf(skillups), PP.getSkillLevel(skillType)}));
|
||||
}
|
||||
}
|
||||
else {
|
||||
player.sendMessage(mcLocale.getString("Skills."+capitalized+"Up", new Object[] {String.valueOf(skillups), PP.getSkillLevel(skillType)}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasCombatSkills(Player player)
|
||||
{
|
||||
if(mcPermissions.getInstance().axes(player) || mcPermissions.getInstance().archery(player) || mcPermissions.getInstance().swords(player) || mcPermissions.getInstance().taming(player) || mcPermissions.getInstance().unarmed(player))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
/**
|
||||
* Check XP of all skills.
|
||||
*
|
||||
* @param player The player to check XP for.
|
||||
*/
|
||||
public static void XpCheckAll(Player player) {
|
||||
for (SkillType x : SkillType.values()) {
|
||||
//Don't want to do anything with this one
|
||||
if (x == SkillType.ALL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
XpCheckSkill(x, player);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasGatheringSkills(Player player)
|
||||
{
|
||||
if(mcPermissions.getInstance().excavation(player) || mcPermissions.getInstance().fishing(player) || mcPermissions.getInstance().herbalism(player) || mcPermissions.getInstance().mining(player) || mcPermissions.getInstance().woodcutting(player))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
/**
|
||||
* Get the skill represented by the given string
|
||||
*
|
||||
* @param skillName The name of the skill
|
||||
* @return the SkillType if it exists, null otherwise
|
||||
*/
|
||||
public static SkillType getSkillType(String skillName) {
|
||||
for (SkillType x : SkillType.values()) {
|
||||
if (x.toString().equals(skillName.toUpperCase()))
|
||||
return x;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean hasMiscSkills(Player player)
|
||||
{
|
||||
if(mcPermissions.getInstance().acrobatics(player) || mcPermissions.getInstance().repair(player))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
/**
|
||||
* Checks if the given string represents a valid skill
|
||||
*
|
||||
* @param skillname The name of the skill to check
|
||||
* @return true if this is a valid skill, false otherwise
|
||||
*/
|
||||
public static boolean isSkill(String skillName) {
|
||||
if (getSkillType(skillName) != null) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the format string for
|
||||
* @param skillname
|
||||
* @param level
|
||||
* @param XP
|
||||
* @param XPToLevel
|
||||
* @return
|
||||
*/
|
||||
public static String getSkillStats(String skillname, Integer level, Integer XP, Integer XPToLevel) {
|
||||
//TODO: Ditch this function in favor of better locale setup.
|
||||
|
||||
ChatColor parColor = ChatColor.DARK_AQUA;
|
||||
ChatColor xpColor = ChatColor.GRAY;
|
||||
ChatColor LvlColor = ChatColor.GREEN;
|
||||
ChatColor skillColor = ChatColor.YELLOW;
|
||||
|
||||
return skillColor + skillname + LvlColor + level + parColor +" XP" + "(" + xpColor + XP + parColor + "/" + xpColor + XPToLevel + parColor + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the player has any combat skill permissions.
|
||||
*
|
||||
* @param player The player to check permissions for
|
||||
* @return true if the player has combat skills, false otherwise
|
||||
*/
|
||||
public static boolean hasCombatSkills(Player player) {
|
||||
if (mcPermissions.getInstance().axes(player)
|
||||
|| mcPermissions.getInstance().archery(player)
|
||||
|| mcPermissions.getInstance().swords(player)
|
||||
|| mcPermissions.getInstance().taming(player)
|
||||
|| mcPermissions.getInstance().unarmed(player)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the player has any gathering skill permissions.
|
||||
*
|
||||
* @param player The player to check permissions for
|
||||
* @return true if the player has gathering skills, false otherwise
|
||||
*/
|
||||
public static boolean hasGatheringSkills(Player player) {
|
||||
if (mcPermissions.getInstance().excavation(player)
|
||||
|| mcPermissions.getInstance().fishing(player)
|
||||
|| mcPermissions.getInstance().herbalism(player)
|
||||
|| mcPermissions.getInstance().mining(player)
|
||||
|| mcPermissions.getInstance().woodcutting(player)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the player has any misc skill permissions.
|
||||
*
|
||||
* @param player The player to check permissions for
|
||||
* @return true if the player has misc skills, false otherwise
|
||||
*/
|
||||
public static boolean hasMiscSkills(Player player) {
|
||||
if (mcPermissions.getInstance().acrobatics(player) || mcPermissions.getInstance().repair(player)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle tool durability loss from abilities.
|
||||
*
|
||||
* @param inhand The item to damage
|
||||
* @param durabilityLoss The durability to remove from the item
|
||||
*/
|
||||
public static void abilityDurabilityLoss(ItemStack inhand, int durabilityLoss) {
|
||||
if (LoadProperties.toolsLoseDurabilityFromAbilities) {
|
||||
if (!inhand.containsEnchantment(Enchantment.DURABILITY)) {
|
||||
inhand.setDurability((short) (inhand.getDurability() + durabilityLoss));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if an ability can be activated.
|
||||
*
|
||||
*
|
||||
* @param player The player activating the ability
|
||||
* @param type The skill the ability is based on
|
||||
*/
|
||||
public static void abilityCheck(Player player, SkillType type)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
AbilityType ability = type.getAbility();
|
||||
if(type.getTool().inHand(player.getItemInHand()))
|
||||
{
|
||||
if(type.getTool().getToolMode(PP))
|
||||
type.getTool().setToolMode(PP, false);
|
||||
|
||||
//Axes and Woodcutting are odd because they share the same tool so we show them the too tired message when they take action
|
||||
if(type == SkillType.WOODCUTTING || type == SkillType.AXES)
|
||||
{
|
||||
if(!ability.getMode(PP) && !cooldownOver(player, (PP.getSkillDATS(ability) * 1000), ability.getCooldown()))
|
||||
{
|
||||
player.sendMessage(mcLocale.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(player, (PP.getSkillDATS(ability) * 1000), ability.getCooldown()) + "s)");
|
||||
public static void abilityCheck(Player player, SkillType type) {
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
AbilityType ability = type.getAbility();
|
||||
|
||||
if (type.getTool().inHand(player.getItemInHand())) {
|
||||
if (type.getTool().getToolMode(PP)) {
|
||||
type.getTool().setToolMode(PP, false);
|
||||
}
|
||||
|
||||
/* Axes and Woodcutting are odd because they share the same tool.
|
||||
* We show them the too tired message when they take action.
|
||||
*/
|
||||
if (type == SkillType.WOODCUTTING || type == SkillType.AXES) {
|
||||
if (!ability.getMode(PP) && !cooldownOver(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown())) {
|
||||
player.sendMessage(mcLocale.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int ticks = 2 + (PP.getSkillLevel(type) / 50);
|
||||
if(!ability.getMode(PP) && cooldownOver(player, PP.getSkillDATS(ability), ability.getCooldown()))
|
||||
{
|
||||
player.sendMessage(ability.getAbilityOn());
|
||||
for(Player y : player.getWorld().getPlayers())
|
||||
{
|
||||
if(y != player && m.isNear(player.getLocation(), y.getLocation(), 10))
|
||||
y.sendMessage(ability.getAbilityPlayer(player));
|
||||
}
|
||||
PP.setSkillDATS(ability, System.currentTimeMillis()+(ticks*1000));
|
||||
ability.setMode(PP, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ticks = 2 + (PP.getSkillLevel(type) / 50);
|
||||
|
||||
if (!ability.getMode(PP) && cooldownOver(PP.getSkillDATS(ability), ability.getCooldown())) {
|
||||
player.sendMessage(ability.getAbilityOn());
|
||||
|
||||
for (Player y : player.getWorld().getPlayers()) {
|
||||
if (y != player && m.isNear(player.getLocation(), y.getLocation(), MAX_DISTANCE_AWAY)) {
|
||||
y.sendMessage(ability.getAbilityPlayer(player));
|
||||
}
|
||||
}
|
||||
|
||||
PP.setSkillDATS(ability, System.currentTimeMillis()+(ticks * TIME_CONVERSION_FACTOR));
|
||||
ability.setMode(PP, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if ability should be triggered.
|
||||
*
|
||||
* @param player The player using the ability
|
||||
* @param block The block modified by the ability
|
||||
* @param ability The ability to check
|
||||
* @return true if the ability should activate, false otherwise
|
||||
*/
|
||||
public static boolean triggerCheck(Player player, Block block, AbilityType ability) {
|
||||
boolean activate = true;
|
||||
|
||||
if (!ability.getPermissions(player)) {
|
||||
activate = false;
|
||||
return activate;
|
||||
}
|
||||
|
||||
switch (ability) {
|
||||
case BERSERK:
|
||||
case GIGA_DRILL_BREAKER:
|
||||
case SUPER_BREAKER:
|
||||
case LEAF_BLOWER:
|
||||
if (!m.blockBreakSimulate(block, player, true)) {
|
||||
activate = false;
|
||||
break;
|
||||
}
|
||||
/* FALLS THROUGH */
|
||||
|
||||
case GREEN_TERRA:
|
||||
if (!ability.blockCheck(block.getType())) {
|
||||
activate = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
activate = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return activate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,14 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
|
||||
import com.gmail.nossr50.Combat;
|
||||
import com.gmail.nossr50.ItemChecks;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@@ -30,194 +17,96 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.runnables.mcBleedTimer;
|
||||
|
||||
public class Swords
|
||||
{
|
||||
public static void bleedCheck(Player attacker, LivingEntity x, mcMMO pluginx)
|
||||
{
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
|
||||
if(x instanceof Wolf)
|
||||
{
|
||||
Wolf wolf = (Wolf)x;
|
||||
if(wolf.getOwner() instanceof Player)
|
||||
{
|
||||
Player owner = (Player) wolf.getOwner();
|
||||
if(owner == attacker)
|
||||
return;
|
||||
if(Party.getInstance().inSameParty(attacker, owner))
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(mcPermissions.getInstance().swords(attacker) && m.isSwords(attacker.getItemInHand())){
|
||||
if(PPa.getSkillLevel(SkillType.SWORDS) >= 750)
|
||||
{
|
||||
if(Math.random() * 1000 <= 750)
|
||||
{
|
||||
if(!(x instanceof Player))
|
||||
pluginx.misc.addToBleedQue(x);
|
||||
if(x instanceof Player)
|
||||
{
|
||||
Player target = (Player)x;
|
||||
Users.getProfile(target).addBleedTicks(3);
|
||||
}
|
||||
attacker.sendMessage(mcLocale.getString("Swords.EnemyBleeding"));
|
||||
}
|
||||
}
|
||||
else if (Math.random() * 1000 <= PPa.getSkillLevel(SkillType.SWORDS))
|
||||
{
|
||||
if(!(x instanceof Player))
|
||||
pluginx.misc.addToBleedQue(x);
|
||||
if(x instanceof Player)
|
||||
{
|
||||
Player target = (Player)x;
|
||||
Users.getProfile(target).addBleedTicks(2);
|
||||
}
|
||||
attacker.sendMessage(mcLocale.getString("Swords.EnemyBleeding"));
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void applySerratedStrikes(Player attacker, EntityDamageByEntityEvent event, mcMMO pluginx)
|
||||
{
|
||||
int targets = 0;
|
||||
|
||||
int dmgAmount = (event.getDamage()/4);
|
||||
|
||||
//Setup minimum damage
|
||||
if(dmgAmount < 1)
|
||||
dmgAmount = 1;
|
||||
|
||||
if(event.getEntity() instanceof LivingEntity)
|
||||
{
|
||||
LivingEntity x = (LivingEntity) event.getEntity();
|
||||
targets = m.getTier(attacker);
|
||||
|
||||
for(Entity derp : x.getNearbyEntities(2.5, 2.5, 2.5))
|
||||
{
|
||||
//Make sure the Wolf is not friendly
|
||||
if(derp instanceof Wolf)
|
||||
{
|
||||
Wolf hurrDurr = (Wolf)derp;
|
||||
if(hurrDurr.getOwner() instanceof Player)
|
||||
{
|
||||
Player owner = (Player) hurrDurr.getOwner();
|
||||
if(owner == attacker)
|
||||
return;
|
||||
if(Party.getInstance().inSameParty(attacker, owner))
|
||||
return;
|
||||
}
|
||||
}
|
||||
//Damage nearby LivingEntities
|
||||
if(derp instanceof LivingEntity && targets >= 1)
|
||||
{
|
||||
if(derp instanceof Player)
|
||||
{
|
||||
Player target = (Player)derp;
|
||||
|
||||
if(target.getName().equals(attacker.getName()))
|
||||
continue;
|
||||
|
||||
if(Users.getProfile(target).getGodMode())
|
||||
continue;
|
||||
|
||||
if(Party.getInstance().inSameParty(attacker, target))
|
||||
continue;
|
||||
if(targets >= 1 && derp.getWorld().getPVP())
|
||||
{
|
||||
Combat.dealDamage(target, dmgAmount, attacker);
|
||||
target.sendMessage(mcLocale.getString("Swords.HitBySerratedStrikes"));
|
||||
Users.getProfile(target).addBleedTicks(5);
|
||||
targets--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!pluginx.misc.bleedTracker.contains(derp))
|
||||
pluginx.misc.addToBleedQue((LivingEntity)derp);
|
||||
|
||||
LivingEntity target = (LivingEntity)derp;
|
||||
Combat.dealDamage(target, dmgAmount, attacker);
|
||||
targets--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void counterAttackChecks(EntityDamageByEntityEvent event)
|
||||
{
|
||||
//Don't want to counter attack stuff not alive
|
||||
|
||||
if(!(event.getDamager() instanceof LivingEntity))
|
||||
return;
|
||||
public class Swords {
|
||||
|
||||
if(event instanceof EntityDamageByEntityEvent)
|
||||
{
|
||||
Entity f = ((EntityDamageByEntityEvent) event).getDamager();
|
||||
if(event.getEntity() instanceof Player)
|
||||
{
|
||||
Player defender = (Player)event.getEntity();
|
||||
PlayerProfile PPd = Users.getProfile(defender);
|
||||
if(m.isSwords(defender.getItemInHand()) && mcPermissions.getInstance().swords(defender))
|
||||
{
|
||||
if(PPd.getSkillLevel(SkillType.SWORDS) >= 600)
|
||||
{
|
||||
if(Math.random() * 2000 <= 600)
|
||||
{
|
||||
Combat.dealDamage((LivingEntity) f, event.getDamage() / 2);
|
||||
defender.sendMessage(mcLocale.getString("Swords.CounterAttacked"));
|
||||
if(f instanceof Player)
|
||||
((Player) f).sendMessage(mcLocale.getString("Swords.HitByCounterAttack"));
|
||||
}
|
||||
}
|
||||
else if (Math.random() * 2000 <= PPd.getSkillLevel(SkillType.SWORDS))
|
||||
{
|
||||
Combat.dealDamage((LivingEntity) f, event.getDamage() / 2);
|
||||
defender.sendMessage(mcLocale.getString("Swords.CounterAttacked"));
|
||||
if(f instanceof Player)
|
||||
((Player) f).sendMessage(mcLocale.getString("Swords.HitByCounterAttack"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Check for Bleed effect.
|
||||
*
|
||||
* @param attacker The attacking player
|
||||
* @param entity The defending entity
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void bleedCheck(Player attacker, LivingEntity entity, mcMMO plugin) {
|
||||
|
||||
if (entity instanceof Wolf) {
|
||||
Wolf wolf = (Wolf) entity;
|
||||
|
||||
if (wolf.isTamed()) {
|
||||
AnimalTamer tamer = wolf.getOwner();
|
||||
|
||||
if (tamer instanceof Player) {
|
||||
Player owner = (Player) tamer;
|
||||
|
||||
if (owner == attacker || Party.getInstance().inSameParty(attacker, owner)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final int MAX_BONUS_LEVEL = 750;
|
||||
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
int skillLevel = PPa.getSkillLevel(SkillType.SWORDS);
|
||||
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL);
|
||||
|
||||
if (Math.random() * 1000 <= skillCheck && !entity.isDead()) {
|
||||
if (entity instanceof Player) {
|
||||
Player target = (Player) entity;
|
||||
int bleedTicks;
|
||||
|
||||
if (skillLevel >= 750) {
|
||||
bleedTicks = 3;
|
||||
}
|
||||
else {
|
||||
bleedTicks = 2;
|
||||
}
|
||||
|
||||
Users.getProfile(target).addBleedTicks(bleedTicks);
|
||||
}
|
||||
else {
|
||||
mcBleedTimer.add(entity);
|
||||
}
|
||||
attacker.sendMessage(mcLocale.getString("Swords.EnemyBleeding"));
|
||||
}
|
||||
}
|
||||
|
||||
public static void bleedSimulate(mcMMO plugin)
|
||||
{
|
||||
//Add items from Que list to BleedTrack list
|
||||
|
||||
for(LivingEntity x : plugin.misc.bleedQue)
|
||||
{
|
||||
plugin.misc.bleedTracker.add(x);
|
||||
}
|
||||
|
||||
//Clear list
|
||||
plugin.misc.bleedQue = new LivingEntity[plugin.misc.bleedQue.length];
|
||||
plugin.misc.bleedQuePos = 0;
|
||||
|
||||
//Cleanup any dead entities from the list
|
||||
for(LivingEntity x : plugin.misc.bleedRemovalQue)
|
||||
{
|
||||
plugin.misc.bleedTracker.remove(x);
|
||||
}
|
||||
|
||||
//Clear bleed removal list
|
||||
plugin.misc.bleedRemovalQue = new LivingEntity[plugin.misc.bleedRemovalQue.length];
|
||||
plugin.misc.bleedRemovalQuePos = 0;
|
||||
|
||||
//Bleed monsters/animals
|
||||
for(LivingEntity x : plugin.misc.bleedTracker)
|
||||
{
|
||||
if(x == null || x.isDead())
|
||||
{
|
||||
plugin.misc.addToBleedRemovalQue(x);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
Combat.dealDamage(x, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Counter-attack entities.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static void counterAttackChecks(EntityDamageByEntityEvent event) {
|
||||
Entity attacker = event.getDamager();
|
||||
|
||||
if (!(attacker instanceof LivingEntity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity target = event.getEntity();
|
||||
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
PlayerProfile PPd = Users.getProfile(defender);
|
||||
|
||||
if (ItemChecks.isSword(defender.getItemInHand()) && mcPermissions.getInstance().counterAttack(defender)) {
|
||||
final int MAX_BONUS_LEVEL = 600;
|
||||
final int COUNTER_ATTACK_MODIFIER = 2;
|
||||
|
||||
int skillLevel = PPd.getSkillLevel(SkillType.SWORDS);
|
||||
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL);
|
||||
|
||||
if (Math.random() * 2000 <= skillCheck) {
|
||||
Combat.dealDamage((LivingEntity) attacker, event.getDamage() / COUNTER_ATTACK_MODIFIER);
|
||||
defender.sendMessage(mcLocale.getString("Swords.CounterAttacked"));
|
||||
|
||||
if (attacker instanceof Player) {
|
||||
((Player) attacker).sendMessage(mcLocale.getString("Swords.HitByCounterAttack"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,159 +1,277 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import com.gmail.nossr50.Combat;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class Taming
|
||||
{
|
||||
public static void rewardXp(EntityDamageEvent event, mcMMO pluginx, Player master)
|
||||
{
|
||||
Entity entity = event.getEntity();
|
||||
if(!pluginx.misc.mobSpawnerList.contains(entity.getEntityId()))
|
||||
{
|
||||
int xp = Combat.getXp(entity, event.getDamage());
|
||||
Users.getProfile(master).addXP(SkillType.TAMING, xp*10, master);
|
||||
|
||||
if(entity instanceof Player)
|
||||
{
|
||||
xp = (event.getDamage() * 2);
|
||||
Users.getProfile(master).addXP(SkillType.TAMING, (int)((xp*10)*1.5), master);
|
||||
}
|
||||
Skills.XpCheckSkill(SkillType.TAMING, master);
|
||||
}
|
||||
}
|
||||
|
||||
public static void fastFoodService(PlayerProfile PPo, Wolf theWolf, EntityDamageEvent event)
|
||||
{
|
||||
int health = theWolf.getHealth();
|
||||
int maxHealth = theWolf.getMaxHealth();
|
||||
int damage = event.getDamage();
|
||||
if(PPo.getSkillLevel(SkillType.TAMING) >= 50)
|
||||
{
|
||||
if(health < maxHealth)
|
||||
{
|
||||
if(Math.random() * 10 > 5)
|
||||
{
|
||||
if(health + damage <= maxHealth)
|
||||
theWolf.setHealth(health + damage);
|
||||
else
|
||||
theWolf.setHealth(maxHealth);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void sharpenedClaws(PlayerProfile PPo, EntityDamageEvent event)
|
||||
{
|
||||
if(PPo.getSkillLevel(SkillType.TAMING) >= 750)
|
||||
{
|
||||
event.setDamage(event.getDamage() + 2);
|
||||
}
|
||||
}
|
||||
|
||||
public static void gore(PlayerProfile PPo, EntityDamageEvent event, Player master, mcMMO pluginx)
|
||||
{
|
||||
if(Math.random() * 1000 <= PPo.getSkillLevel(SkillType.TAMING))
|
||||
{
|
||||
Entity entity = event.getEntity();
|
||||
event.setDamage(event.getDamage() * 2);
|
||||
|
||||
if(entity instanceof Player)
|
||||
{
|
||||
Player target = (Player)entity;
|
||||
target.sendMessage(mcLocale.getString("Combat.StruckByGore")); //$NON-NLS-1$
|
||||
Users.getProfile(target).setBleedTicks(2);
|
||||
}
|
||||
else
|
||||
pluginx.misc.addToBleedQue((LivingEntity)entity);
|
||||
|
||||
master.sendMessage(mcLocale.getString("Combat.Gore")); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
public static String getOwnerName(Wolf theWolf)
|
||||
{
|
||||
Player owner = null;
|
||||
|
||||
if (theWolf.getOwner() instanceof Player)
|
||||
{
|
||||
owner = (Player)theWolf.getOwner();
|
||||
return owner.getName();
|
||||
}
|
||||
else
|
||||
return "Offline Master";
|
||||
}
|
||||
|
||||
public static void preventDamage(EntityDamageEvent event, mcMMO plugin)
|
||||
{
|
||||
DamageCause cause = event.getCause();
|
||||
Wolf wolf = (Wolf) event.getEntity();
|
||||
Player master = (Player) wolf.getOwner();
|
||||
int skillLevel = Users.getProfile(master).getSkillLevel(SkillType.TAMING);
|
||||
|
||||
switch(cause)
|
||||
{
|
||||
//Environmentally Aware
|
||||
case CONTACT:
|
||||
case LAVA:
|
||||
case FIRE:
|
||||
if(skillLevel >= 100)
|
||||
{
|
||||
if(event.getDamage() >= wolf.getHealth())
|
||||
return;
|
||||
|
||||
wolf.teleport(master.getLocation());
|
||||
master.sendMessage(mcLocale.getString("mcEntityListener.WolfComesBack")); //$NON-NLS-1$
|
||||
}
|
||||
break;
|
||||
case FALL:
|
||||
if(skillLevel >= 100)
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
|
||||
//Thick Fur
|
||||
case FIRE_TICK:
|
||||
if(skillLevel >= 250)
|
||||
wolf.setFireTicks(0);
|
||||
break;
|
||||
case ENTITY_ATTACK:
|
||||
case PROJECTILE:
|
||||
if(skillLevel >= 250)
|
||||
event.setDamage(event.getDamage() / 2);
|
||||
break;
|
||||
|
||||
//Shock Proof
|
||||
case ENTITY_EXPLOSION:
|
||||
case BLOCK_EXPLOSION:
|
||||
if(skillLevel >= 500)
|
||||
event.setDamage(event.getDamage() / 6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.runnables.mcBleedTimer;
|
||||
|
||||
public class Taming {
|
||||
|
||||
/**
|
||||
* Apply the Fast Food Service ability.
|
||||
*
|
||||
* @param PPo The PlayerProfile of the wolf's owner
|
||||
* @param theWolf The wolf using the ability
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static void fastFoodService (PlayerProfile PPo, Wolf theWolf, EntityDamageEvent event) {
|
||||
final int SKILL_ACTIVATION_LEVEL = 50;
|
||||
final int ACTIVATION_CHANCE = 50;
|
||||
|
||||
int health = theWolf.getHealth();
|
||||
int maxHealth = theWolf.getMaxHealth();
|
||||
int damage = event.getDamage();
|
||||
|
||||
if (PPo.getSkillLevel(SkillType.TAMING) >= SKILL_ACTIVATION_LEVEL) {
|
||||
if (health < maxHealth) {
|
||||
if (Math.random() * 100 < ACTIVATION_CHANCE) {
|
||||
if (health + damage <= maxHealth) {
|
||||
theWolf.setHealth(health + damage);
|
||||
}
|
||||
else {
|
||||
theWolf.setHealth(maxHealth);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Sharpened Claws ability.
|
||||
*
|
||||
* @param PPo The PlayerProfile of the wolf's owner
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static void sharpenedClaws(PlayerProfile PPo, EntityDamageEvent event) {
|
||||
final int SKILL_ACTIVATION_LEVEL = 750;
|
||||
final int SHARPENED_CLAWS_BONUS = 2;
|
||||
|
||||
if (PPo.getSkillLevel(SkillType.TAMING) >= SKILL_ACTIVATION_LEVEL) {
|
||||
event.setDamage(event.getDamage() + SHARPENED_CLAWS_BONUS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Gore ability.
|
||||
*
|
||||
* @param PPo The PlayerProfile of the wolf's owner
|
||||
* @param event The event to modify
|
||||
* @param master The wolf's master
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void gore(PlayerProfile PPo, EntityDamageEvent event, Player master, mcMMO plugin) {
|
||||
final int GORE_MULTIPLIER = 2;
|
||||
|
||||
if (Math.random() * 1000 <= PPo.getSkillLevel(SkillType.TAMING)) {
|
||||
Entity entity = event.getEntity();
|
||||
event.setDamage(event.getDamage() * GORE_MULTIPLIER);
|
||||
|
||||
if (entity instanceof Player) {
|
||||
Player target = (Player) entity;
|
||||
|
||||
target.sendMessage(mcLocale.getString("Combat.StruckByGore"));
|
||||
Users.getProfile(target).setBleedTicks(2);
|
||||
}
|
||||
else {
|
||||
mcBleedTimer.add((LivingEntity) entity);
|
||||
}
|
||||
|
||||
master.sendMessage(mcLocale.getString("Combat.Gore"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of a tameable animal's owner.
|
||||
*
|
||||
* @param beast The animal whose owner's name to get
|
||||
* @return the name of the animal's owner, or "Offline Master" if the owner is offline
|
||||
*/
|
||||
private static String getOwnerName(Tameable beast) {
|
||||
AnimalTamer tamer = beast.getOwner();
|
||||
|
||||
if (tamer instanceof Player) {
|
||||
Player owner = (Player) tamer;
|
||||
return owner.getName();
|
||||
}
|
||||
else {
|
||||
return "Offline Master";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent damage to wolves based on various skills.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static void preventDamage(EntityDamageEvent event) {
|
||||
final int ENVIRONMENTALLY_AWARE_LEVEL = 100;
|
||||
final int THICK_FUR_LEVEL = 250;
|
||||
final int SHOCK_PROOF_LEVEL = 500;
|
||||
|
||||
final int THICK_FUR_MODIFIER = 2;
|
||||
final int SHOCK_PROOF_MODIFIER = 6;
|
||||
|
||||
DamageCause cause = event.getCause();
|
||||
Wolf wolf = (Wolf) event.getEntity();
|
||||
Player master = (Player) wolf.getOwner();
|
||||
int skillLevel = Users.getProfile(master).getSkillLevel(SkillType.TAMING);
|
||||
|
||||
switch (cause) {
|
||||
|
||||
/* Environmentally Aware */
|
||||
case CONTACT:
|
||||
case LAVA:
|
||||
case FIRE:
|
||||
if (mcPermissions.getInstance().environmentallyAware(master)) {
|
||||
if (skillLevel >= ENVIRONMENTALLY_AWARE_LEVEL) {
|
||||
if (event.getDamage() >= wolf.getHealth()) {
|
||||
return;
|
||||
}
|
||||
|
||||
wolf.teleport(master.getLocation());
|
||||
master.sendMessage(mcLocale.getString("mcEntityListener.WolfComesBack"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case FALL:
|
||||
if (mcPermissions.getInstance().environmentallyAware(master)) {
|
||||
if (skillLevel >= ENVIRONMENTALLY_AWARE_LEVEL) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Thick Fur */
|
||||
case FIRE_TICK:
|
||||
if (mcPermissions.getInstance().thickFur(master)) {
|
||||
if(skillLevel >= THICK_FUR_LEVEL) {
|
||||
wolf.setFireTicks(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ENTITY_ATTACK:
|
||||
case PROJECTILE:
|
||||
if (mcPermissions.getInstance().thickFur(master)) {
|
||||
if (skillLevel >= THICK_FUR_LEVEL) {
|
||||
event.setDamage(event.getDamage() / THICK_FUR_MODIFIER);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Shock Proof */
|
||||
case ENTITY_EXPLOSION:
|
||||
case BLOCK_EXPLOSION:
|
||||
if (mcPermissions.getInstance().shockProof(master)) {
|
||||
if (skillLevel >= SHOCK_PROOF_LEVEL) {
|
||||
event.setDamage(event.getDamage() / SHOCK_PROOF_MODIFIER);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Summon an animal.
|
||||
*
|
||||
* @param type Type of animal to summon
|
||||
* @param player Player summoning the animal
|
||||
*/
|
||||
public static void animalSummon(EntityType type, Player player, mcMMO plugin) {
|
||||
ItemStack item = player.getItemInHand();
|
||||
Material summonItem = null;
|
||||
int summonAmount = 0;
|
||||
|
||||
switch (type) {
|
||||
case WOLF:
|
||||
summonItem = Material.BONE;
|
||||
summonAmount = LoadProperties.bonesConsumedByCOTW;
|
||||
break;
|
||||
|
||||
case OCELOT:
|
||||
summonItem = Material.RAW_FISH;
|
||||
summonAmount = LoadProperties.fishConsumedByCOTW;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (item.getType().equals(summonItem)) {
|
||||
if (item.getAmount() >= summonAmount) {
|
||||
for (Entity x : player.getNearbyEntities(40, 40, 40)) {
|
||||
if (x.getType().equals(type)) {
|
||||
switch (type) {
|
||||
case WOLF:
|
||||
player.sendMessage(mcLocale.getString("m.TamingSummonWolfFailed"));
|
||||
return;
|
||||
|
||||
case OCELOT:
|
||||
player.sendMessage(mcLocale.getString("m.TamingSummonOcelotFailed"));
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
LivingEntity entity = player.getWorld().spawnCreature(player.getLocation(), type);
|
||||
entity.setMetadata("mcmmoSummoned", new FixedMetadataValue(plugin, true));
|
||||
((Tameable) entity).setOwner(player);
|
||||
|
||||
player.setItemInHand(new ItemStack(summonItem, item.getAmount() - summonAmount));
|
||||
player.sendMessage(mcLocale.getString("m.TamingSummon"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(summonItem.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inspect a tameable animal for details.
|
||||
*
|
||||
* @param event Event to modify
|
||||
* @param target Animal to inspect
|
||||
* @param inspector Player inspecting the animal
|
||||
*/
|
||||
public static void beastLore(EntityDamageByEntityEvent event, LivingEntity target, Player inspector) {
|
||||
if (target instanceof Tameable) {
|
||||
Tameable beast = (Tameable) target;
|
||||
String message = mcLocale.getString("Combat.BeastLore") + " ";
|
||||
int health = target.getHealth();
|
||||
event.setCancelled(true);
|
||||
|
||||
if (beast.isTamed()) {
|
||||
message = message.concat(mcLocale.getString("Combat.BeastLoreOwner", new Object[] {getOwnerName(beast)}) + " ");
|
||||
}
|
||||
|
||||
message = message.concat(mcLocale.getString("Combat.BeastLoreHealth", new Object[] {health, target.getMaxHealth()}));
|
||||
inspector.sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,70 +1,77 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class Unarmed {
|
||||
|
||||
public static void unarmedBonus(Player attacker, EntityDamageByEntityEvent event)
|
||||
{
|
||||
int bonus = 3;
|
||||
|
||||
//Add 1 DMG for every 50 skill levels
|
||||
bonus += Users.getProfile(attacker).getSkillLevel(SkillType.UNARMED)/50;
|
||||
|
||||
if(bonus > 8)
|
||||
bonus = 8;
|
||||
|
||||
event.setDamage(event.getDamage() + bonus);
|
||||
}
|
||||
|
||||
public static void disarmProcCheck(Player attacker, Player defender)
|
||||
{
|
||||
int skillLevel = Users.getProfile(attacker).getSkillLevel(SkillType.UNARMED);
|
||||
if(defender.getItemInHand() != null && defender.getItemInHand().getType() != Material.AIR)
|
||||
{
|
||||
if(skillLevel >= 1000)
|
||||
{
|
||||
if(Math.random() * 3000 <= 1000)
|
||||
{
|
||||
ItemStack item = defender.getItemInHand();
|
||||
defender.sendMessage(mcLocale.getString("Skills.Disarmed"));
|
||||
m.mcDropItem(defender.getLocation(), item);
|
||||
defender.setItemInHand(null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Math.random() * 3000 <= skillLevel)
|
||||
{
|
||||
ItemStack item = defender.getItemInHand();
|
||||
defender.sendMessage(mcLocale.getString("Skills.Disarmed"));
|
||||
m.mcDropItem(defender.getLocation(), item);
|
||||
defender.setItemInHand(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply bonus to Unarmed damage.
|
||||
*
|
||||
* @param PPa Profile of the attacking player
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static void unarmedBonus(PlayerProfile PPa, EntityDamageByEntityEvent event) {
|
||||
final int MAX_BONUS = 8;
|
||||
int bonus = 3;
|
||||
|
||||
bonus += PPa.getSkillLevel(SkillType.UNARMED) / 50; //Add 1 DMG for every 50 skill levels
|
||||
|
||||
if (bonus > MAX_BONUS) {
|
||||
bonus = MAX_BONUS;
|
||||
}
|
||||
|
||||
event.setDamage(event.getDamage() + bonus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for disarm.
|
||||
*
|
||||
* @param PPa Profile of the attacking player
|
||||
* @param defender The defending player
|
||||
*/
|
||||
public static void disarmProcCheck(PlayerProfile PPa, Player defender) {
|
||||
final int MAX_BONUS_LEVEL = 1000;
|
||||
|
||||
int skillLevel = PPa.getSkillLevel(SkillType.UNARMED);
|
||||
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL);
|
||||
|
||||
if (defender.getItemInHand().getType().equals(Material.AIR)) {
|
||||
if (Math.random() * 3000 <= skillCheck) {
|
||||
ItemStack item = defender.getItemInHand();
|
||||
|
||||
defender.sendMessage(mcLocale.getString("Skills.Disarmed"));
|
||||
|
||||
m.mcDropItem(defender.getLocation(), item);
|
||||
defender.setItemInHand(new ItemStack(Material.AIR));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for arrow deflection.
|
||||
*
|
||||
* @param defender The defending player
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static void deflectCheck(Player defender, EntityDamageByEntityEvent event) {
|
||||
final int MAX_BONUS_LEVEL = 1000;
|
||||
|
||||
int skillLevel = Users.getProfile(defender).getSkillLevel(SkillType.UNARMED);
|
||||
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL);
|
||||
|
||||
if (Math.random() * 2000 <= skillCheck && mcPermissions.getInstance().deflect(defender)) {
|
||||
event.setCancelled(true);
|
||||
defender.sendMessage(mcLocale.getString("Combat.ArrowDeflect"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,13 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.TreeSpecies;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.material.Tree;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -31,262 +15,303 @@ import org.bukkit.Bukkit;
|
||||
import com.gmail.nossr50.Combat;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.config.*;
|
||||
import com.gmail.nossr50.spout.SpoutSounds;
|
||||
|
||||
import org.getspout.spoutapi.sound.SoundEffect;
|
||||
|
||||
public class WoodCutting {
|
||||
|
||||
public class WoodCutting
|
||||
{
|
||||
public static void treeFeller(BlockBreakEvent event, mcMMO plugin)
|
||||
{
|
||||
//Setup vars
|
||||
/**
|
||||
* Handle the Tree Feller ability.
|
||||
*
|
||||
* @param event Event to modify
|
||||
*/
|
||||
public static void treeFeller(BlockBreakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Block firstBlock = event.getBlock();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
World world = firstBlock.getWorld();
|
||||
|
||||
//Prepare array
|
||||
ArrayList<Block> toBeFelled = new ArrayList<Block>();
|
||||
|
||||
//NOTE: Tree Feller will cut upwards like how you actually fell trees
|
||||
processTreeFelling(firstBlock, world, toBeFelled, plugin);
|
||||
removeBlocks(toBeFelled, player, PP, plugin);
|
||||
|
||||
/* NOTE: Tree Feller will cut upwards like how you actually fell trees */
|
||||
processTreeFelling(firstBlock, toBeFelled);
|
||||
removeBlocks(toBeFelled, player, PP);
|
||||
}
|
||||
|
||||
private static void removeBlocks(ArrayList<Block> toBeFelled, Player player, PlayerProfile PP, mcMMO plugin)
|
||||
{
|
||||
if(toBeFelled.size() > LoadProperties.treeFellerThreshold)
|
||||
{
|
||||
|
||||
/**
|
||||
* Handles removing & dropping the blocks from Tree Feller.
|
||||
*
|
||||
* @param toBeFelled List of Blocks to be removed from the tree
|
||||
* @param player The player using the ability
|
||||
* @param PP The PlayerProfile of the player
|
||||
*/
|
||||
private static void removeBlocks(ArrayList<Block> toBeFelled, Player player, PlayerProfile PP) {
|
||||
if (toBeFelled.size() > LoadProperties.treeFellerThreshold) {
|
||||
player.sendMessage(mcLocale.getString("Skills.Woodcutting.TreeFellerThreshold"));
|
||||
return;
|
||||
}
|
||||
int durabilityLoss = toBeFelled.size(), xp = 0;
|
||||
|
||||
//Damage the tool
|
||||
player.getItemInHand().setDurability((short) (player.getItemInHand().getDurability()+durabilityLoss));
|
||||
|
||||
//This is to prevent using wood axes everytime you tree fell
|
||||
if((player.getItemInHand().getDurability() + durabilityLoss >= player.getItemInHand().getType().getMaxDurability())
|
||||
|| player.getItemInHand().getType() == Material.AIR || player.getItemInHand() == null)
|
||||
{
|
||||
|
||||
int durabilityLoss = toBeFelled.size();
|
||||
int xp = 0;
|
||||
ItemStack inHand = player.getItemInHand();
|
||||
|
||||
/* Damage the tool */
|
||||
inHand.setDurability((short) (inHand.getDurability() + durabilityLoss));
|
||||
|
||||
/* This is to prevent using wood axes everytime you tree fell */
|
||||
if ((inHand.getDurability() + durabilityLoss >= inHand.getType().getMaxDurability()) || inHand.getType().equals(Material.AIR)) {
|
||||
player.sendMessage(mcLocale.getString("TreeFeller.AxeSplinters"));
|
||||
|
||||
if(player.getHealth() >= 2)
|
||||
Combat.dealDamage(player, (int)(Math.random() * (player.getHealth()-1)));
|
||||
|
||||
int health = player.getHealth();
|
||||
|
||||
if (health >= 2) {
|
||||
Combat.dealDamage(player, (int)(Math.random() * (health - 1)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Prepare ItemStacks
|
||||
ItemStack item;
|
||||
ItemStack oak = new ItemStack(Material.LOG, 1, (byte)0, (byte)0);
|
||||
ItemStack spruce = new ItemStack(Material.LOG, 1, (byte)0, (byte)1);
|
||||
ItemStack birch = new ItemStack(Material.LOG, 1, (byte)0, (byte)2);
|
||||
ItemStack jungle = new ItemStack(Material.LOG, 1, (byte)0, (byte)3);
|
||||
ItemStack item = null;
|
||||
ItemStack oak = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.GENERIC.getData());
|
||||
ItemStack spruce = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.REDWOOD.getData());
|
||||
ItemStack birch = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.BIRCH.getData());
|
||||
ItemStack jungle = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.JUNGLE.getData());
|
||||
|
||||
for(Block x : toBeFelled)
|
||||
{
|
||||
if(m.blockBreakSimulate(x, player, true))
|
||||
{
|
||||
if(x.getType() == Material.LOG)
|
||||
{
|
||||
switch(x.getData())
|
||||
{
|
||||
case 0:
|
||||
for (Block x : toBeFelled) {
|
||||
if (m.blockBreakSimulate(x, player, true)) {
|
||||
if (x.getType() == Material.LOG) {
|
||||
Tree tree = (Tree) x.getState().getData();
|
||||
TreeSpecies species = tree.getSpecies();
|
||||
|
||||
switch (species) {
|
||||
case GENERIC:
|
||||
item = oak;
|
||||
break;
|
||||
case 1:
|
||||
|
||||
case REDWOOD:
|
||||
item = spruce;
|
||||
break;
|
||||
case 2:
|
||||
|
||||
case BIRCH:
|
||||
item = birch;
|
||||
break;
|
||||
case 3:
|
||||
|
||||
case JUNGLE:
|
||||
item = jungle;
|
||||
break;
|
||||
|
||||
default:
|
||||
item = oak;
|
||||
break;
|
||||
}
|
||||
|
||||
//ItemStack item = new ItemStack(x.getType(), 1, (byte)0, type);
|
||||
|
||||
if(!plugin.misc.blockWatchList.contains(x))
|
||||
{
|
||||
|
||||
if (!x.hasMetadata("mcmmoPlacedBlock")) {
|
||||
WoodCutting.woodCuttingProcCheck(player, x);
|
||||
|
||||
switch(x.getData())
|
||||
{
|
||||
case 0:
|
||||
|
||||
switch (species) {
|
||||
case GENERIC:
|
||||
xp += LoadProperties.moak;
|
||||
break;
|
||||
case 1:
|
||||
|
||||
case REDWOOD:
|
||||
xp += LoadProperties.mspruce;
|
||||
break;
|
||||
case 2:
|
||||
|
||||
case BIRCH:
|
||||
xp += LoadProperties.mbirch;
|
||||
break;
|
||||
case 3:
|
||||
xp += LoadProperties.mjungle/4;
|
||||
|
||||
case JUNGLE:
|
||||
xp += LoadProperties.mjungle / 4; //Nerf XP from Jungle Trees when using Tree Feller
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Remove the block
|
||||
x.setData((byte) 0);
|
||||
|
||||
/* Remove the block */
|
||||
x.setData((byte) 0x0);
|
||||
x.setType(Material.AIR);
|
||||
|
||||
//Drop the block
|
||||
m.mcDropItem(x.getLocation(), item);
|
||||
} else if(x.getType() == Material.LEAVES)
|
||||
{
|
||||
Material mat = Material.SAPLING;
|
||||
item = new ItemStack(mat, 1, (short)0, (byte)(x.getData()-8));
|
||||
|
||||
//90% chance to drop sapling
|
||||
if(Math.random() * 10 > 9)
|
||||
m.mcRandomDropItem(x.getLocation(), item, 90);
|
||||
|
||||
|
||||
/* Drop the block */
|
||||
m.mcDropItem(x.getLocation(), item);
|
||||
}
|
||||
else if (x.getType() == Material.LEAVES) {
|
||||
final int SAPLING_DROP_CHANCE = 10;
|
||||
|
||||
item = new ItemStack(Material.SAPLING, 1, (short) 0, (byte) (x.getData() & 3)); //Drop the right type of sapling
|
||||
m.mcRandomDropItem(x.getLocation(), item, SAPLING_DROP_CHANCE);
|
||||
|
||||
//Remove the block
|
||||
x.setData((byte) 0);
|
||||
x.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PP.addXP(SkillType.WOODCUTTING, xp, player); //Tree Feller gives nerf'd XP
|
||||
Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
|
||||
|
||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||
{
|
||||
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
||||
{
|
||||
short durability = player.getItemInHand().getDurability();
|
||||
durability += (LoadProperties.abilityDurabilityLoss * durabilityLoss);
|
||||
player.getItemInHand().setDurability(durability);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the block is affected by Tree Feller.
|
||||
*
|
||||
* @param block Block to check
|
||||
* @return true if the block is affected by Tree Feller, false otherwise
|
||||
*/
|
||||
private static boolean treeFellerCompatible(Block block) {
|
||||
switch (block.getType()) {
|
||||
case LOG:
|
||||
case LEAVES:
|
||||
case AIR:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean treeFellerCompatible(Block block)
|
||||
{
|
||||
return block.getType() == Material.LOG || block.getType() == Material.LEAVES || block.getType() == Material.AIR;
|
||||
}
|
||||
|
||||
private static void processTreeFelling(Block currentBlock, World world, ArrayList<Block> toBeFelled, mcMMO plugin)
|
||||
{
|
||||
int x = currentBlock.getX(), y = currentBlock.getY(), z = currentBlock.getZ();
|
||||
|
||||
if(currentBlock.getType() == Material.LOG || currentBlock.getType() == Material.LEAVES)
|
||||
|
||||
/**
|
||||
* Handle the calculations from Tree Feller.
|
||||
*
|
||||
* @param currentBlock The current block to be removed
|
||||
* @param toBeFelled The list of blocks left to be removed
|
||||
*/
|
||||
private static void processTreeFelling(Block currentBlock, ArrayList<Block> toBeFelled) {
|
||||
Material type = currentBlock.getType();
|
||||
|
||||
if (type.equals(Material.LOG) || type.equals(Material.LEAVES)) {
|
||||
toBeFelled.add(currentBlock);
|
||||
|
||||
//These 2 are to make sure that Tree Feller isn't so aggressive
|
||||
boolean isAirOrLeaves = currentBlock.getType() == Material.LEAVES || currentBlock.getType() == Material.AIR;
|
||||
|
||||
Block xPositive = world.getBlockAt(x+1, y, z);
|
||||
Block xNegative = world.getBlockAt(x-1, y, z);
|
||||
Block zPositive = world.getBlockAt(x, y, z+1);
|
||||
Block zNegative = world.getBlockAt(x, y, z-1);
|
||||
|
||||
if(!plugin.misc.blockWatchList.contains(currentBlock) &&
|
||||
!isTooAgressive(isAirOrLeaves, xPositive) && treeFellerCompatible(xPositive) && !toBeFelled.contains(xPositive))
|
||||
processTreeFelling(xPositive, world, toBeFelled, plugin);
|
||||
if(!plugin.misc.blockWatchList.contains(currentBlock) &&
|
||||
!isTooAgressive(isAirOrLeaves, xNegative) && treeFellerCompatible(xNegative) && !toBeFelled.contains(xNegative))
|
||||
processTreeFelling(xNegative, world, toBeFelled, plugin);
|
||||
if(!plugin.misc.blockWatchList.contains(currentBlock) &&
|
||||
!isTooAgressive(isAirOrLeaves, zPositive) && treeFellerCompatible(zPositive) && !toBeFelled.contains(zPositive))
|
||||
processTreeFelling(zPositive, world, toBeFelled, plugin);
|
||||
if(!plugin.misc.blockWatchList.contains(currentBlock) &&
|
||||
!isTooAgressive(isAirOrLeaves, zNegative) && treeFellerCompatible(zNegative) && !toBeFelled.contains(zNegative))
|
||||
processTreeFelling(zNegative, world, toBeFelled, plugin);
|
||||
|
||||
//Finally go Y+
|
||||
Block yPositive = world.getBlockAt(x, y+1, z);
|
||||
|
||||
if(treeFellerCompatible(yPositive))
|
||||
{
|
||||
if(!plugin.misc.blockWatchList.contains(currentBlock) && !toBeFelled.contains(yPositive))
|
||||
{
|
||||
processTreeFelling(yPositive, world, toBeFelled, plugin);
|
||||
}
|
||||
|
||||
Block xPositive = currentBlock.getRelative(1, 0, 0);
|
||||
Block xNegative = currentBlock.getRelative(-1, 0, 0);
|
||||
Block zPositive = currentBlock.getRelative(0, 0, 1);
|
||||
Block zNegative = currentBlock.getRelative(0, 0, -1);
|
||||
Block yPositive = currentBlock.getRelative(0, 1, 0);
|
||||
|
||||
if (!currentBlock.hasMetadata("mcmmoPlacedBlock")) {
|
||||
if (!isTooAggressive(currentBlock, xPositive) && treeFellerCompatible(xPositive) && !toBeFelled.contains(xPositive)) {
|
||||
processTreeFelling(xPositive, toBeFelled);
|
||||
}
|
||||
|
||||
if (!isTooAggressive(currentBlock, xNegative) && treeFellerCompatible(xNegative) && !toBeFelled.contains(xNegative)) {
|
||||
processTreeFelling(xNegative, toBeFelled);
|
||||
}
|
||||
|
||||
if (!isTooAggressive(currentBlock, zPositive) && treeFellerCompatible(zPositive) && !toBeFelled.contains(zPositive)) {
|
||||
processTreeFelling(zPositive, toBeFelled);
|
||||
}
|
||||
|
||||
if (!isTooAggressive(currentBlock, zNegative) && treeFellerCompatible(zNegative) && !toBeFelled.contains(zNegative)) {
|
||||
processTreeFelling(zNegative, toBeFelled);
|
||||
}
|
||||
|
||||
if (treeFellerCompatible(yPositive) && !toBeFelled.contains(yPositive)) {
|
||||
processTreeFelling(yPositive, toBeFelled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isTooAgressive(boolean bool, Block block)
|
||||
{
|
||||
return bool && (block.getType() == Material.AIR || block.getType() == Material.LEAVES);
|
||||
|
||||
/**
|
||||
* Check if Tree Feller is being too aggressive.
|
||||
*
|
||||
* @param currentBlock The current block being felled
|
||||
* @param newBlock The next block to be felled
|
||||
* @return true if Tree Feller is too aggressive, false otherwise
|
||||
*/
|
||||
private static boolean isTooAggressive(Block currentBlock, Block newBlock) {
|
||||
Material currentType = currentBlock.getType();
|
||||
Material newType = currentBlock.getType();
|
||||
|
||||
if ((currentType.equals(Material.LEAVES) || currentType.equals(Material.AIR)) && (newType.equals(Material.LEAVES) || newType.equals(Material.AIR))) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void woodCuttingProcCheck(Player player, Block block)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
byte type = block.getData();
|
||||
Material mat = Material.getMaterial(block.getTypeId());
|
||||
if(player != null)
|
||||
{
|
||||
if(PP.getSkillLevel(SkillType.WOODCUTTING) > 1000 || (Math.random() * 1000 <= PP.getSkillLevel(SkillType.WOODCUTTING)))
|
||||
{
|
||||
ItemStack item = new ItemStack(mat, 1, (short) 0, type);
|
||||
m.mcDropItem(block.getLocation(), item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for double drops.
|
||||
*
|
||||
* @param player Player breaking the block
|
||||
* @param block The block being broken
|
||||
*/
|
||||
private static void woodCuttingProcCheck(Player player, Block block) {
|
||||
final int MAX_SKILL_LEVEL = 1000;
|
||||
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.WOODCUTTING);
|
||||
byte type = block.getData();
|
||||
Material mat = Material.getMaterial(block.getTypeId());
|
||||
|
||||
if ((skillLevel > MAX_SKILL_LEVEL || Math.random() * 1000 <= skillLevel) && mcPermissions.getInstance().woodcuttingDoubleDrops(player)) {
|
||||
ItemStack item = new ItemStack(mat, 1, (short) 0, type);
|
||||
m.mcDropItem(block.getLocation(), item);
|
||||
}
|
||||
}
|
||||
|
||||
public static void woodcuttingBlockCheck(Player player, Block block, mcMMO plugin)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int xp = 0;
|
||||
byte data = block.getData();
|
||||
|
||||
if(plugin.misc.blockWatchList.contains(block))
|
||||
return;
|
||||
|
||||
switch(data)
|
||||
{
|
||||
case 0:
|
||||
xp += LoadProperties.moak;
|
||||
break;
|
||||
case 1:
|
||||
xp += LoadProperties.mspruce;
|
||||
break;
|
||||
case 2:
|
||||
xp += LoadProperties.mbirch;
|
||||
break;
|
||||
case 3:
|
||||
xp += LoadProperties.mjungle;
|
||||
break;
|
||||
}
|
||||
|
||||
if(block.getTypeId() == 17)
|
||||
{
|
||||
WoodCutting.woodCuttingProcCheck(player, block);
|
||||
PP.addXP(SkillType.WOODCUTTING, xp, player);
|
||||
Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check XP gain for woodcutting.
|
||||
*
|
||||
* @param player The player breaking the block
|
||||
* @param block The block being broken
|
||||
*/
|
||||
public static void woodcuttingBlockCheck(Player player, Block block) {
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int xp = 0;
|
||||
TreeSpecies species = TreeSpecies.getByData(block.getData());
|
||||
|
||||
if (block.hasMetadata("mcmmoPlacedBlock")) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (species) {
|
||||
case GENERIC:
|
||||
xp += LoadProperties.moak;
|
||||
break;
|
||||
|
||||
case REDWOOD:
|
||||
xp += LoadProperties.mspruce;
|
||||
break;
|
||||
|
||||
case BIRCH:
|
||||
xp += LoadProperties.mbirch;
|
||||
break;
|
||||
|
||||
case JUNGLE:
|
||||
xp += LoadProperties.mjungle;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
WoodCutting.woodCuttingProcCheck(player, block);
|
||||
PP.addXP(SkillType.WOODCUTTING, xp, player);
|
||||
Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
|
||||
}
|
||||
|
||||
public static void leafBlower(Player player, Block block){
|
||||
|
||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
|
||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||
{
|
||||
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
||||
{
|
||||
short durability = player.getItemInHand().getDurability();
|
||||
durability += LoadProperties.abilityDurabilityLoss;
|
||||
player.getItemInHand().setDurability(durability);
|
||||
}
|
||||
}
|
||||
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
|
||||
/**
|
||||
* Handle the Leaf Blower ability.
|
||||
*
|
||||
* @param player Player using the ability
|
||||
* @param block Block being broken
|
||||
*/
|
||||
public static void leafBlower(Player player, Block block) {
|
||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
|
||||
if (LoadProperties.woodcuttingrequiresaxe) {
|
||||
Skills.abilityDurabilityLoss(player.getItemInHand(), LoadProperties.abilityDurabilityLoss);
|
||||
}
|
||||
|
||||
if (LoadProperties.spoutEnabled) {
|
||||
SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
53
src/main/java/com/gmail/nossr50/spout/SpoutSounds.java
Normal file
53
src/main/java/com/gmail/nossr50/spout/SpoutSounds.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.gmail.nossr50.spout;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
import org.getspout.spoutapi.sound.SoundEffect;
|
||||
import org.getspout.spoutapi.sound.SoundManager;
|
||||
|
||||
public class SpoutSounds {
|
||||
|
||||
/**
|
||||
* Play sound effect through Spout.
|
||||
*
|
||||
* @param effect The sound effect to play
|
||||
* @param player The player to play the sound to
|
||||
* @param location The location the sound should come from
|
||||
*/
|
||||
public static void playSoundForPlayer(SoundEffect effect, Player player, Location location) {
|
||||
SoundManager SM = SpoutManager.getSoundManager();
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||
|
||||
SM.playSoundEffect(sPlayer, effect, location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Play noise on successful repair.
|
||||
*
|
||||
* @param player The player who repaired an item
|
||||
*/
|
||||
public static void playRepairNoise(Player player) {
|
||||
SoundManager SM = SpoutManager.getSoundManager();
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||
|
||||
//If this is pulling from online, why have it in the jar?
|
||||
SM.playCustomSoundEffect(Bukkit.getServer().getPluginManager().getPlugin("mcMMO"), sPlayer, "repair.wav", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Play noise on level-up.
|
||||
*
|
||||
* @param player The player who leveled up
|
||||
*/
|
||||
protected static void playLevelUpNoise(Player player) {
|
||||
SoundManager SM = SpoutManager.getSoundManager();
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player);
|
||||
|
||||
//If this is pulling from online, why have it in the jar?
|
||||
SM.playCustomSoundEffect(Bukkit.getServer().getPluginManager().getPlugin("mcMMO"), sPlayer, "level.wav", false);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,14 +9,14 @@
|
||||
###
|
||||
General:
|
||||
Locale: en_us
|
||||
MOTD:
|
||||
Enabled: true
|
||||
MOTD_Enabled: true
|
||||
#Amount of time (in minutes) to wait between saves of player information
|
||||
Save_Interval: 10
|
||||
#Allow mcMMO to report on basic anonymous usage
|
||||
Stats_Tracking: true
|
||||
#Allow mcMMO to inform other plugins of damage being dealt
|
||||
Event_Callback: true
|
||||
Per_Level_Tools: false
|
||||
|
||||
#
|
||||
# Settings for using a mySQL database
|
||||
@@ -24,9 +24,8 @@ General:
|
||||
MySQL:
|
||||
Enabled: false
|
||||
Database:
|
||||
User:
|
||||
Name: UserName
|
||||
Password: UserPassword
|
||||
User_Name: UserName
|
||||
User_Password: UserPassword
|
||||
Name: DataBaseName
|
||||
TablePrefix: mcmmo_
|
||||
Server:
|
||||
@@ -41,6 +40,30 @@ Items:
|
||||
Enabled: true
|
||||
Feather_Cost: 10
|
||||
Item_ID: 288
|
||||
Diamond:
|
||||
Axe: 750
|
||||
Hoe: 750
|
||||
Shovel: 750
|
||||
Sword: 750
|
||||
Pickaxe: 750
|
||||
Gold:
|
||||
Axe: 500
|
||||
Hoe: 500
|
||||
Shovel: 500
|
||||
Sword: 500
|
||||
Pickaxe: 500
|
||||
Iron:
|
||||
Axe: 250
|
||||
Hoe: 250
|
||||
Shovel: 250
|
||||
Sword: 250
|
||||
Pickaxe: 250
|
||||
Stone:
|
||||
Axe: 0
|
||||
Hoe: 0
|
||||
Shovel: 0
|
||||
Sword: 0
|
||||
Pickaxe: 0
|
||||
|
||||
#
|
||||
# Settings for Arcane Forging
|
||||
@@ -123,6 +146,7 @@ Skills:
|
||||
SmoothBrick_To_MossyBrick: true
|
||||
Dirt_To_Grass: true
|
||||
Hunger_Bonus: true
|
||||
Instant_Wheat_Regrowth: true
|
||||
Mining:
|
||||
Level_Cap: 0
|
||||
Requires_Pickaxe: true
|
||||
@@ -134,28 +158,21 @@ Skills:
|
||||
Can_Repair_Armor: true
|
||||
Can_Repair_Tools: true
|
||||
Leather:
|
||||
Name: Leather
|
||||
ID: 334
|
||||
String:
|
||||
Name: String
|
||||
ID: 287
|
||||
Stone:
|
||||
Name: Cobblestone
|
||||
Level_Required: 0
|
||||
ID: 4
|
||||
Wood:
|
||||
Name: Wood Planks
|
||||
ID: 5
|
||||
Gold:
|
||||
Name: Gold Bars
|
||||
Level_Required: 0
|
||||
ID: 266
|
||||
Iron:
|
||||
Name: Iron Bars
|
||||
Level_Required: 0
|
||||
ID: 265
|
||||
Diamond:
|
||||
Name: Diamond
|
||||
Level_Required: 50
|
||||
ID: 264
|
||||
Swords:
|
||||
@@ -164,6 +181,7 @@ Skills:
|
||||
Level_Cap: 0
|
||||
Call_Of_The_Wild:
|
||||
Bones_Required: 10
|
||||
Fish_Required: 10
|
||||
Unarmed:
|
||||
Level_Cap: 0
|
||||
Woodcutting:
|
||||
@@ -291,6 +309,7 @@ Commands:
|
||||
Enabled: true
|
||||
ptp:
|
||||
Enabled: true
|
||||
Cooldown: 30
|
||||
p:
|
||||
Enabled: true
|
||||
Display_Names: true
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
Combat.WolfExamine=[[YELLOW]]**du musterst den Wolf mit Bestienkunde**
|
||||
Combat.WolfShowMaster=[[DARK_YELLOW]]Der Bestienmeister \: {0}
|
||||
Combat.Ignition=[[RED]]**ENTZUENDEN**
|
||||
Combat.BurningArrowHit=[[DARK_RED]]Du wurdest von einem brennenden Pfeil gestriffen\!
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]Benommen. fuehlt sich schwindelig.
|
||||
Combat.TargetDazed=Target was [[DARK_RED]]benommen
|
||||
Combat.WolfNoMaster=[[AQUA]]Diese Bestie hat keinen Meister...
|
||||
Combat.WolfHealth=[[YELLOW]]Die Bestie hat {0} Lebensenergie
|
||||
Combat.StruckByGore=[[RED]]**Getroffen von Biss**
|
||||
Combat.Gore=[[YELLOW]]**BISS**
|
||||
Combat.ArrowDeflect=[[AQUA]]**PFEIL ABGELENKT**
|
||||
Item.ChimaeraWingFail=[[AQUA]]**CHIMAERA FLUEGEL fehlgeschlagen\!**
|
||||
Item.ChimaeraWingPass=[[AQUA]]**CHIMAERA FLUEGEL**
|
||||
Item.InjuredWait=[[AQUA]]du wurdest kurz zuvor verletzt und musst mit der Benutzung warten. [[YELLOW]]({0}s)
|
||||
Item.NeedFeathers=[[AQUA]]Du brauchst mehr Federn..
|
||||
m.mccPartyCommands=[[AQUA]]_______ [[YELLOW]]GRUPPEN BEFEHLE [[AQUA]]_______
|
||||
m.mccParty=[party name] [[YELLOW]]- Erstellen/beitreten einer Gruppe
|
||||
m.mccPartyQ=[[[YELLOW]]- Verlasse aktuelle Gruppe
|
||||
@@ -40,7 +35,6 @@ m.YourStats=[[DARK_AQUA]]_______ [[YELLOW]]DEINE WERTE [[DARK_AQUA]]_______
|
||||
m.SkillTaming=Bestienkunde (Taming)
|
||||
m.XPGainTaming=Animal Taming, or combat w/ your wolves
|
||||
m.EffectsTaming1_0=[[YELLOW]]Bestienkunde
|
||||
m.EffectsTaming1_1=[[AQUA]]mit Knochen schlagen inspiziert Woelfe
|
||||
m.EffectsTaming2_0=[[YELLOW]]Biss
|
||||
m.EffectsTaming2_1=[[AQUA]]Kritischer Schlag mit Blutungseffekt
|
||||
m.EffectsTaming3_0=[[YELLOW]]Geschaerfte Krallen
|
||||
@@ -215,10 +209,6 @@ mcPlayerListener.GreenThumb=[[YELLOW]]**GRUENER DAUMEN**
|
||||
mcPlayerListener.GreenThumbFail=[[DARK_RED]]**YELLOW THUMB FEHLGESCHLAGEN**
|
||||
mcPlayerListener.HerbalismSkill=[[YELLOW]]Kraeuterkunde Skill [[DARK_AQUA]](Herbalism):
|
||||
mcPlayerListener.MiningSkill=[[YELLOW]]Bergbau Skill [[DARK_AQUA]](Mining):
|
||||
mcPlayerListener.MyspawnCleared=[[DARK_AQUA]]Myspawn ist freigegeben
|
||||
mcPlayerListener.MyspawnNotExist=[[RED]]Lege deinen myspawn erst mit einem Bett fest
|
||||
mcPlayerListener.MyspawnSet=[[DARK_AQUA]]Myspawn wurde an deine aktuelle Position gesetzt
|
||||
mcPlayerListener.MyspawnTimeNotice=Du musst {0}m {1}s warten um myspawn zu nutzen
|
||||
mcPlayerListener.NoPermission=unzureichende mcPermissions.
|
||||
mcPlayerListener.NoSkillNote=[[DARK_AQUA]]Skills ohne Zugriff sind ausgeblendet
|
||||
mcPlayerListener.NotInParty=[[RED]]Du bist in keiner Gruppe.
|
||||
@@ -309,8 +299,7 @@ Skills.Disarmed=[[DARK_RED]]Du wurdest entwaffnet!
|
||||
m.LVL=[[AQUA]]LVL: [[GREEN]]{0} [[DARK_AQUA]]XP[[YELLOW]] ([[AQUA]]{1}[[YELLOW]]/[[AQUA]]{2}[[YELLOW]])
|
||||
Combat.BeastLore=[[YELLOW]]**BESTIENKUNDE**
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Besitzer ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BeastLoreHealthWolfTamed=[[DARK_AQUA]]Gesundheit ([[YELLOW]]{0}[[DARK_AQUA]]/20)
|
||||
Combat.BeastLoreHealthWolf=[[DARK_AQUA]]Gesundheit ([[YELLOW]]{0}[[DARK_AQUA]]/8)
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Gesundheit ([[YELLOW]]{0}[[DARK_AQUA]]/{1})
|
||||
mcMMO.Description=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]]TheYeti [[BLUE]](Project Lead & Developer),[[GOLD]] - [[GREEN]]NuclearW [[BLUE]](Developer),[[GOLD]] - [[GREEN]]GJ [[BLUE]](Developer),[[GOLD]] - [[GREEN]]nossr50 [[BLUE]](Developer & Creator),[[DARK_AQUA]]Useful Links:,[[GOLD]] - [[GREEN]]issues.mcmmo.org[[GOLD]] Bug Reporting,[[GOLD]] - [[GREEN]]#mcmmo @ irc.esper.net[[GOLD]] IRC Chat,[[GOLD]] - [[GREEN]]www.mcmmo.org[[GOLD]] Official Website,[[GOLD]] - [[GREEN]]http://bit.ly/x3Yvry[[GOLD]] Bukkit Forum Thread,[[GOLD]] - [[GREEN]]https://twitter.com/#!/mcmmo_dev[[GOLD]] mcMMO Twitter,[[DARK_AQUA]]Donation Info:
|
||||
Party.IsLocked=[[RED]]Gruppe ist gesperrt.
|
||||
Party.Locked=[[RED]]Gruppe ist gesperrt, nur der Besitzer kann neue User einladen.
|
||||
@@ -373,10 +362,8 @@ m.FishingMagicInfo=[[YELLOW]]Schatz-Jaeger: [[GREEN]] *Verbesert sich mit Schatz
|
||||
m.ShakeInfo=[[YELLOW]]Reissen: [[AQUA]]Reisse Items aus Mobs und verstuemmelt sie dabei ;_;
|
||||
m.AbilLockFishing1=[[DARK_AQUA]]Gesperrt bis Skilllevel 150+ (Reissen)
|
||||
m.TamingSummon=[[YELLOW]]Beschwoerung abgeschlossen
|
||||
m.TamingSummonFailed=[[YELLOW]]Du hast zu viele Woelfe um dich um weitere zu beschwoeren.
|
||||
m.TamingSummonWolfFailed=[[YELLOW]]Du hast zu viele Woelfe um dich um weitere zu beschwoeren.
|
||||
m.EffectsTaming7_0=[[YELLOW]]Ruf der Wildniss
|
||||
m.EffectsTaming7_1=[[AQUA]]Beschwoere einen Wolf auf deine Seite
|
||||
m.EffectsTaming7_2=[[YELLOW]]Info: [[AQUA]]Ducken und Rechtsklick mit {0} Knochen in der Hand
|
||||
m.EffectsTaming8_0=Fast Food Service
|
||||
m.EffectsTaming8_1=Chance for wolves to heal on attack
|
||||
m.AbilLockTaming5=LOCKED UNTIL 50+ SKILL (FAST FOOD SERVICE)
|
||||
@@ -440,4 +427,13 @@ Guides.Repair=Guide coming soon...
|
||||
Guides.Swords=Guide coming soon...
|
||||
Guides.Taming=Guide coming soon...
|
||||
Guides.Unarmed=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
GodMode.Forbidden=[mcMMO] God Mode not permitted on this world (See Permissions)
|
||||
XPRate.Event = [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x!
|
||||
BlastMining.Boom = [[GRAY]]**BOOM**
|
||||
Party.Forbidden=[mcMMO] Parties not permitted on this world (See Permissions)
|
||||
m.EffectsTaming7_1=Summon an animal to your side
|
||||
m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with {0} Bones/Fish in hand
|
||||
m.EffectsTaming1_1=Bone-whacking inspects wolves/ocelots
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Health ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
m.TamingSummonOcelotFailed=[[RED]]You have too many ocelots nearby to summon any more.
|
||||
@@ -1,18 +1,13 @@
|
||||
Combat.WolfExamine=[[GREEN]]**You examine the Wolf using Beast Lore**
|
||||
Combat.WolfShowMaster=[[DARK_GREEN]]The Beast's Master \: {0}
|
||||
Combat.Ignition=[[RED]]**IGNITION**
|
||||
Combat.BurningArrowHit=[[DARK_RED]]You were struck by a burning arrow\!
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]Touched Fuzzy. Felt Dizzy.
|
||||
Combat.TargetDazed=Target was [[DARK_RED]]Dazed
|
||||
Combat.WolfNoMaster=[[GRAY]]This Beast has no Master...
|
||||
Combat.WolfHealth=[[GREEN]]This beast has {0} Health
|
||||
Combat.StruckByGore=[[RED]]**STRUCK BY GORE**
|
||||
Combat.Gore=[[GREEN]]**GORE**
|
||||
Combat.ArrowDeflect=[[WHITE]]**ARROW DEFLECT**
|
||||
Item.ChimaeraWingFail=**CHIMAERA WING FAILED\!**
|
||||
Item.ChimaeraWingPass=**CHIMAERA WING**
|
||||
Item.InjuredWait=You were injured recently and must wait to use this. [[YELLOW]]({0}s)
|
||||
Item.NeedFeathers=[[GRAY]]You need more feathers..
|
||||
m.mccPartyCommands=[[GREEN]]--PARTY COMMANDS--
|
||||
m.mccParty=[party name] [[RED]]- Create/Join designated party
|
||||
m.mccPartyQ=[[RED]]- Leave your current party
|
||||
@@ -40,7 +35,6 @@ m.YourStats=YOUR STATS
|
||||
m.SkillTaming=TAMING
|
||||
m.XPGainTaming=Animal Taming, or combat w/ your wolves
|
||||
m.EffectsTaming1_0=Beast Lore
|
||||
m.EffectsTaming1_1=Bone-whacking inspects wolves
|
||||
m.EffectsTaming2_0=Gore
|
||||
m.EffectsTaming2_1=Critical Strike that applies Bleed
|
||||
m.EffectsTaming3_0=Sharpened Claws
|
||||
@@ -217,10 +211,6 @@ mcPlayerListener.GreenThumb=[[GREEN]]**GREEN THUMB**
|
||||
mcPlayerListener.GreenThumbFail=[[RED]]**GREEN THUMB FAIL**
|
||||
mcPlayerListener.HerbalismSkill=Herbalism:
|
||||
mcPlayerListener.MiningSkill=Mining:
|
||||
mcPlayerListener.MyspawnCleared=[[DARK_AQUA]]Myspawn is now cleared.
|
||||
mcPlayerListener.MyspawnNotExist=[[RED]]Configure your myspawn first with a bed.
|
||||
mcPlayerListener.MyspawnSet=[[DARK_AQUA]]Myspawn has been set to your current location.
|
||||
mcPlayerListener.MyspawnTimeNotice=You must wait {0}m {1}s to use myspawn
|
||||
mcPlayerListener.NoPermission=Insufficient mcPermissions.
|
||||
mcPlayerListener.NoSkillNote=[[DARK_GRAY]]If you don't have access to a skill it will not be shown here.
|
||||
mcPlayerListener.NotInParty=[[RED]]You are not in a party.
|
||||
@@ -311,8 +301,7 @@ Skills.Disarmed=[[DARK_RED]]You have been disarmed!
|
||||
m.LVL=[[DARK_GRAY]]LVL: [[GREEN]]{0} [[DARK_AQUA]]XP[[YELLOW]]([[GOLD]]{1}[[YELLOW]]/[[GOLD]]{2}[[YELLOW]])
|
||||
Combat.BeastLore=[[GREEN]]**BEAST LORE**
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Owner ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BeastLoreHealthWolfTamed=[[DARK_AQUA]]Health ([[GREEN]]{0}[[DARK_AQUA]]/20)
|
||||
Combat.BeastLoreHealthWolf=[[DARK_AQUA]]Health ([[GREEN]]{0}[[DARK_AQUA]]/8)
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Health ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
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]]TheYeti [[BLUE]](Project Lead & Developer),[[GOLD]] - [[GREEN]]NuclearW [[BLUE]](Developer),[[GOLD]] - [[GREEN]]GJ [[BLUE]](Developer),[[GOLD]] - [[GREEN]]nossr50 [[BLUE]](Developer & Creator),[[DARK_AQUA]]Useful Links:,[[GOLD]] - [[GREEN]]issues.mcmmo.org[[GOLD]] Bug Reporting,[[GOLD]] - [[GREEN]]#mcmmo @ irc.esper.net[[GOLD]] IRC Chat,[[GOLD]] - [[GREEN]]www.mcmmo.org[[GOLD]] Official Website,[[GOLD]] - [[GREEN]]http://bit.ly/x3Yvry[[GOLD]] Bukkit Forum Thread,[[GOLD]] - [[GREEN]]https://twitter.com/#!/mcmmo_dev[[GOLD]] mcMMO Twitter,[[DARK_AQUA]]Donation Info:
|
||||
Party.Locked=[[RED]]Party is locked, only party leader may invite.
|
||||
Party.IsntLocked=[[GRAY]]Party is not locked
|
||||
@@ -368,10 +357,9 @@ m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter
|
||||
m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_;
|
||||
m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE)
|
||||
m.TamingSummon=[[GREEN]]Summoning complete
|
||||
m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.TamingSummonWolfFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.TamingSummonOcelotFailed=[[RED]]You have too many ocelots nearby to summon any more.
|
||||
m.EffectsTaming7_0=Call of the Wild
|
||||
m.EffectsTaming7_1=Summon a wolf to your side
|
||||
m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with {0} Bones in hand
|
||||
m.EffectsTaming8_0=Fast Food Service
|
||||
m.EffectsTaming8_1=Chance for wolves to heal on attack
|
||||
m.AbilLockTaming5=LOCKED UNTIL 50+ SKILL (FAST FOOD SERVICE)
|
||||
@@ -435,4 +423,11 @@ Guides.Repair=Guide coming soon...
|
||||
Guides.Swords=Guide coming soon...
|
||||
Guides.Taming=Guide coming soon...
|
||||
Guides.Unarmed=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
GodMode.Forbidden=[mcMMO] God Mode not permitted on this world (See Permissions)
|
||||
XPRate.Event = [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x!
|
||||
BlastMining.Boom = [[GRAY]]**BOOM**
|
||||
Party.Forbidden=[mcMMO] Parties not permitted on this world (See Permissions)
|
||||
m.EffectsTaming7_1=Summon an animal to your side
|
||||
m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with {0} Bones/Fish in hand
|
||||
m.EffectsTaming1_1=Bone-whacking inspects wolves/ocelots
|
||||
@@ -1,18 +1,13 @@
|
||||
Combat.WolfExamine=[[GREEN]]**Has examinado a un lobo usando tu conocimiento de fieras**
|
||||
Combat.WolfShowMaster=[[DARK_GREEN]]El maestro de las fieras \: {0}
|
||||
Combat.Ignition=[[RED]]**IGNICION**
|
||||
Combat.BurningArrowHit=[[DARK_RED]]Has sido golpeado por una flecha ardiendo\!
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]Estas confuso. Te sientes mareado...
|
||||
Combat.TargetDazed=El objetivo fue [[DARK_RED]]aturdido
|
||||
Combat.WolfNoMaster=[[GRAY]]Esta bestia no tiene maestro...
|
||||
Combat.WolfHealth=[[GREEN]]Esta bestia tiene {0} de salud
|
||||
Combat.StruckByGore=[[RED]]**GOLPEADO POR MORDISCO**
|
||||
Combat.Gore=[[GREEN]]**MORDISCO**
|
||||
Combat.ArrowDeflect=[[WHITE]]**FLECHA DESVIADA**
|
||||
Item.ChimaeraWingFail=**FLECHA QUIMERA FALLADA\!**
|
||||
Item.ChimaeraWingPass=**FLECHA QUIMERA**
|
||||
Item.InjuredWait=Has sido herido recientemente y tienes que esperar para usar esto. [[YELLOW]]({0}s)
|
||||
Item.NeedFeathers=[[GRAY]]Necesitas mas plumas.
|
||||
m.mccPartyCommands=[[GREEN]]--COMANDOS DE FIESTA--
|
||||
m.mccParty=[party name] [[RED]]- Crea/Entra a una fiesta especifica
|
||||
m.mccPartyQ=[[RED]]- Abandona tu fiesta actual
|
||||
@@ -215,10 +210,6 @@ mcPlayerListener.GreenThumb=[[GREEN]]**DEDOS VERDES**
|
||||
mcPlayerListener.GreenThumbFail=[[RED]]**DEDOS VERDES FALLIDO**
|
||||
mcPlayerListener.HerbalismSkill=Herboristeria:
|
||||
mcPlayerListener.MiningSkill=Minar:
|
||||
mcPlayerListener.MyspawnCleared=[[DARK_AQUA]]Myspawn esta ahora limpio.
|
||||
mcPlayerListener.MyspawnNotExist=[[RED]]Configura tu myspawn primero con una cama.
|
||||
mcPlayerListener.MyspawnSet=[[DARK_AQUA]]Myspawn ha sido establecido hacia tu localizacion actual.
|
||||
mcPlayerListener.MyspawnTimeNotice=Tienes que esperar {0}min {1}seg para usar myspawn
|
||||
mcPlayerListener.NoPermission=mcPermisos insuficientes
|
||||
mcPlayerListener.NoSkillNote=[[DARK_GRAY]]Si no tienes acceso a una habilidad no seras mostrado aqui.
|
||||
mcPlayerListener.NotInParty=[[RED]]No estas en una fiesta.
|
||||
@@ -309,8 +300,7 @@ Skills.Disarmed=[[DARK_RED]]Has sido desarmado!
|
||||
m.LVL=[[DARK_GRAY]]LVL: [[GREEN]]{0} [[DARK_AQUA]]EXP[[YELLOW]]([[GOLD]]{1}[[YELLOW]]/[[GOLD]]{2}[[YELLOW]])
|
||||
Combat.BeastLore=[[GREEN]]**LEYENDA DE BESTIAS**
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Dueño ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BeastLoreHealthWolfTamed=[[DARK_AQUA]]Salud ([[GREEN]]{0}[[DARK_AQUA]]/20)
|
||||
Combat.BeastLoreHealthWolf=[[DARK_AQUA]]Salud ([[GREEN]]{0}[[DARK_AQUA]]/8)
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Salud ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
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]]TheYeti [[BLUE]](Project Lead & Developer),[[GOLD]] - [[GREEN]]NuclearW [[BLUE]](Developer),[[GOLD]] - [[GREEN]]GJ [[BLUE]](Developer),[[GOLD]] - [[GREEN]]nossr50 [[BLUE]](Developer & Creator),[[DARK_AQUA]]Useful Links:,[[GOLD]] - [[GREEN]]issues.mcmmo.org[[GOLD]] Bug Reporting,[[GOLD]] - [[GREEN]]#mcmmo @ irc.esper.net[[GOLD]] IRC Chat,[[GOLD]] - [[GREEN]]www.mcmmo.org[[GOLD]] Official Website,[[GOLD]] - [[GREEN]]http://bit.ly/x3Yvry[[GOLD]] Bukkit Forum Thread,[[GOLD]] - [[GREEN]]https://twitter.com/#!/mcmmo_dev[[GOLD]] mcMMO Twitter,[[DARK_AQUA]]Donation Info:
|
||||
Party.Locked=[[RED]]La fiesta esta bloqueda, solo el lider puede invitarte
|
||||
Party.IsntLocked=[[GRAY]]La fiesta no esta bloqueada
|
||||
@@ -366,7 +356,7 @@ m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter
|
||||
m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_;
|
||||
m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE)
|
||||
m.TamingSummon=[[GREEN]]Summoning complete
|
||||
m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.TamingSummonWolfFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.EffectsTaming7_0=Call of the Wild
|
||||
m.EffectsTaming7_1=Summon a wolf to your side
|
||||
m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with {0} Bones in hand
|
||||
@@ -433,4 +423,9 @@ Guides.Repair=Guide coming soon...
|
||||
Guides.Swords=Guide coming soon...
|
||||
Guides.Taming=Guide coming soon...
|
||||
Guides.Unarmed=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
GodMode.Forbidden=[mcMMO] God Mode not permitted on this world (See Permissions)
|
||||
XPRate.Event = [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x!
|
||||
BlastMining.Boom = [[GRAY]]**BOOM**
|
||||
Party.Forbidden=[mcMMO] Parties not permitted on this world (See Permissions)
|
||||
m.TamingSummonOcelotFailed=[[RED]]You have too many ocelots nearby to summon any more.
|
||||
@@ -1,18 +1,13 @@
|
||||
Combat.WolfExamine=[[GREEN]]**Tutkit sutta käyttämällä Pedon Tarinaa**
|
||||
Combat.WolfShowMaster=[[DARK_GREEN]]Pedon isäntä : {0}
|
||||
Combat.Ignition=[[RED]]**SYTYTYS**
|
||||
Combat.BurningArrowHit=[[DARK_RED]]Palava nuoli osui sinuun\!
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]Touched Fuzzy. Felt Dizzy.
|
||||
Combat.TargetDazed=Kohde [[DARK_RED]]tyrmätty
|
||||
Combat.WolfNoMaster=[[GRAY]]Tällä pedolla ei ole isäntää...
|
||||
Combat.WolfHealth=[[GREEN]]Tämän pedon terveys on {0}
|
||||
Combat.StruckByGore=[[RED]]**SINUA ON PISTETTY**
|
||||
Combat.Gore=[[GREEN]]**PISTO**
|
||||
Combat.ArrowDeflect=[[WHITE]]**NUOLI TORJUTTU**
|
||||
Item.ChimaeraWingFail=**KHIMAIRAN SIIVEN KÄYTTÖ EPÄONNISTUI\!**
|
||||
Item.ChimaeraWingPass=**KHIMAIRAN SIIPI**
|
||||
Item.InjuredWait=Sinua on haavoitettu äskettäin joten joudut odottaa tämän käyttöä. [[YELLOW]]({0}s)
|
||||
Item.NeedFeathers=[[GRAY]]Tarvitset lisää sulkia..
|
||||
m.mccPartyCommands=[[GREEN]]--RYHMÄKOMENNOT--
|
||||
m.mccParty=[party name] [[RED]]- Luo/liity nimettyyn ryhmään
|
||||
m.mccPartyQ=[[RED]]- Lähde ryhmästä
|
||||
@@ -215,10 +210,6 @@ mcPlayerListener.GreenThumb=[[GREEN]]**VIHERPEUKALO**
|
||||
mcPlayerListener.GreenThumbFail=[[RED]]**VIHERPEUKALO EPÄONNISTUI**
|
||||
mcPlayerListener.HerbalismSkill=[[YELLOW]]Yrttihoito:
|
||||
mcPlayerListener.MiningSkill=[[YELLOW]]Kaivanto:
|
||||
mcPlayerListener.MyspawnCleared=[[DARK_AQUA]]Myspawn on tyhjätty.
|
||||
mcPlayerListener.MyspawnNotExist=[[RED]]Määrää myspawnisi ensin laittamalla sänky maahan.
|
||||
mcPlayerListener.MyspawnSet=[[DARK_AQUA]]Myspawn on asetettu tämänhetkiseen sijaintiisi.
|
||||
mcPlayerListener.MyspawnTimeNotice=Sinun pitää odottaa {0}m {1}s käyttääksesi myspawnia
|
||||
mcPlayerListener.NoPermission=Puutteelliset oikeudet (mcPermissions)
|
||||
mcPlayerListener.NoSkillNote=[[DARK_GRAY]]Jos sinulla ei ole käyttöoikeutta johonkin taitoon, sitä ei näytetä täällä.
|
||||
mcPlayerListener.NotInParty=[[RED]]Et ole ryhmässä.
|
||||
@@ -355,7 +346,7 @@ m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter
|
||||
m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_;
|
||||
m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE)
|
||||
m.TamingSummon=[[GREEN]]Summoning complete
|
||||
m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.TamingSummonWolfFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.EffectsTaming7_0=Call of the Wild
|
||||
m.EffectsTaming7_1=Summon a wolf to your side
|
||||
m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with {0} Bones in hand
|
||||
@@ -422,4 +413,12 @@ Guides.Repair=Guide coming soon...
|
||||
Guides.Swords=Guide coming soon...
|
||||
Guides.Taming=Guide coming soon...
|
||||
Guides.Unarmed=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
GodMode.Forbidden=[mcMMO] God Mode not permitted on this world (See Permissions)
|
||||
XPRate.Event = [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x!
|
||||
BlastMining.Boom = [[GRAY]]**BOOM**
|
||||
Party.Forbidden=[mcMMO] Parties not permitted on this world (See Permissions)
|
||||
Combat.BeastLore=[[GREEN]]**BEAST LORE**
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Owner ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Health ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
m.TamingSummonOcelotFailed=[[RED]]You have too many ocelots nearby to summon any more.
|
||||
@@ -1,18 +1,13 @@
|
||||
Combat.WolfExamine=[[GREEN]]**Vous examinez le loup avec le Beast Lore**
|
||||
Combat.WolfShowMaster=[[DARK_GREEN]]Le Maître des bêtes \: {0}
|
||||
Combat.Ignition=[[RED]]**ALLUMAGE**
|
||||
Combat.BurningArrowHit=[[DARK_RED]]Vous avez été frappé par une flèche brûlante\!
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]Vous voyez flou. Vous vous sentez étourdi.
|
||||
Combat.TargetDazed=La cible a été [[DARK_RED]]Étourdi
|
||||
Combat.WolfNoMaster=[[GRAY]]Cette bête n'a pas de maître...
|
||||
Combat.WolfHealth=[[GREEN]]Cette bête a {0} points de vie
|
||||
Combat.StruckByGore=[[RED]]**FRAPPÉ JUSQU'AU SANG**
|
||||
Combat.Gore=[[GREEN]]**SANG**
|
||||
Combat.ArrowDeflect=[[WHITE]]**FLÈCHE DEVIÉE**
|
||||
Item.ChimaeraWingFail=**CHIMAERA WING a échoué \!**
|
||||
Item.ChimaeraWingPass=**CHIMAERA WING**
|
||||
Item.InjuredWait=Vous avez été blessé récemment et vous devez attendre pour utiliser ça. [[YELLOW]]({0}s)
|
||||
Item.NeedFeathers=[[GRAY]]Vous avez besoin de plus de plumes..
|
||||
m.mccPartyCommands=[[GREEN]]--COMMANDES GROUPE--
|
||||
m.mccParty=[party name] [[RED]]- Créer / Rejoindre un groupe
|
||||
m.mccPartyQ=[[RED]]- Vous quitter la partie en cours
|
||||
@@ -215,10 +210,6 @@ mcPlayerListener.GreenThumb=[[GREEN]]**MAIN VERTE**
|
||||
mcPlayerListener.GreenThumbFail=[[RED]]**MAIN VERTE A ECHOUÉ**
|
||||
mcPlayerListener.HerbalismSkill=[[YELLOW]]Herboriste (/Herbalism) :
|
||||
mcPlayerListener.MiningSkill=[[YELLOW]]Minage (/Mining):
|
||||
mcPlayerListener.MyspawnCleared=[[DARK_AQUA]]Votre point de spawn a été éffacé.
|
||||
mcPlayerListener.MyspawnNotExist=[[RED]]Dormez dans un lit pour définir votre point de spawn.
|
||||
mcPlayerListener.MyspawnSet=[[DARK_AQUA]]Votre point de spawn a été enregistré ici.
|
||||
mcPlayerListener.MyspawnTimeNotice=Vous devez attendre {0}m {1}s avant d'utiliser votre spawn
|
||||
mcPlayerListener.NoPermission=Vous n'avez pas les permissions nécessaires.
|
||||
mcPlayerListener.NoSkillNote=[[DARK_GRAY]]Si vous n'avez pas accès à une compé, elle ne sera pas affichée ici.
|
||||
mcPlayerListener.NotInParty=[[RED]]Vous n'êtes pas dans un groupe.
|
||||
@@ -309,8 +300,7 @@ Skills.Disarmed=[[DARK_RED]]Vous avez
|
||||
m.LVL=NIVEAU [[GREEN]]{0} - [[DARK_AQUA]]XP : [[YELLOW]][[[GOLD]]{1}[[YELLOW]]/[[GOLD]]{2}[[YELLOW]]]
|
||||
Combat.BeastLore=[[GREEN]]**Connaissances des bêtes**
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Propriétaire ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BeastLoreHealthWolfTamed=[[DARK_AQUA]]Vie ([[GREEN]]{0}[[DARK_AQUA]]/20)
|
||||
Combat.BeastLoreHealthWolf=[[DARK_AQUA]]Vie ([[GREEN]]{0}[[DARK_AQUA]]/8)
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Vie ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
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]]TheYeti [[BLUE]](Project Lead & Developer),[[GOLD]] - [[GREEN]]NuclearW [[BLUE]](Developer),[[GOLD]] - [[GREEN]]GJ [[BLUE]](Developer),[[GOLD]] - [[GREEN]]nossr50 [[BLUE]](Developer & Creator),[[DARK_AQUA]]Useful Links:,[[GOLD]] - [[GREEN]]issues.mcmmo.org[[GOLD]] Bug Reporting,[[GOLD]] - [[GREEN]]#mcmmo @ irc.esper.net[[GOLD]] IRC Chat,[[GOLD]] - [[GREEN]]www.mcmmo.org[[GOLD]] Official Website,[[GOLD]] - [[GREEN]]http://bit.ly/x3Yvry[[GOLD]] Bukkit Forum Thread,[[GOLD]] - [[GREEN]]https://twitter.com/#!/mcmmo_dev[[GOLD]] mcMMO Twitter,[[DARK_AQUA]]Donation Info:
|
||||
Party.Locked=[[RED]]Party is locked, only party leader may invite.
|
||||
Party.IsntLocked=[[GRAY]]Party is not locked
|
||||
@@ -366,7 +356,7 @@ m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter
|
||||
m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_;
|
||||
m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE)
|
||||
m.TamingSummon=[[GREEN]]Summoning complete
|
||||
m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.TamingSummonWolfFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.EffectsTaming7_0=Call of the Wild
|
||||
m.EffectsTaming7_1=Summon a wolf to your side
|
||||
m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with {0} Bones in hand
|
||||
@@ -433,4 +423,9 @@ Guides.Repair=Guide coming soon...
|
||||
Guides.Swords=Guide coming soon...
|
||||
Guides.Taming=Guide coming soon...
|
||||
Guides.Unarmed=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
GodMode.Forbidden=[mcMMO] God Mode not permitted on this world (See Permissions)
|
||||
XPRate.Event = [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x!
|
||||
BlastMining.Boom = [[GRAY]]**BOOM**
|
||||
Party.Forbidden=[mcMMO] Parties not permitted on this world (See Permissions)
|
||||
m.TamingSummonOcelotFailed=[[RED]]You have too many ocelots nearby to summon any more.
|
||||
433
src/main/resources/locale/locale_it.properties
Normal file
433
src/main/resources/locale/locale_it.properties
Normal file
@@ -0,0 +1,433 @@
|
||||
Combat.Ignition=[[RED]]**ACCENSIONE**
|
||||
Combat.BurningArrowHit=[[DARK_RED]]Sei stato colpito da una freccia di fuoco\!
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]Toccato sfocato. Feltro vertiginoso.
|
||||
Combat.TargetDazed=L'obbiettivo e [[DARK_RED]]Stordito
|
||||
Combat.StruckByGore=[[RED]]**Colpito dalle corne**
|
||||
Combat.Gore=[[GREEN]]**CORNE**
|
||||
Combat.ArrowDeflect=[[WHITE]]**DEVIARE FRECCIA**
|
||||
Item.ChimaeraWingFail=**Vento CHIMAERA failato\!**
|
||||
Item.ChimaeraWingPass=**Vento CHIMAERA**
|
||||
Item.InjuredWait=Sei stato ferito da poco e devi aspettare per poter usarlo. [[YELLOW]]({0}s)
|
||||
m.mccPartyCommands=[[GREEN]]--Comandi del Party--
|
||||
m.mccParty=[party name] [[RED]]- Crea/Entra in un party.
|
||||
m.mccPartyQ=[[RED]]- Lascia il party.
|
||||
m.mccPartyToggle=[[RED]] - Switcha alla party/global chat.
|
||||
m.mccPartyInvite=[player name] [[RED]]- Invia un'invito per il party
|
||||
m.mccPartyAccept=[[RED]]- Accetta il party
|
||||
m.mccPartyTeleport=[party member name] [[RED]]- Per teletrasportarsi ad un membro del party
|
||||
m.mccOtherCommands=[[GREEN]]--ALTRI COMANDI--
|
||||
m.mccStats=- Controlla le tue stat McMmo
|
||||
m.mccLeaderboards=- Classifica
|
||||
m.mccToggleAbility=- Attiva l'abilita con il tasto destro del mouse
|
||||
m.mccAdminToggle=- Passi alla chat admin
|
||||
m.mccInspect=[playername] [[RED]]- Controlla i dettagli del giocatore
|
||||
m.mccMmoedit=[playername] [skill] [newvalue] [[RED]]- Modifica il personaggio
|
||||
m.mccMcGod=- Vita infinita(God Mode)
|
||||
m.mccSkillInfo=[skillname] [[RED]]- Visualizza delle informazioni su una skill
|
||||
m.mccModDescription=[[RED]]- Leggi la breve descrizione Mod
|
||||
m.SkillHeader=[[RED]]-----[][[GREEN]]{0}[[RED]][]-----
|
||||
m.XPGain=[[DARK_GRAY]]XP ACQUISITA: [[WHITE]]{0}
|
||||
m.EffectsTemplate=[[DARK_AQUA]]{0}: [[GREEN]]{1}
|
||||
m.AbilityLockTemplate=[[GRAY]]{0}
|
||||
m.AbilityBonusTemplate=[[RED]]{0}: [[YELLOW]]{1}
|
||||
m.Effects=EFFETTI
|
||||
m.YourStats=LE TUE STATS
|
||||
m.SkillTaming=DOMARE
|
||||
m.XPGainTaming=Domare un'animale oppure combatti w/ con i tuoi lupi
|
||||
m.EffectsTaming1_0=Bestia tradizionale
|
||||
m.EffectsTaming1_1=Ossa-ispeziona lupi
|
||||
m.EffectsTaming2_0=Corna
|
||||
m.EffectsTaming2_1=Colpo critico applicato su Sanguinare
|
||||
m.EffectsTaming3_0=Artigli affilati
|
||||
m.EffectsTaming3_1=Bonus sul danno
|
||||
m.EffectsTaming4_0=Consapevole ambientale
|
||||
m.EffectsTaming4_1=Cactus/Lava Fobia, Immune al danno di caduta
|
||||
m.EffectsTaming5_0=Pelliccia spessa
|
||||
m.EffectsTaming5_1=Attacco ridotto, Resistenza al fuoco
|
||||
m.EffectsTaming6_0=Prova dello Shock
|
||||
m.EffectsTaming6_1=Riduzione sul danno alle esplosioni
|
||||
m.AbilLockTaming1=BLOCCATO FINO A 100+ SKILL (Consapevole Ambientale)
|
||||
m.AbilLockTaming2=BLOCCATO FINO A 250+ SKILL (Pelliccia spessa)
|
||||
m.AbilLockTaming3=BLOCCATO FINO A 500+ SKILL (Prova dello shock)
|
||||
m.AbilLockTaming4=BLOCCATO FINO A 750+ SKILL (Artigli affilati)
|
||||
m.AbilBonusTaming1_0=Consapevole ambientale
|
||||
m.AbilBonusTaming1_1=Il lupo evita il pericolo
|
||||
m.AbilBonusTaming2_0=Pelliccia spessa
|
||||
m.AbilBonusTaming2_1=Danno dimezzato, Resistenza al fuoco
|
||||
m.AbilBonusTaming3_0=Prova dello shock
|
||||
m.AbilBonusTaming3_1=Esplosivi fanno danni 1/6 su un normale danno
|
||||
m.AbilBonusTaming4_0=Artigli affilati
|
||||
m.AbilBonusTaming4_1=+2 Danno
|
||||
m.TamingGoreChance=[[RED]]Chance Corna: [[YELLOW]]{0}%
|
||||
m.SkillWoodCutting=BOSCAIOLO
|
||||
m.XPGainWoodCutting=Abbattere alberi
|
||||
m.EffectsWoodCutting1_0=Tagliatutto (ABILITA')
|
||||
m.EffectsWoodCutting1_1=Fa esplodere l'albero
|
||||
m.EffectsWoodCutting2_0=Foglia pergolata
|
||||
m.EffectsWoodCutting2_1=Soffia vie le foglie
|
||||
m.EffectsWoodCutting3_0=Doppio drop
|
||||
m.EffectsWoodCutting3_1=Raddoppia il bottino normale
|
||||
m.AbilLockWoodCutting1=BLOCCATO FINO A 100+ SKILL (Foglie Pergolate)
|
||||
m.AbilBonusWoodCutting1_0=Foglie Pergolate
|
||||
m.AbilBonusWoodCutting1_1=Soffia via le foglie
|
||||
m.WoodCuttingDoubleDropChance=[[RED]]Doppia drop chance: [[YELLOW]]{0}%
|
||||
m.WoodCuttingTreeFellerLength=[[RED]]Taglio veloce durata: [[YELLOW]]{0}s
|
||||
m.SkillArchery=ARCIERE
|
||||
m.XPGainArchery=Attacca mostri
|
||||
m.EffectsArchery1_0=Accensione
|
||||
m.EffectsArchery1_1=25% La chance contro i nemici si accende
|
||||
m.EffectsArchery2_0=Stordimento (Giocatori)
|
||||
m.EffectsArchery2_1=Disorienta i nemici
|
||||
m.EffectsArchery3_0=Danno+
|
||||
m.EffectsArchery3_1=Danni modificati
|
||||
m.EffectsArchery4_0=Richiamo della freccia
|
||||
m.EffectsArchery4_1=Possibilita di recuperare freccie dai cadaveri
|
||||
m.ArcheryDazeChance=[[RED]]Possibilita di stordimento: [[YELLOW]]{0}%
|
||||
m.ArcheryRetrieveChance=[[RED]]Chance del richiamo freccia: [[YELLOW]]{0}%
|
||||
m.ArcheryIgnitionLength=[[RED]]Durata dell'accensione: [[YELLOW]]{0} secondi
|
||||
m.ArcheryDamagePlus=[[RED]]Danno+ (Grado{0}): [[YELLOW]]Bonus {0} danno
|
||||
m.SkillAxes=ASCIA
|
||||
m.XPGainAxes=Attaccare mostri
|
||||
m.EffectsAxes1_0=Teschio Splitter (ABILITA')
|
||||
m.EffectsAxes1_1=Trattare AoE Danno
|
||||
m.EffectsAxes2_0=Colpo critico
|
||||
m.EffectsAxes2_1=Doppio danno
|
||||
m.EffectsAxes3_0=Padronanza dell'ascia
|
||||
m.EffectsAxes3_1=Aggiungi bonus danno
|
||||
m.EffectsAxes4_0=Impatto
|
||||
m.EffectsAxes4_1=Colpire con forza sufficiente da rompere l'armatura
|
||||
m.EffectsAxes5_0=Impatto Maggiore
|
||||
m.EffectsAxes5_1=Tratta il bonus del danno sui nemici senza armatura
|
||||
m.AbilLockAxes1=BLOCCATO FINO A 500+ SKILL (Padronanza dell'ascia)
|
||||
m.AbilBonusAxes1_0=Padronanza dell'ascia
|
||||
m.AbilBonusAxes1_1=Bonus {0} Danno
|
||||
m.AbilBonusAxes2_0=Impatto
|
||||
m.AbilBonusAxes2_1=Tratta {0} Danni sull'armatura
|
||||
m.AbilBonusAxes3_0=Impatto Maggiore
|
||||
m.AbilBonusAxes3_1=Tratta {0} Bonus danno sui nemici senza armatura
|
||||
m.AxesCritChance=[[RED]]Chance Colpo Critico: [[YELLOW]]{0}%
|
||||
m.AxesSkullLength=[[RED]]Teschio Splitter durata: [[YELLOW]]{0}s
|
||||
m.SkillSwords=SPADA
|
||||
m.XPGainSwords=Attaccare mostri
|
||||
m.EffectsSwords1_0=Contatore di attacchi
|
||||
m.EffectsSwords1_1=Riflette il 50% del danno ottenuto
|
||||
m.EffectsSwords2_0=Colpi serrati (ABILITA)
|
||||
m.EffectsSwords2_1=25% Danno AoE, Sanguinare+ AoE
|
||||
m.EffectsSwords3_0=Colpo serrato Sanguinare+
|
||||
m.EffectsSwords3_1=5 spunti di Sangue
|
||||
m.EffectsSwords4_0=Paracolpi
|
||||
m.EffectsSwords4_1=Nega Danno
|
||||
m.EffectsSwords5_0=Sanguinare
|
||||
m.EffectsSwords5_1=Applicare a Sanguinare DoT
|
||||
m.SwordsCounterAttChance=[[RED]]Contatore di attacchi Chance: [[YELLOW]]{0}%
|
||||
m.SwordsBleedLength=[[RED]]Tempo Sanguigno: [[YELLOW]]{0} spunti
|
||||
m.SwordsBleedChance=[[RED]]Chance Sanguinare: [[YELLOW]]{0} %
|
||||
m.SwordsParryChance=[[RED]]Paracolpi Chance: [[YELLOW]]{0} %
|
||||
m.SwordsSSLength=[[RED]]Durata Colpo Serrato: [[YELLOW]]{0}s
|
||||
m.SwordsTickNote=[[GRAY]]NOTA: [[YELLOW]]1 spunto e apparito per 2 secondi
|
||||
m.SkillAcrobatics=ACROBAZIE
|
||||
m.XPGainAcrobatics=Caduta
|
||||
m.EffectsAcrobatics1_0=Rotolare
|
||||
m.EffectsAcrobatics1_1=Riduce o nega i danni
|
||||
m.EffectsAcrobatics2_0=Rotolamento grazioso
|
||||
m.EffectsAcrobatics2_1=Due volte piu efficace il rotolamento
|
||||
m.EffectsAcrobatics3_0=Schivata
|
||||
m.EffectsAcrobatics3_1=Ridurre i danni alla meta
|
||||
m.AcrobaticsRollChance=[[RED]]Chance rotolamento: [[YELLOW]]{0}%
|
||||
m.AcrobaticsGracefulRollChance=[[RED]]Chance rotolamento grazioso: [[YELLOW]]{0}%
|
||||
m.AcrobaticsDodgeChance=[[RED]]Chance schivata: [[YELLOW]]{0}%
|
||||
m.SkillMining=MINATORE
|
||||
m.XPGainMining=Picconare Pietra & Minerali
|
||||
m.EffectsMining1_0=Super colpo (ABILITA)
|
||||
m.EffectsMining1_1=Velocita+, Tripla drop chance
|
||||
m.EffectsMining2_0=Doppio drops
|
||||
m.EffectsMining2_1=Raddoppia il bottino normale
|
||||
m.EffectsMining2_0=Doppio drops
|
||||
m.EffectsMining2_1=Raddoppia il bottino normale
|
||||
m.MiningDoubleDropChance=[[RED]]Doppio Drop Chance: [[YELLOW]]{0}%
|
||||
m.MiningSuperBreakerLength=[[RED]]Super Colpo Durata: [[YELLOW]]{0}s
|
||||
m.SkillRepair=RIPARAZIONE
|
||||
m.XPGainRepair=Riparando
|
||||
m.EffectsRepair1_0=Ripara
|
||||
m.EffectsRepair1_1=Ripara oggetti di ferro & armature
|
||||
m.EffectsRepair2_0=Padronanza sulla riparazione
|
||||
m.EffectsRepair2_1=Aumentata la riparatura
|
||||
m.EffectsRepair3_0=Super riparazione
|
||||
m.EffectsRepair3_1=Doppia efficacia
|
||||
m.EffectsRepair4_0=Riparazione Diamante ({0}+ SKILL)
|
||||
m.EffectsRepair4_1=Ripara Oggetti di diamante & armature
|
||||
m.RepairRepairMastery=[[RED]]Padronanza sulla riparazione: [[YELLOW]]Extra {0}% durabilita ripresa
|
||||
m.RepairSuperRepairChance=[[RED]]Super Riparo chance: [[YELLOW]]{0}%
|
||||
m.SkillUnarmed=DISARMATO
|
||||
m.XPGainUnarmed=Attaccare mostri
|
||||
m.EffectsUnarmed1_0=Berserk (ABILITA')
|
||||
m.EffectsUnarmed1_1=+50% Danno su materiali fragili
|
||||
m.EffectsUnarmed2_0=Disarma (Giocatori)
|
||||
m.EffectsUnarmed2_1=Droppa oggetti del nemico che aveva in mano
|
||||
m.EffectsUnarmed3_0=Braccio di ferro
|
||||
m.EffectsUnarmed3_1=Si indurisce il braccio nel corso del tempo
|
||||
m.EffectsUnarmed5_0=Deviare freccie
|
||||
m.EffectsUnarmed5_1=Deviare freccie
|
||||
m.AbilBonusUnarmed2_0=Braccio di ferro
|
||||
m.AbilBonusUnarmed2_1=+{0} Aggiornamento del danno
|
||||
m.UnarmedArrowDeflectChance=[[RED]]Freccia deviata Chance: [[YELLOW]]{0}%
|
||||
m.UnarmedDisarmChance=[[RED]]Disarma Chance: [[YELLOW]]{0}%
|
||||
m.UnarmedBerserkLength=[[RED]]Berserk durata: [[YELLOW]]{0}s
|
||||
m.SkillHerbalism=ERBORISTERIA
|
||||
m.XPGainHerbalism=Raccolta di Erbe
|
||||
m.EffectsHerbalism1_0=Terra verde (ABILITA)
|
||||
m.EffectsHerbalism1_1=Diffondi la terra, 3x Drops
|
||||
m.EffectsHerbalism2_0=Pollice verde (Grano)
|
||||
m.EffectsHerbalism2_1=Auto pianta il grano durante la raccolta
|
||||
m.EffectsHerbalism3_0=Pollice verde (Cobble/Stone Brick)
|
||||
m.EffectsHerbalism3_1=Pietra di ciottoli/Mattone di pietra -> Muschioso / Semi
|
||||
m.EffectsHerbalism4_0=Dieta d'agricoltore
|
||||
m.EffectsHerbalism4_1=Migliora la fame con i cibi di erboristeria
|
||||
m.EffectsHerbalism5_0=Doppio Drops (Tutte le erbe)
|
||||
m.EffectsHerbalism5_1=Raddoppia il bottino normale
|
||||
m.HerbalismGreenTerraLength=[[RED]]Terra verde durata: [[YELLOW]]{0}s
|
||||
m.HerbalismGreenThumbChance=[[RED]]Pollice verde Chance: [[YELLOW]]{0}%
|
||||
m.HerbalismGreenThumbStage=[[RED]]Pollice verde Stage: [[YELLOW]] il grano cresce in fase di {0}
|
||||
m.HerbalismDoubleDropChance=[[RED]]Doppia drop Chance: [[YELLOW]]{0}%
|
||||
m.HerbalismFoodPlus=[[RED]]Dieta d'agricoltore: [[YELLOW]]Grado {0}
|
||||
m.SkillExcavation=SCAVI
|
||||
m.XPGainExcavation=Scavare e trovare tesori
|
||||
m.EffectsExcavation1_0=Super trapano Breaker (ABILITA)
|
||||
m.EffectsExcavation1_1=3x Tasso di drop, 3x EXP, +Speed
|
||||
m.EffectsExcavation2_0=Cacciatore di tesori
|
||||
m.EffectsExcavation2_1=Abilita per cercare i tesori
|
||||
m.ExcavationGigaDrillBreakerLength=[[RED]]Super trapano Breaker durata: [[YELLOW]]{0}s
|
||||
mcBlockListener.PlacedAnvil=[[DARK_RED]]Hai posizionato un'incudine, l'incudine può riparare oggetti e armature
|
||||
mcEntityListener.WolfComesBack=[[DARK_GRAY]]Il tuo lupo e tornato da te
|
||||
mcPlayerListener.AbilitiesOff=Capacita di usare abilita(SPENTA)
|
||||
mcPlayerListener.AbilitiesOn=Capacita di usare abilita(ACCESA)
|
||||
mcPlayerListener.AbilitiesRefreshed=[[GREEN]]**ABILITa RINNOVATE\!**
|
||||
mcPlayerListener.AcrobaticsSkill=Acrobazie:
|
||||
mcPlayerListener.ArcherySkill=Arciere:
|
||||
mcPlayerListener.AxesSkill=Ascie:
|
||||
mcPlayerListener.ExcavationSkill=Scavi:
|
||||
mcPlayerListener.GodModeDisabled=[[YELLOW]]mcMMO Godmode disabilitata
|
||||
mcPlayerListener.GodModeEnabled=[[YELLOW]]mcMMO Godmode attivata
|
||||
mcPlayerListener.GreenThumb=[[GREEN]]**POLLICE VERDE**
|
||||
mcPlayerListener.GreenThumbFail=[[RED]]**POLLICE VERDE FAIL**
|
||||
mcPlayerListener.HerbalismSkill=Erboristeria:
|
||||
mcPlayerListener.MiningSkill=Minatore:
|
||||
mcPlayerListener.NoPermission=Non hai i McPermissi.
|
||||
mcPlayerListener.NoSkillNote=[[DARK_GRAY]]Se non hai l'accesso ad una skill non sara indicata qui.
|
||||
mcPlayerListener.NotInParty=[[RED]]Non sei in un party.
|
||||
mcPlayerListener.InviteSuccess=[[GREEN]]Invito inviato con successo.
|
||||
mcPlayerListener.ReceivedInvite1=[[RED]]AVVISO: [[GREEN]]Hai ricevuto un'invito ad un party {0} da {1}
|
||||
mcPlayerListener.ReceivedInvite2=[[YELLOW]]Scrivi [[GREEN]]/{0}[[YELLOW]] per accettare l'invito
|
||||
mcPlayerListener.InviteAccepted=[[GREEN]]Invito Accettato. Sei entrato nel party {0}
|
||||
mcPlayerListener.NoInvites=[[RED]]Non hai inviti in questo momento.
|
||||
mcPlayerListener.YouAreInParty=[[GREEN]]Sei nel party {0}
|
||||
mcPlayerListener.PartyMembers=[[GREEN]]Membri del party
|
||||
mcPlayerListener.LeftParty=[[RED]]Sei uscito dal party
|
||||
mcPlayerListener.JoinedParty=Iscritti al party: {0}
|
||||
mcPlayerListener.PartyChatOn=Party Chat [[GREEN]]Attiva
|
||||
mcPlayerListener.PartyChatOff=Party Chat [[RED]]Disattiva
|
||||
mcPlayerListener.AdminChatOn=Admin Chat [[GREEN]]Attiva
|
||||
mcPlayerListener.AdminChatOff=Admin Chat [[RED]]Disattiva
|
||||
mcPlayerListener.MOTD=[[BLUE]]Questo server tiene McMmmo {0} scrivi [[YELLOW]]/{1}[[BLUE]] per la lista aiuti.
|
||||
mcPlayerListener.WIKI=[[GREEN]]http://mcmmo.wikia.com[[BLUE]] - mcMMO Wiki
|
||||
mcPlayerListener.PowerLevel=[[DARK_RED]]Livello di potenza:
|
||||
mcPlayerListener.PowerLevelLeaderboard=[[YELLOW]]--mcMMO[[BLUE]] Livello di potenza [[YELLOW]]Classifica--
|
||||
mcPlayerListener.SkillLeaderboard=[[YELLOW]]--mcMMO [[BLUE]]{0}[[YELLOW]] Classifica--
|
||||
mcPlayerListener.RepairSkill=Riparazioni:
|
||||
mcPlayerListener.SwordsSkill=Spade:
|
||||
mcPlayerListener.TamingSkill=Domare:
|
||||
mcPlayerListener.UnarmedSkill=Disarmati:
|
||||
mcPlayerListener.WoodcuttingSkill=Boscaiolo:
|
||||
mcPlayerListener.YourStats=[[GREEN]][mcMMO] Stat
|
||||
Party.InformedOnJoin={0} [[GREEN]] e entrato nel tuo party
|
||||
Party.InformedOnQuit={0} [[GREEN]] e uscito dal tuo party
|
||||
Skills.YourGreenTerra=[[GREEN]]La tua abilita [[YELLOW]]Terra verde [[GREEN]]e stata rigenerata!
|
||||
Skills.YourTreeFeller=[[GREEN]]La tua abilita [[YELLOW]]Tagliatutto [[GREEN]]e stata rigenerata!
|
||||
Skills.YourSuperBreaker=[[GREEN]]La tua abilita [[YELLOW]]Super Colpo [[GREEN]]e stata rigenerata!
|
||||
Skills.YourSerratedStrikes=[[GREEN]]La tua abilita [[YELLOW]]Colpo serrato [[GREEN]]e stato rigenerata!
|
||||
Skills.YourBerserk=[[GREEN]]La tua abilita [[YELLOW]]Berserk [[GREEN]]e stata rigenerata!
|
||||
Skills.YourSkullSplitter=[[GREEN]]La tua abilita [[YELLOW]]Teschio Splitter [[GREEN]]e stata rigenerata!
|
||||
Skills.YourGigaDrillBreaker=[[GREEN]]La tua abilita [[YELLOW]]Super Trapano Breaker [[GREEN]]e stata rigenerata!
|
||||
Skills.TooTired=[[RED]]Sei troppo stanco per poter riutilizzare questa abilita.
|
||||
Skills.ReadyHoe=[[GREEN]]**LA TUA ZAPPA e PRONTA**
|
||||
Skills.LowerHoe=[[GRAY]]**POTERE DELLA ZAPPA ABBASSATO**
|
||||
Skills.ReadyAxe=[[GREEN]]**HAI L'ASCIA PRONTA**
|
||||
Skills.LowerAxe=[[GRAY]]**POTERE DELL'ASCIA ABBASSATO**
|
||||
Skills.ReadyFists=[[GREEN]]**IL TUO PUGILATO e PRONTO**
|
||||
Skills.LowerFists=[[GRAY]]**POTERE DEL PUGILATO ABBASSATO**
|
||||
Skills.ReadyPickAxe=[[GREEN]]**IL TUO PICCONE e PRONTO**
|
||||
Skills.LowerPickAxe=[[GRAY]]**POTERE DEL PICCONE ABBASSATO**
|
||||
Skills.ReadyShovel=[[GREEN]]**LA TUA PALA e PRONTA**
|
||||
Skills.LowerShovel=[[GRAY]]**POTERE DELLA PALA ABBASSATO**
|
||||
Skills.ReadySword=[[GREEN]]**LA TUA SPADA E PRONTA**
|
||||
Skills.LowerSword=[[GRAY]]**POTERE DELLA SPADA ABBASSATO**
|
||||
Skills.BerserkOn=[[GREEN]]**BERSERK ATTIVATO**
|
||||
Skills.BerserkPlayer=[[GREEN]]{0}[[DARK_GREEN]] ha usato [[RED]]Berserk!
|
||||
Skills.GreenTerraOn=[[GREEN]]**Terra verde ATTIVATO**
|
||||
Skills.GreenTerraPlayer=[[GREEN]]{0}[[DARK_GREEN]] ha usato [[RED]]Terra Verde!
|
||||
Skills.TreeFellerOn=[[GREEN]]**Rompi tutto l'albero ATTIVATO**
|
||||
Skills.TreeFellerPlayer=[[GREEN]]{0}[[DARK_GREEN]] ha usato [[RED]]Rompi tutto l'albero!
|
||||
Skills.SuperBreakerOn=[[GREEN]]**SUPER COLPO ATTIVATO**
|
||||
Skills.SuperBreakerPlayer=[[GREEN]]{0}[[DARK_GREEN]] ha usato [[RED]]Super COLPO!
|
||||
Skills.SerratedStrikesOn=[[GREEN]]**COLPO SERRATO ATTIVATO**
|
||||
Skills.SerratedStrikesPlayer=[[GREEN]]{0}[[DARK_GREEN]] ha usato [[RED]]Colpo Serrato!
|
||||
Skills.SkullSplitterOn=[[GREEN]]**TESCHIO SPLITTER ATTIVATO**
|
||||
Skills.SkullSplitterPlayer=[[GREEN]]{0}[[DARK_GREEN]] ha usato [[RED]]Teschio Splitter!
|
||||
Skills.GigaDrillBreakerOn=[[GREEN]]**Super Trapano BREAKER ATTIVATO**
|
||||
Skills.GigaDrillBreakerPlayer=[[GREEN]]{0}[[DARK_GREEN]] ha usato [[RED]]Super Trapano Breaker!
|
||||
Skills.GreenTerraOff=[[RED]]**Terra Verde si e esaurito**
|
||||
Skills.TreeFellerOff=[[RED]]**Rompi tutto l'albero si e esaurito**
|
||||
Skills.SuperBreakerOff=[[RED]]**Super Colpo si e esaurito**
|
||||
Skills.SerratedStrikesOff=[[RED]]**Colpo serrato si e esaurito**
|
||||
Skills.BerserkOff=[[RED]]**Berserk si e esaurito**
|
||||
Skills.SkullSplitterOff=[[RED]]**Teschio Splitter si e esaurito**
|
||||
Skills.GigaDrillBreakerOff=[[RED]]**Super Trapano Breaker si e esaurito**
|
||||
Skills.TamingUp=[[YELLOW]]La skill DOMARE e aumentato del {0}. Totale ({1})
|
||||
Skills.AcrobaticsUp=[[YELLOW]]La skill ACROBAZIE e aumentata del {0}. Totale ({1})
|
||||
Skills.ArcheryUp=[[YELLOW]]La skill ARCIERE e aumentata del {0}. Totale ({1})
|
||||
Skills.SwordsUp=[[YELLOW]]La skill SPADE e stata aumentata del {0}. Totale ({1})
|
||||
Skills.AxesUp=[[YELLOW]]La skill ASCIA e stata aumentata del {0}. Totale ({1})
|
||||
Skills.UnarmedUp=[[YELLOW]]La skill DISARMATO e stata aumentata del {0}. Totale ({1})
|
||||
Skills.HerbalismUp=[[YELLOW]]La skill ERBORISTERIA e stata aumentata del {0}. Totale ({1})
|
||||
Skills.MiningUp=[[YELLOW]]La skill MINATORE e stata aumentata del {0}. Totale ({1})
|
||||
Skills.WoodcuttingUp=[[YELLOW]]La skill BOSCAIOLO e stata aumentata del {0}. Totale ({1})
|
||||
Skills.RepairUp=[[YELLOW]]La skill RIPARAZIONE e stata aumentata del {0}. Totale ({1})
|
||||
Skills.ExcavationUp=[[YELLOW]]La skill SCAVI e stata aumentata DEL {0}. Totale ({1})
|
||||
Skills.FeltEasy=[[GRAY]]Sembrava facile.
|
||||
Skills.StackedItems=[[DARK_RED]]Non puoi riparare uno stack di itemd , separali
|
||||
Skills.NeedMore=[[DARK_RED]]Hai bisogno di piu
|
||||
Skills.AdeptDiamond=[[DARK_RED]]Non siete abbastanza esperti per poter riparare il diamante.
|
||||
Skills.FullDurability=[[GRAY]]Questo tiene gia piena durabilita.
|
||||
Skills.Disarmed=[[DARK_RED]]Sei stato disarmato!!
|
||||
m.LVL=[[DARK_GRAY]]LVL: [[GREEN]]{0} [[DARK_AQUA]]XP[[YELLOW]]([[GOLD]]{1}[[YELLOW]]/[[GOLD]]{2}[[YELLOW]])
|
||||
Combat.BeastLore=[[GREEN]]**BESTIA TRADIZIONALE**
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Proprietario ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Vita ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
mcMMO.Description=[[DARK_AQUA]]Informazioni su [[YELLOW]]mcMMO[[DARK_AQUA]] Project:,[[GOLD]]mcMMO e una [[RED]]open source[[GOLD]] RPG mod creata nel mese di febbraio 2011,[[GOLD]]by [[BLUE]]nossr50[[GOLD]]. L'obbiettivo e quello di fornire un servizio di qualita RPG,[[DARK_AQUA]]Suggerimenti:,[[GOLD]] - [[GREEN]]Usa [[RED]]/mcc[[GREEN]] per vedere i comandi,[[GOLD]] - [[GREEN]]Scrivi [[RED]]/SKILLNAME[[GREEN]] Per vedere dei dettagli su una skill,[[DARK_AQUA]]Sviluppatori:,[[GOLD]] - [[GREEN]]TheYeti [[BLUE]](Project Lead & Developer),[[GOLD]] - [[GREEN]]NuclearW [[BLUE]](Developer),[[GOLD]] - [[GREEN]]GJ [[BLUE]](Developer),[[GOLD]] - [[GREEN]]nossr50 [[BLUE]](Developer & Creator),[[DARK_AQUA]]Useful Links:,[[GOLD]] - [[GREEN]]issues.mcmmo.org[[GOLD]] Bug Reporting,[[GOLD]] - [[GREEN]]#mcmmo @ irc.esper.net[[GOLD]] IRC Chat,[[GOLD]] - [[GREEN]]www.mcmmo.org[[GOLD]] Sito ufficiale,[[GOLD]] - [[GREEN]]http://bit.ly/x3Yvry[[GOLD]] Bukkit Forum Thread,[[GOLD]] - [[GREEN]]https://twitter.com/#!/mcmmo_dev[[GOLD]] mcMMO Twitter,[[DARK_AQUA]]Info sulle donazioni:
|
||||
Party.Locked=[[RED]]Il party e bloccato , soltanto il leader può invitare.
|
||||
Party.IsntLocked=[[GRAY]]Il party non e bloccato
|
||||
Party.Unlocked=[[GRAY]]Party sbloccato.
|
||||
Party.Help1=[[RED]]L'uso corretto e [[YELLOW]]/{0} [[WHITE]]<name>[[YELLOW]] oppure [[WHITE]]'q' [[YELLOW]]per uscire
|
||||
Party.Help2=[[RED]]Per entrare in un party con la password usa [[YELLOW]]/{0} [[WHITE]]<name> <password>
|
||||
Party.Help3=[[RED]]Consulta /{0} ? per piu informazioni
|
||||
Party.Help4=[[RED]]Usa [[YELLOW]]/{0} [[WHITE]]<name> [[YELLOW]]per entrare in un party oppure [[WHITE]]'q' [[YELLOW]]per uscire
|
||||
Party.Help5=[[RED]]Per bloccare il tuo party scrivi: [[YELLOW]]/{0} [[WHITE]]lock
|
||||
Party.Help6=[[RED]]Per sbloccare il tuo party usa: [[YELLOW]]/{0} [[WHITE]]unlock
|
||||
Party.Help7=[[RED]]Per inserire una password al tuo party usa: [[YELLOW]]/{0} [[WHITE]]password <password>
|
||||
Party.Help8=[[RED]]Per cacciare una persona dal tuo party usa: [[YELLOW]]/{0} [[WHITE]]kick <player>
|
||||
Party.Help9=[[RED]]Per trasferire il leader ad un'altro player del tuo party usa [[YELLOW]]/{0} [[WHITE]]owner <player>
|
||||
Party.NotOwner=[[DARK_RED]]Non sei il leader del party
|
||||
Party.InvalidName=[[DARK_RED]]Questo non e un nome valido di un party
|
||||
Party.PasswordSet=[[GREEN]]Party password settata come {0}
|
||||
Party.CouldNotKick=[[DARK_RED]]Impossibile cacciare il player {0}
|
||||
Party.NotInYourParty=[[DARK_RED]]{0} non e nel tuo party
|
||||
Party.CouldNotSetOwner=[[DARK_RED]]Impossibile impostare leader a {0}
|
||||
Commands.xprate.proper=[[DARK_AQUA]]l'uso corretto e /{0} [integer] [true:false]
|
||||
Commands.xprate.proper2=[[DARK_AQUA]]Inoltre e possibilte digitare /{0} per ripristinare e tornare alla normalita
|
||||
Commands.xprate.proper3=[[RED]]Inserisci true o false per il secondo value
|
||||
Commands.xprate.over=[[RED]]mcMMO XP Tasso di evento bonus e finito!!
|
||||
Commands.xprate.started=[[GOLD]]XP EVENT per mcMMO e Iniziato!
|
||||
Commands.xprate.started2=[[GOLD]]mcMMO XP RATE e adesso {0}x!!
|
||||
Commands.xplock.locked=[[GOLD]]La tua XP BAR e adesso bloccata {0}!
|
||||
Commands.xplock.unlocked=[[GOLD]]La tua XP BAR e adesso [[GREEN]]SBLOCCATA[[GOLD]]!
|
||||
Commands.xplock.invalid=[[RED]]Questo non e un valido skillname! Prova /xplock minatore
|
||||
m.SkillFishing=PESCARE
|
||||
mcPlayerListener.FishingSkill=PESCARE:
|
||||
Skills.FishingUp=[[YELLOW]]La tua skill PESCARE e stata aumentata del {0}. Totale ({1})
|
||||
Repair.LostEnchants=[[RED]]Non sei abbastanza abile per poter riparare oggetti con incantesimi.
|
||||
Repair.ArcanePerfect=[[GREEN]]Lei ha sostenuto le energie arcane in questo oggetto.
|
||||
Repair.Downgraded=[[RED]]Il potere arcano e stato diminuito per questo oggetto.
|
||||
Repair.ArcaneFailed=[[RED]]Il potere arcano e permanentemente rimosso dall'oggetto.
|
||||
m.EffectsRepair5_0=Forgia arcana
|
||||
m.EffectsRepair5_1=Ripara oggetti magici
|
||||
m.ArcaneForgingRank=[[RED]]Forgia arcana: [[YELLOW]]Grado {0}/4
|
||||
m.ArcaneEnchantKeepChance=[[GRAY]]AF Tasso di successo: [[YELLOW]]{0}%
|
||||
m.ArcaneEnchantDowngradeChance=[[GRAY]]AF Chance di retrocedere: [[YELLOW]]{0}%
|
||||
Fishing.MagicFound=[[GRAY]]Ti senti un tocco di magia con questa cattura.
|
||||
Fishing.ItemFound=[[GRAY]]Tesoro trovato!
|
||||
m.SkillFishing=PESCARE
|
||||
m.XPGainFishing=Pescare (Vai alla figura!)
|
||||
m.EffectsFishing1_0=Cacciatore di tesori (Passivo)
|
||||
m.EffectsFishing1_1=Pescare oggetti casuali
|
||||
m.EffectsFishing2_0=Cacciatore Magico
|
||||
m.EffectsFishing2_1=Trovare oggetti incantati
|
||||
m.EffectsFishing3_0=Agitare (vs. Entita)
|
||||
m.EffectsFishing3_1=Agitare oggetti di mobs/pesca polo
|
||||
m.FishingRank=[[RED]]Cacciatore di tesori Grado: [[YELLOW]]{0}/5
|
||||
m.FishingMagicInfo=[[RED]]Cacciatore Magico: [[GRAY]] **Migliora con Cacciatore di tesori Grado**
|
||||
m.ShakeInfo=[[RED]]Agiti: [[YELLOW]]Elementi tagliandi folle, mutilanti loro nel processo.
|
||||
m.AbilLockFishing1=BLOCCATO FINO A 150+ SKILL (AGITARE)
|
||||
m.TamingSummon=[[GREEN]]Evocazione completata
|
||||
m.TamingSummonWolfFailed=[[RED]]Avete troppi lupi vicini e non puoi evocarne altri.
|
||||
m.EffectsTaming7_0=Richiamo della giungla
|
||||
m.EffectsTaming7_1=Evocare il lupo dal tuo lato
|
||||
m.EffectsTaming7_2=[[GRAY]]COTW COME FARE: Accovacciati e clicca con il tasto destro {0} con l'osso in mano
|
||||
m.EffectsTaming8_0=Servizio di Fastfood
|
||||
m.EffectsTaming8_1=Chance per il lupo per curarsi all'attacco
|
||||
m.AbilLockTaming5=BLOCCATO FINO A 50+ SKILL (SERVIZIO FAST FOOD)
|
||||
m.AbilBonusTaming5_0=Servizio Fast Food
|
||||
m.AbilBonusTaming5_1=50% Chance per guarire in attacco
|
||||
Swords.StoppedBleeding=[[GRAY]]Il sanguinamento e stato [[GREEN]]stoppato[[GRAY]]!
|
||||
m.EffectsMining3_0=Esplosione Minatrice
|
||||
m.EffectsMining3_1=Bonus ad estrazione con TNT
|
||||
m.EffectsMining4_0=Bombe piu grandi
|
||||
m.EffectsMining4_1=Aumenta il raggio di esplosione della TNT
|
||||
m.EffectsMining5_0=Esperto di demolizioni
|
||||
m.EffectsMining5_1=Riduce i danni dell'esplosione della TNT
|
||||
m.AbilLockMining1=BLOCCATO FINO A 125+ SKILL (ESPLOSIONE MINATRICE)
|
||||
m.AbilLockMining2=BLOCCATO FINO A 250+ SKILL (BOMBE PIu GRANDI)
|
||||
m.AbilLockMining3=BLOCCATO FINO A 500+ SKILL (Esperto di demolizioni)
|
||||
m.MiningBiggerBombs=[[RED]]Raggio di esplosione aumentato: [[YELLOW]]+{0}
|
||||
m.MiningDemolitionsExpertDamageDecrease=[[RED]]Esperto di demolizioni Danno diminuito: [[YELLOW]]{0}%
|
||||
m.MiningBlastMining = [[RED]] scavi esplosivi : [[YELLOW]] Grado {0} [[GRAY]] ({1})
|
||||
m.BlastMining1 = rendimento minerale +35%
|
||||
m.BlastMining2 = rendimento minerale +40%
|
||||
m.BlastMining3 = rendimento minerale +45%, nessun detrito
|
||||
m.BlastMining4 = rendimento minerale +50%, nessun detrito
|
||||
m.BlastMining5 = rendimento minerale 55%, senza detriti, gocce doppi
|
||||
m.BlastMining6 = rendimento minerale 60%, senza detriti, gocce doppi
|
||||
m.BlastMining7 = rendimento minerale 65%, senza detriti, gocce triple
|
||||
m.BlastMining8 = rendimento minerale 70%, senza detriti, gocce triple
|
||||
Skills.AdeptStone = [[DARK_RED]]non sei abbastanza esperto per riparare pietra.
|
||||
Skills.AdeptIron = [[DARK_RED]] non sei abbastanza esperto per riparare ferro.
|
||||
Skills.AdeptGold = [[DARK_RED]] non sei abbastanza esperto per riparare oro.
|
||||
Skills.Woodcutting.TreeFellerThreshold = [[RED]] Quell'albero e troppo grande!
|
||||
Axes.GreaterImpactOnSelf=[[RED]]**HIT BY GREATER IMPACT**
|
||||
Axes.GreaterImpactOnEnemy=[[GREEN]]**STRUCK WITH GREAT FORCE**
|
||||
Skills.BerserkPlayerOff=[[RED]]Berserk[[GREEN]] e stato spento per [[YELLOW]]{0}
|
||||
Skills.GreenTerraPlayerOff=[[RED]]Terra verde[[GREEN]] e stato spento per [[YELLOW]]{0}
|
||||
Skills.TreeFellerPlayerOff=[[RED]]Taglio veloce[[GREEN]] e stato spento per [[YELLOW]]{0}
|
||||
Skills.SuperBreakerPlayerOff=[[RED]]Super Breaker[[GREEN]] e stato spento per [[YELLOW]]{0}
|
||||
Skills.SkullSplitterPlayerOff=[[RED]]Skull Splitter[[GREEN]] e stato spento perr [[YELLOW]]{0}
|
||||
Skills.GigaDrillBreakerPlayerOff=[[RED]]Super Trapano Breaker[[GREEN]] e stato spento per [[YELLOW]]{0}
|
||||
Skills.SerratedStrikesPlayerOff=[[RED]]Serrated Strikes[[GREEN]] e stato spento per [[YELLOW]]{0}
|
||||
Skills.BlastMiningPlayer=[[GREEN]]{0}[[DARK_GREEN]] ha usato [[RED]]Esplosione Minatrice!
|
||||
Skills.YourBlastMining=[[GREEN]]La tua skill [[YELLOW]]Esplosione Minica [[GREEN]]e stata rigenerata!
|
||||
TreeFeller.AxeSplinters=[[RED]]LE SCHEGGIE DELLA VOSTRA ASCIA SONO IN DECINE DI PEZZI
|
||||
Acrobatics.GracefulRoll=[[GREEN]]**ROTOLAMENTO GRAZIOSO**
|
||||
Acrobatics.Dodge=[[GREEN]]**SCHIVATA**
|
||||
Acrobatics.Roll=**ROTOLAMENTO**
|
||||
Axes.HitCritically=[[DARK_RED]]Siete stati colpiti da un colpo critico!
|
||||
Axes.CriticalHit=[[RED]]COLPO CRITICO!
|
||||
Axes.HitByCleave=[[DARK_RED]]Colpito da un fendere!
|
||||
Swords.EnemyBleeding=[[GREEN]]**Nemico sanguinante**
|
||||
Swords.HitBySerratedStrikes=[[DARK_RED]]Colpito da un colpo serrato!
|
||||
Swords.CounterAttacked=[[GREEN]]**Contatore di colpi**
|
||||
Swords.HitByCounterAttack=[[DARK_RED]]Sei stato colpito da un contatore di colpi!
|
||||
Guides.Acrobatics=[[DARK_AQUA]]Informazioni sull'acrobazia: \ n [[YELLOW]] acrobazia e l'arte di muoversi con grazia in mcMMO \ n [[YELLOW]] Esso fornisce bonus di combattimento e dei primi danni all'ambiente \ n \ n [.. [DARK_AQUA]] XP GAIN:\ n [[YELLOW]] per guadagnare XP in questa abilita e necessario eseguire una schivata \ n [[YELLOW]] in combattimento o sopravvivere a cadute da altezze che il danno sia non mortale \ n \ n [[. DARK_AQUA]] Come funziona la skill di rotolamento? \ n[[YELLOW]] hai la possibilita passiva quando si prende danno da caduta di rotolare \ n[[YELLOW]] per eliminando cosi il danno fatto. e possibile tenere premuto il pulsante per accovacciarsi per \ n [[YELLOW]] raddoppiare le probabilita di salvezza durante la caduta. \ N [[YELLOW]]Questo Albo Graceful al posto di una caduta standard. \ N [[YELLOW]] RollsGraceful sono come rotoli regolari, ma hanno il doppio delle probabilita che \ n[[YELLOW]] si verifichino i danni e fornisce la sicurezza di piu di rotoli regolari. \ n[[YELLOW]] la possibilita di rotolare e legato al vostro livello di abilita \ n[[DARK_AQUA]] Come funziona la skill schivare ? \ n [[YELLOW]] schivare e una possibilita passiva quando si e \ n [YELLOW]] feriti in combattimento per dimezzare il danno ricevuto. \ n [[YELLOW]] questo legato sempre al vostro livello di abilita.
|
||||
Guides.Archery=La guida arrivera dopo.
|
||||
Guides.Axes=La guida arrivera dopo.
|
||||
Guides.Excavation=[[DARK_AQUA]]Riguardo a Scavi:\n[[YELLOW]]Scavi e l’atto di smuover il terreno per trovare tesori.\n[[YELLOW]]Scavando per terra troverai alcuni tesori.\n[[YELLOW]]Piu la userai , piu tesori riusciari a trovare.\n\n[[DARK_AQUA]]GUADAGNARE ESPERIENZA:\n[[YELLOW]]Per guadagnare esperienza in questa abilita devi scavare tenendo in mano una pala.\n[[YELLOW]]Solo alcuni materiali possono essere scavati per ricavare tesori ed esperienza.\n[[DARK_AQUA]]Materiali Compatibili:\n[[YELLOW]]Erba, Terra, Sabbia, Argilla, Ghiaia, Micelio, Soul Sand\n\n[[DARK_AQUA]]Come usare Giga Drill Breaker:\n[[YELLOW]]Impugnando una pala premi col tasto destro per preparare il tuo attrezzo.\n[[YELLOW]Una volta in questo stato hai circa 4 secondi per entrare in\n[[YELLOW]]contatto con materiali compatibili e questo\n[[YELLOW]]attivera Super Trapano Breaker.\n[[DARK_AQUA]Cos’e Super Trapano Breaker?\n[[YELLOW]]Super Trapano Breaker e un’abilita con un tempo di raffreddamento\n[[YELLOW]]legato all’abilita Scavi. Triplica le tue possibilita\n[[YELLOW]]di trovare tesori e permette di rompere all’istante\n[[YELLOW]] i materiali appositi.\n\n[[DARK_AQUA]]Come funziona CercaTesori?\n[[YELLOW]]Ogni possible tesoro di Scavi ha un proprio\n[[YELLOW]]livello di abilita necessario per essere emesso, e come risultato e \n[[YELLOW]]diffiicile dire quanto sia utile questa abilita.\n[[YELLOW]]Tieni solo conto che piu alto sara il tuo livello di Scavi\n[[YELLOW]], maggiore sara la varieta di tesori che potrai trovare.\n[[YELLOW]]E ricordati anche che usando Scavi\n[[YELLOW]]ogni materiale compatibile ha la propria unica lista di tesori.\n[[YELLOW]]In altre parole troverai tesori diversi nella terra\n[[YELLOW]]rispetto a quelli nella ghiaia.\n[[DARK_AQUA]]Note riguardo a Scavi:\n[[YELLOW]]I premi di Scavi sono completamente personabilizzabili\n[[YELLOW]]Perciò variano da server a server.
|
||||
Guides.Fishing=La guida arrivera dopo.
|
||||
Guides.Herbalism=La guida arrivera dopo.
|
||||
Guides.Mining=[[DARK_AQUA]]Informazioni sul minatore:\n[[YELLOW]]Il minatore consiste nell’estrarre rocce e minerali. Procura dei bonus\n[[YELLOW]]alla quantita di materiali rilasciati dagli scavi.\n\n[[DARK_AQUA]]GUADAGNARE ESPERIENZA:\n[[YELLOW]]Per guadagnare esperienza in questa abilita, devi scavare impugnando un piccone.\n[[YELLOW]]Solo alcuni blocchi rilasciano esperienza.\n\n[[DARK_AQUA]]Materiali compatibili:\n[[YELLOW]]Pietra, Minerale di carbone, Minerale di ferro, Minerale d’oro, Minerale di diamanti, Minerale di Redstone,\n[[YELLOW]] Minerale di lapis lazuli, Ossidiana, MossStone, Pietra dell’Ender,\n[[YELLOW]]Glowstone, e Netherrack.\n\n[[DARK_AQUA]]Come usare Super Sfondamento?:\n[[YELLOW]]Impugnando un piccone , premi il tasto destro per preparare il tuo strumento.\n[[YELLOW]]Durante questo stadio, hai circa 4 secondi per entrare in contatto \n[[YELLOW]]con un minerale adatto, e ciò attivera Super\n[[YELLOW]]Sfondamento.\n\n[[DARK_AQUA]]Cos’e Super Sfondamento?\n[[YELLOW]Super sfondamento e un abilita con un tempo di raffreddamento legato all’abilita Scavo \n[[YELLOW]]. Triplica la possibilita che vengano rilasciati oggetti in piu e\n[[YELLOW]]e permette di rompere istatntaneamenti i minerali rocciosi.\n\n[[DARK_AQUA]]Come usare Scavi Esplosivi:\n[[YELLOW]]Con in mano un detonatore ,che e impostato con acciarino ,\n[[YELLOW]]clicca col tasto destro sulla TNT a distanza. Questo fara si che la TNT\n[[YELLOW]]esploda all’istante.\n\n[[DARK_AQUA]]Come funziona Scavi Esplosivi ?\n[[YELLOW]]Scavi Esplosivi e un abilita con una durata legato all’abilita di scavo\n[[YELLOW]]. Dona dei bounus quando sis cava con la TNT e permette a te \n[[YELLOW]]di fare esplodere la TNT a distanza.Ci sono 3 parti in Scavi Esplosivi.\n[[YELLOW]]La prima parte e Bombe Maggiori , che aumenta il raggio dell’esplosione.\n[[YELLOW]]La seconda e Esperto Demolitore, che diminuisce il danno\n[[YELLOW]]da TNT. La terza parte aumenta semplicemente the\n[[YELLOW]]la quantita di minerali rilasciati dalla TNT e diminuisce i\n[[YELLOW]]detriti rilasciati.
|
||||
Guides.Repair=La guida arrivera dopo.
|
||||
Guides.Swords=La guida arrivera dopo.
|
||||
Guides.Taming=La guida arrivera dopo.
|
||||
Guides.Unarmed=La guida arrivera dopo.
|
||||
Guides.Woodcutting=La guida arrivera dopo.
|
||||
GodMode.Forbidden=[mcMMO] La god mode non e permessa in questo mondo (Controlla i Permissi)
|
||||
XPRate.Event = [[GOLD]]mcMMO ha un'evento in corso -> XP aumentato! la XP Rate e {0}x!
|
||||
BlastMining.Boom = [[GRAY]]**BOOM**
|
||||
Party.Forbidden=[mcMMO] I party non sono permessi in questo mondo (Controlla i Permessi)
|
||||
m.TamingSummonOcelotFailed=[[RED]]You have too many ocelots nearby to summon any more.
|
||||
@@ -4,21 +4,16 @@
|
||||
# Verander deze file alleen met Notepad++
|
||||
# Geef fouten door aan pluis65@hotmail.com
|
||||
# Last official edit: 8-7-2011
|
||||
Combat.WolfExamine=[[GREEN]]**Je bekijkt de wolf met Wolfinspectie**
|
||||
Combat.WolfShowMaster=[[DARK_GREEN]]Eigenaar van de wolf \: {0}
|
||||
Combat.Ignition=[[RED]]**IGNITION**
|
||||
Combat.BurningArrowHit=[[DARK_RED]]Je bent geraakt door een brandende pijl\!
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]Je raakte Fuzzy aan. Je voelt je duizelig.
|
||||
Combat.TargetDazed=Doelwit was [[DARK_RED]]versuft
|
||||
Combat.WolfNoMaster=[[GRAY]]Deze wolf heeft geen eigenaar...
|
||||
Combat.WolfHealth=[[GREEN]]Deze wolf heeft {0} levens
|
||||
Combat.StruckByGore=[[RED]]**VAST DOOR GESTOLD BLOED**
|
||||
Combat.Gore=[[GREEN]]**GESTOLD BLOED**
|
||||
Combat.ArrowDeflect=[[WHITE]]**PIJL AFWIJKING**
|
||||
Item.ChimaeraWingFail=**CHIMAERA WING MISLUKT\!**
|
||||
Item.ChimaeraWingPass=**CHIMAERA WING**
|
||||
Item.InjuredWait=Je bent gewond en moet wachten. [[YELLOW]]({0}s)
|
||||
Item.NeedFeathers=[[GRAY]]Je hebt meer veren nodig..
|
||||
m.mccPartyCommands=[[GREEN]]--PARTY COMMANDOS--
|
||||
m.mccParty=[party name] [[RED]]- Maak/Join getypte party
|
||||
m.mccPartyQ=[[RED]]- Verlaat je huidige party
|
||||
@@ -221,10 +216,6 @@ mcPlayerListener.GreenThumb=[[GREEN]]**GROENE VINGERS**
|
||||
mcPlayerListener.GreenThumbFail=[[RED]]**GROENE VINNGERS MISLUKT**
|
||||
mcPlayerListener.HerbalismSkill=Landbouw:
|
||||
mcPlayerListener.MiningSkill=Mijnbouw:
|
||||
mcPlayerListener.MyspawnCleared=[[DARK_AQUA]]Myspawn is verwijderd.
|
||||
mcPlayerListener.MyspawnNotExist=[[RED]]Plaats Myspawn eerst door op een bed te drukken.
|
||||
mcPlayerListener.MyspawnSet=[[DARK_AQUA]]Myspawn is geplaatst op je huidige locatie.
|
||||
mcPlayerListener.MyspawnTimeNotice=Je moet {0}m {1}s wachten voordat je myspawn kan gebruiken.
|
||||
mcPlayerListener.NoPermission=Je hebt geen permissie.
|
||||
mcPlayerListener.NoSkillNote=[[DARK_GRAY]]Als je geen toegang hebt tot een skill wordt hij hier niet weergegeven.
|
||||
mcPlayerListener.NotInParty=[[RED]]Je zit niet in een party.
|
||||
@@ -315,8 +306,7 @@ Skills.Disarmed=[[DARK_RED]]Je bent ontwapend!
|
||||
m.LVL=[[DARK_GRAY]]LVL: [[GREEN]]{0} [[DARK_AQUA]]XP[[YELLOW]]([[GOLD]]{1}[[YELLOW]]/[[GOLD]]{2}[[YELLOW]])
|
||||
Combat.BeastLore=[[GREEN]]**WOLFINSPECTIE**
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Eigenaar ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BeastLoreHealthWolfTamed=[[DARK_AQUA]]Levens ([[GREEN]]{0}[[DARK_AQUA]]/20)
|
||||
Combat.BeastLoreHealthWolf=[[DARK_AQUA]]Levens ([[GREEN]]{0}[[DARK_AQUA]]/8)
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Levens ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
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]]TheYeti [[BLUE]](Project Lead & Developer),[[GOLD]] - [[GREEN]]NuclearW [[BLUE]](Developer),[[GOLD]] - [[GREEN]]GJ [[BLUE]](Developer),[[GOLD]] - [[GREEN]]nossr50 [[BLUE]](Developer & Creator),[[DARK_AQUA]]Useful Links:,[[GOLD]] - [[GREEN]]issues.mcmmo.org[[GOLD]] Bug Reporting,[[GOLD]] - [[GREEN]]#mcmmo @ irc.esper.net[[GOLD]] IRC Chat,[[GOLD]] - [[GREEN]]www.mcmmo.org[[GOLD]] Official Website,[[GOLD]] - [[GREEN]]http://bit.ly/x3Yvry[[GOLD]] Bukkit Forum Thread,[[GOLD]] - [[GREEN]]https://twitter.com/#!/mcmmo_dev[[GOLD]] mcMMO Twitter,[[DARK_AQUA]]Donation Info:
|
||||
Party.Locked=[[RED]]Party is locked, only party leader may invite.
|
||||
Party.IsntLocked=[[GRAY]]Party is not locked
|
||||
@@ -372,7 +362,7 @@ m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter
|
||||
m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_;
|
||||
m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE)
|
||||
m.TamingSummon=[[GREEN]]Summoning complete
|
||||
m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.TamingSummonWolfFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.EffectsTaming7_0=Call of the Wild
|
||||
m.EffectsTaming7_1=Summon a wolf to your side
|
||||
m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with {0} Bones in hand
|
||||
@@ -439,4 +429,9 @@ Guides.Repair=Guide coming soon...
|
||||
Guides.Swords=Guide coming soon...
|
||||
Guides.Taming=Guide coming soon...
|
||||
Guides.Unarmed=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
GodMode.Forbidden=[mcMMO] God Mode not permitted on this world (See Permissions)
|
||||
XPRate.Event = [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x!
|
||||
BlastMining.Boom = [[GRAY]]**BOOM**
|
||||
Party.Forbidden=[mcMMO] Parties not permitted on this world (See Permissions)
|
||||
m.TamingSummonOcelotFailed=[[RED]]You have too many ocelots nearby to summon any more.
|
||||
@@ -1,18 +1,13 @@
|
||||
Combat.WolfExamine=[[GREEN]]**Zbadales wilka uzywajac wiedzy o zwierzetach**
|
||||
Combat.WolfShowMaster=[[DARK_GREEN]]Wlascicielem wilka jest \: {0}
|
||||
Combat.Ignition=[[RED]]**PODPALENIE**
|
||||
Combat.BurningArrowHit=[[DARK_RED]]Zostales trafiony plonaca strzala\!
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]Zostales oszolomiony.
|
||||
Combat.TargetDazed=Cel zostal [[DARK_RED]]oszolomiony.
|
||||
Combat.WolfNoMaster=[[GRAY]]Ten wilk nie ma wlasciciela...
|
||||
Combat.WolfHealth=[[GREEN]]Ten wilk ma {0} zycia.
|
||||
Combat.StruckByGore=[[RED]]**WYKRWAWIENIE**
|
||||
Combat.Gore=[[GREEN]]**KRWOTOK**
|
||||
Combat.ArrowDeflect=[[WHITE]]**ODBICIE STRZALY**
|
||||
Item.ChimaeraWingFail=**UZYCIE SKRZYDLA CHIMERY NIE POWIODLO SIE\!**
|
||||
Item.ChimaeraWingPass=**UZYLES SKRZYDLA CHIMERY**
|
||||
Item.InjuredWait=Zostales ranny. Musisz poczekac [[YELLOW]]{0}[[WHITE]] sekund przed uzyciem.
|
||||
Item.NeedFeathers=[[GRAY]]Potrzebujesz wiecej pior.
|
||||
m.mccPartyCommands=[[GREEN]]--KOMENDY DRUZYNOWE--
|
||||
m.mccParty=[party name] [[RED]]- Tworzy lub dolacza do danej druzyny.
|
||||
m.mccPartyQ=[[RED]]- Pozwala opuscic druzyne.
|
||||
@@ -215,10 +210,6 @@ mcPlayerListener.GreenThumb=[[GREEN]]**UZYLES ZIELONEJ ZIEMI**
|
||||
mcPlayerListener.GreenThumbFail=[[RED]]**UZYWANIE ZIELONEJ ZIEMI NIE POWIODLO SIE**
|
||||
mcPlayerListener.HerbalismSkill=Zielarstwo:
|
||||
mcPlayerListener.MiningSkill=Gornictwo:
|
||||
mcPlayerListener.MyspawnCleared=[[DARK_AQUA]]Twoj spawn zostal usuniety.
|
||||
mcPlayerListener.MyspawnNotExist=[[RED]]Musisz ustawic swoj spawn za pomoca lozka.
|
||||
mcPlayerListener.MyspawnSet=[[DARK_AQUA]]Twoj spawn zostal ustawiony na twoje aktualne polozenie.
|
||||
mcPlayerListener.MyspawnTimeNotice=Musisz zaczekac {0} minut i {1} sekund aby przeteleportowac sie na spawn.
|
||||
mcPlayerListener.NoPermission=Brak mcPermissions.
|
||||
mcPlayerListener.NoSkillNote=[[DARK_GRAY]]Umiejetnosci, ktorych nie mozesz uzyc nie sa wyswietlane.
|
||||
mcPlayerListener.NotInParty=[[RED]]Nie jestes w grupie.
|
||||
@@ -309,8 +300,7 @@ Skills.Disarmed=[[DARK_RED]]Zostales rozbrojony!
|
||||
m.LVL=[[DARK_GRAY]]LVL: [[GREEN]]{0} [[DARK_AQUA]]Doswiadczenia[[YELLOW]]([[GOLD]]{1}[[YELLOW]]/[[GOLD]]{2}[[YELLOW]])
|
||||
Combat.BeastLore=[[GREEN]]**WIEDZA O ZWIERZETACH**
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Wlasciciel ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BeastLoreHealthWolfTamed=[[DARK_AQUA]]Zycie ([[GREEN]]{0}[[DARK_AQUA]]/20)
|
||||
Combat.BeastLoreHealthWolf=[[DARK_AQUA]]Zycie ([[GREEN]]{0}[[DARK_AQUA]]/8)
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Zycie ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
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]]TheYeti [[BLUE]](Project Lead & Developer),[[GOLD]] - [[GREEN]]NuclearW [[BLUE]](Developer),[[GOLD]] - [[GREEN]]GJ [[BLUE]](Developer),[[GOLD]] - [[GREEN]]nossr50 [[BLUE]](Developer & Creator),[[DARK_AQUA]]Useful Links:,[[GOLD]] - [[GREEN]]issues.mcmmo.org[[GOLD]] Bug Reporting,[[GOLD]] - [[GREEN]]#mcmmo @ irc.esper.net[[GOLD]] IRC Chat,[[GOLD]] - [[GREEN]]www.mcmmo.org[[GOLD]] Official Website,[[GOLD]] - [[GREEN]]http://bit.ly/x3Yvry[[GOLD]] Bukkit Forum Thread,[[GOLD]] - [[GREEN]]https://twitter.com/#!/mcmmo_dev[[GOLD]] mcMMO Twitter,[[DARK_AQUA]]Donation Info:
|
||||
Party.Locked=[[RED]]Grupa jest zamknieta, tylko wlasciciel moze dodac graczy.
|
||||
Party.IsntLocked=[[GRAY]]Grupa jest otwarta dla wszystkich.
|
||||
@@ -366,7 +356,7 @@ m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter
|
||||
m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_;
|
||||
m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE)
|
||||
m.TamingSummon=[[GREEN]]Summoning complete
|
||||
m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.TamingSummonWolfFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.EffectsTaming7_0=Call of the Wild
|
||||
m.EffectsTaming7_1=Summon a wolf to your side
|
||||
m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with {0} Bones in hand
|
||||
@@ -433,4 +423,9 @@ Guides.Repair=Guide coming soon...
|
||||
Guides.Swords=Guide coming soon...
|
||||
Guides.Taming=Guide coming soon...
|
||||
Guides.Unarmed=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
GodMode.Forbidden=[mcMMO] God Mode not permitted on this world (See Permissions)
|
||||
XPRate.Event = [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x!
|
||||
BlastMining.Boom = [[GRAY]]**BOOM**
|
||||
Party.Forbidden=[mcMMO] Parties not permitted on this world (See Permissions)
|
||||
m.TamingSummonOcelotFailed=[[RED]]You have too many ocelots nearby to summon any more.
|
||||
@@ -1,18 +1,13 @@
|
||||
Combat.WolfExamine=[[GREEN]]*Você examinou um lobo usando Conhecimento de Feras*
|
||||
Combat.WolfShowMaster=[[DARK_GREEN]]O Mestre das Feras \: {0}
|
||||
Combat.Ignition=[[RED]]*IGNIÇAO*
|
||||
Combat.BurningArrowHit=[[DARK_RED]]Você foi atingido por uma flecha flamejante\!
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]Visao turva. Sente Tonturas.
|
||||
Combat.TargetDazed=Alvo foi [[DARK_RED]]Atordoado
|
||||
Combat.WolfNoMaster=[[GRAY]]Esse Animal nao tem um mestre...
|
||||
Combat.WolfHealth=[[GREEN]]Esse animal tem {0} de vida
|
||||
Combat.StruckByGore=[[RED]]*ATINGIDO POR MORDIDA*
|
||||
Combat.Gore=[[GREEN]]*MORDIDA*
|
||||
Combat.ArrowDeflect=[[WHITE]]*DESVIOU A FLECHA*
|
||||
Item.ChimaeraWingFail=*ASA QUIMERA FALHOU\!*
|
||||
Item.ChimaeraWingPass=*ASA QUIMERA*
|
||||
Item.InjuredWait=Você foi ferido recentemente e tem que esperar para usar isto. [[YELLOW]]({0}s)
|
||||
Item.NeedFeathers=[[GRAY]]Você precisa de mais penas...
|
||||
m.mccPartyCommands=[[GREEN]]--COMANDOS DE EQUIPES--
|
||||
m.mccParty=[party name] [[RED]]- Criar/Juntar-se a uma equipe
|
||||
m.mccPartyQ=[[RED]]- Sair da equipe atual
|
||||
@@ -221,10 +216,6 @@ mcPlayerListener.GreenThumb=[[GREEN]]*DEDOS VERDES*
|
||||
mcPlayerListener.GreenThumbFail=[[RED]]*DEDOS VERDES FALHOU*
|
||||
mcPlayerListener.HerbalismSkill=Herbalismo (Herbalism):
|
||||
mcPlayerListener.MiningSkill=Mineraçao (Mining):
|
||||
mcPlayerListener.MyspawnCleared=[[DARK_AQUA]]Ponto de Spawn foi apagado.
|
||||
mcPlayerListener.MyspawnNotExist=[[RED]]Primeiro crie um spawn durmindo na cama.
|
||||
mcPlayerListener.MyspawnSet=[[DARK_AQUA]]Spawn foi gravado neste local.
|
||||
mcPlayerListener.MyspawnTimeNotice=Você precisa esperar {0}m {1}s para usar "myspawn"
|
||||
mcPlayerListener.NoPermission=Nao tem permissao para realizar esta açao.
|
||||
mcPlayerListener.NoSkillNote=[[DARK_GRAY]]Se você nao tem acesso a uma habilidade, ela nao será exibida aqui.
|
||||
mcPlayerListener.NotInParty=[[RED]]Você nao está em nenhuma equipe.
|
||||
@@ -316,8 +307,7 @@ Skills.Disarmed=[[DARK_RED]]Voc
|
||||
m.LVL=[[DARK_GRAY]]LVL: [[GREEN]]{0} [[DARK_AQUA]]XP[[YELLOW]]([[GOLD]]{1}[[YELLOW]]/[[GOLD]]{2}[[YELLOW]])
|
||||
Combat.BeastLore=[[GREEN]]*CONHECIMENTO DE FERAS*
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Dono ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BeastLoreHealthWolfTamed=[[DARK_AQUA]]Health ([[GREEN]]{0}[[DARK_AQUA]]/20)
|
||||
Combat.BeastLoreHealthWolf=[[DARK_AQUA]]Vida ([[GREEN]]{0}[[DARK_AQUA]]/8)
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Health ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
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]]TheYeti [[BLUE]](Project Lead & Developer),[[GOLD]] - [[GREEN]]NuclearW [[BLUE]](Developer),[[GOLD]] - [[GREEN]]GJ [[BLUE]](Developer),[[GOLD]] - [[GREEN]]nossr50 [[BLUE]](Developer & Creator),[[DARK_AQUA]]Useful Links:,[[GOLD]] - [[GREEN]]issues.mcmmo.org[[GOLD]] Bug Reporting,[[GOLD]] - [[GREEN]]#mcmmo @ irc.esper.net[[GOLD]] IRC Chat,[[GOLD]] - [[GREEN]]www.mcmmo.org[[GOLD]] Official Website,[[GOLD]] - [[GREEN]]http://bit.ly/x3Yvry[[GOLD]] Bukkit Forum Thread,[[GOLD]] - [[GREEN]]https://twitter.com/#!/mcmmo_dev[[GOLD]] mcMMO Twitter,[[DARK_AQUA]]Donation Info:
|
||||
Party.Locked=[[RED]]Equipe está trancada, só o líder pode convidar.
|
||||
Party.IsntLocked=[[GRAY]]Equipe nao está trancada
|
||||
@@ -373,7 +363,7 @@ m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter
|
||||
m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_;
|
||||
m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE)
|
||||
m.TamingSummon=[[GREEN]]Summoning complete
|
||||
m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.TamingSummonWolfFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.EffectsTaming7_0=Call of the Wild
|
||||
m.EffectsTaming7_1=Summon a wolf to your side
|
||||
m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with {0} Bones in hand
|
||||
@@ -440,4 +430,9 @@ Guides.Repair=Guide coming soon...
|
||||
Guides.Swords=Guide coming soon...
|
||||
Guides.Taming=Guide coming soon...
|
||||
Guides.Unarmed=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
GodMode.Forbidden=[mcMMO] God Mode not permitted on this world (See Permissions)
|
||||
XPRate.Event = [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x!
|
||||
BlastMining.Boom = [[GRAY]]**BOOM**
|
||||
Party.Forbidden=[mcMMO] Parties not permitted on this world (See Permissions)
|
||||
m.TamingSummonOcelotFailed=[[RED]]You have too many ocelots nearby to summon any more.
|
||||
@@ -1,19 +1,13 @@
|
||||
Combat.WolfExamine=[[GREEN]]**Вы научили Волка использованию "Удара волка"**
|
||||
Combat.WolfExamine=[[GREEN]]**Вы научили Волка использованию "Удара волка"**
|
||||
Combat.WolfShowMaster=[[DARK_GREEN]]Мастер по приручению Волков \: {0}
|
||||
Combat.Ignition=[[RED]]**Вы подожгли противника стрелой!!**
|
||||
Combat.BurningArrowHit=[[DARK_RED]]Вы были поражены горящей стрелой\!
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]Вы истекаете кровью. Кружится голова.
|
||||
Combat.TargetDazed=Ваша цель [[DARK_RED]]Шокирована
|
||||
Combat.WolfNoMaster=[[GRAY]]У этого Волка нет хозяина
|
||||
Combat.WolfHealth=[[GREEN]]У этого Волка {0} Здоровья
|
||||
Combat.StruckByGore=[[RED]]**Окравление неудачно**
|
||||
Combat.Gore=[[GREEN]]**Окравление**
|
||||
Combat.ArrowDeflect=[[WHITE]]**Стрела отскочила**
|
||||
Item.ChimaeraWingFail=**Крылья Химеры не смогли вас унести\!**
|
||||
Item.ChimaeraWingPass=**Крылья Химеры уносят вас...**
|
||||
Item.InjuredWait=Вы ранены и не сможете пока использовать это. [[YELLOW]]({0}s)
|
||||
Item.NeedFeathers=[[GRAY]]Вам нужно больше перьев..
|
||||
m.mccPartyCommands=[[GREEN]]--Групповые команды--
|
||||
m.mccParty=[party name] [[RED]]- Создание группы
|
||||
m.mccPartyQ=[[RED]]- Покиньте текущую группу
|
||||
@@ -216,10 +210,6 @@ mcPlayerListener.GreenThumb=[[GREEN]]**"
|
||||
mcPlayerListener.GreenThumbFail=[[RED]]**"Зеленый фермер" неудался**
|
||||
mcPlayerListener.HerbalismSkill=Травоведение:
|
||||
mcPlayerListener.MiningSkill=Шахтёрство:
|
||||
mcPlayerListener.MyspawnCleared=[[DARK_AQUA]]Ваша кровать убрана.
|
||||
mcPlayerListener.MyspawnNotExist=[[RED]]Сделайте вашу точку появления возле кровати, поспав на кровати.
|
||||
mcPlayerListener.MyspawnSet=[[DARK_AQUA]]Моя точка появления сохранена в этой локации.
|
||||
mcPlayerListener.MyspawnTimeNotice=Вы должны подождать {0}m {1}s чтобы использовать появление около кровати
|
||||
mcPlayerListener.NoPermission=Недостаточные права.
|
||||
mcPlayerListener.NoSkillNote=[[DARK_GRAY]]Если у вас нет доступа к умению, то оно здесь не отобразится.
|
||||
mcPlayerListener.NotInParty=[[RED]]Вы не в группе!
|
||||
@@ -310,8 +300,7 @@ Skills.Disarmed=[[DARK_RED]]
|
||||
m.LVL=[[DARK_GRAY]]Уровень: [[GREEN]]{0} [[DARK_AQUA]]XP[[YELLOW]]([[GOLD]]{1}[[YELLOW]]/[[GOLD]]{2}[[YELLOW]])
|
||||
Combat.BeastLore=[[GREEN]]**Умение "Удар волка" активировано**
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Владелец ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BeastLoreHealthWolfTamed=[[DARK_AQUA]]Здоровья ([[GREEN]]{0}[[DARK_AQUA]]/20)
|
||||
Combat.BeastLoreHealthWolf=[[DARK_AQUA]]Здоровья ([[GREEN]]{0}[[DARK_AQUA]]/8)
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Здоровья ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
Party.Locked=[[RED]]Группа запаролена, только лидер группы может приглашать.
|
||||
Party.IsntLocked=[[GRAY]]Группа разблокирована
|
||||
Party.Unlocked=[[GRAY]]Группа разблокирована
|
||||
@@ -358,7 +347,7 @@ m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter
|
||||
m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_;
|
||||
m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE)
|
||||
m.TamingSummon=[[GREEN]]Summoning complete
|
||||
m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.TamingSummonWolfFailed=[[RED]]You have too many wolves nearby to summon any more.
|
||||
m.EffectsTaming7_0=Call of the Wild
|
||||
m.EffectsTaming7_1=Summon a wolf to your side
|
||||
m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with {0} Bones in hand
|
||||
@@ -425,4 +414,9 @@ Guides.Repair=Guide coming soon...
|
||||
Guides.Swords=Guide coming soon...
|
||||
Guides.Taming=Guide coming soon...
|
||||
Guides.Unarmed=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
Guides.Woodcutting=Guide coming soon...
|
||||
GodMode.Forbidden=[mcMMO] God Mode not permitted on this world (See Permissions)
|
||||
XPRate.Event = [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x!
|
||||
BlastMining.Boom = [[GRAY]]**BOOM**
|
||||
Party.Forbidden=[mcMMO] Parties not permitted on this world (See Permissions)
|
||||
m.TamingSummonOcelotFailed=[[RED]]You have too many ocelots nearby to summon any more.
|
||||
@@ -40,6 +40,7 @@ commands:
|
||||
description: Shows your mcMMO stats and xp
|
||||
mcremove:
|
||||
description: Remove a user from the database
|
||||
permission: mcmmo.tools.mcremove
|
||||
mmoedit:
|
||||
description: Edit the skill values for a user
|
||||
permission: mcmmo.tools.mmoedit
|
||||
@@ -98,7 +99,8 @@ permissions:
|
||||
#Instead of containing mcmmo.defaultsop on its own, it should specify each of mcmmo.defaultsop
|
||||
mcmmo.admin: true
|
||||
mcmmo.tools.*: true
|
||||
mcmmo.chat.adminchat: true
|
||||
mcmmo.chat.adminchat: true
|
||||
mcmmo.repair.arcanebypass: true
|
||||
mcmmo.defaults:
|
||||
default: true
|
||||
description: mcmmo permisions that default to true
|
||||
@@ -116,50 +118,228 @@ permissions:
|
||||
mcmmo.chat.adminchat: true
|
||||
mcmmo.admin: true
|
||||
mcmmo.tools.*: true
|
||||
mcmmo.repair.arcanebypass: true
|
||||
mcmmo.admin:
|
||||
description: Allows access to mmoupdate and other sensitive commands
|
||||
mcmmo.repair.arcanebypass:
|
||||
description: Allows user to bypass Arcane Repair so he will never lose enchantments
|
||||
mcmmo.tools.*:
|
||||
description: Implies all mcmmo.tools permissions.
|
||||
children:
|
||||
mcmmo.tools.mcrefresh: true
|
||||
mcmmo.tools.mmoedit: true
|
||||
mcmmo.tools.mcgod: true
|
||||
mcmmo.tools.mcgod: true
|
||||
mcmmo.tools.mcremove: true
|
||||
mcmmo.tools.mcrefresh:
|
||||
description: Allows access to mcrefresh command
|
||||
mcmmo.tools.mmoedit:
|
||||
description: Allows access to mmoedit command
|
||||
mcmmo.tools.mcgod:
|
||||
description: Allows access to mcgod command
|
||||
description: Allows access to mcgod command
|
||||
mcmmo.tools.mcremove:
|
||||
decription: Allows access to mcremove command
|
||||
mcmmo.ability.*:
|
||||
description: Implies all mcmmo.ability permissions.
|
||||
children:
|
||||
mcmmo.ability.herbalism: true
|
||||
mcmmo.ability.excavation: true
|
||||
mcmmo.ability.unarmed: true
|
||||
mcmmo.ability.mining: true
|
||||
mcmmo.ability.axes: true
|
||||
mcmmo.ability.swords: true
|
||||
mcmmo.ability.woodcutting: true
|
||||
mcmmo.ability.herbalism:
|
||||
description: Allows access to Green Terra ability
|
||||
mcmmo.ability.excavation:
|
||||
description: Allows access to Giga Drill Breaker ability
|
||||
mcmmo.ability.unarmed:
|
||||
description: Allows access to Berserker ability
|
||||
mcmmo.ability.mining:
|
||||
description: Allows access to Super Breaker ability
|
||||
mcmmo.ability.axes:
|
||||
description: Allows access to Skull Splitter ability
|
||||
mcmmo.ability.swords:
|
||||
description: Allows access to Serrated Strikes ability
|
||||
mcmmo.ability.woodcutting:
|
||||
description: Allows access to Tree Feller ability
|
||||
mcmmo.ability.taming.*: true
|
||||
mcmmo.ability.fishing.*: true
|
||||
mcmmo.ability.mining.*: true
|
||||
mcmmo.ability.woodcutting.*: true
|
||||
mcmmo.ability.repair.*: true
|
||||
mcmmo.ability.unarmed.*: true
|
||||
mcmmo.ability.archery.*: true
|
||||
mcmmo.ability.herbalism.*: true
|
||||
mcmmo.ability.excavation.*: true
|
||||
mcmmo.ability.swords.*: true
|
||||
mcmmo.ability.axes.*: true
|
||||
mcmmo.ability.acrobatics.*: true
|
||||
mcmmo.ability.blastmining.*: true
|
||||
mcmmo.ability.taming.*:
|
||||
description: Allows access to all Taming abilities
|
||||
children:
|
||||
mcmmo.ability.taming.fastfoodservice: true
|
||||
mcmmo.ability.taming.sharpenedclaws: true
|
||||
mcmmo.ability.taming.gore: true
|
||||
mcmmo.ability.taming.callofthewild: true
|
||||
mcmmo.ability.taming.environmentallyaware: true
|
||||
mcmmo.ability.taming.thickfur: true
|
||||
mcmmo.ability.taming.shockproof: true
|
||||
mcmmo.ability.taming.beastlore: true
|
||||
mcmmo.ability.taming.fastfoodservice:
|
||||
description: Allows access to the Fast Food Service ability
|
||||
mcmmo.ability.taming.sharpenedclaws:
|
||||
description: Allows access to the Sharpened Claws ability
|
||||
mcmmo.ability.taming.gore:
|
||||
description: Allows access to the Gore ability
|
||||
mcmmo.ability.taming.callofthewild:
|
||||
description: Allows access to the Call of the Wild ability
|
||||
mcmmo.ability.taming.environmentallyaware:
|
||||
description: Allows access to the Environmentally Aware ability
|
||||
mcmmo.ability.taming.thickfur:
|
||||
description: Allows access to the Thick Fur ability
|
||||
mcmmo.ability.taming.shockproof:
|
||||
description: Allows access to the Shock Proof ability
|
||||
mcmmo.ability.taming.beastlore:
|
||||
description: Allows access to the Beast Lore ability
|
||||
mcmmo.ability.fishing.*:
|
||||
description: Allows access to all Fishing abilities
|
||||
children:
|
||||
mcmmo.ability.fishing.shakemob: true
|
||||
mcmmo.ability.fishing.shakemob:
|
||||
description: Allows access to the Shake Mob ability
|
||||
mcmmo.ability.mining.*:
|
||||
description: Allows access to all Mining abilities
|
||||
children:
|
||||
mcmmo.ability.mining.superbreaker: true
|
||||
mcmmo.ability.mining.doubledrops: true
|
||||
mcmmo.ability.mining.superbreaker:
|
||||
description: Allows access to the Super Breaker ability
|
||||
mcmmo.ability.mining.doubledrops:
|
||||
description: Allows double drop chance when mining
|
||||
mcmmo.ability.woodcutting.*:
|
||||
description: Allows access to all Woodcutting abilities
|
||||
children:
|
||||
mcmmo.ability.woodcutting.treefeller: true
|
||||
mcmmo.ability.woodcutting.leafblower: true
|
||||
mcmmo.ability.woodcutting.doubledrops: true
|
||||
mcmmo.ability.woodcutting.treefeller:
|
||||
description: Allows access to Tree Feller ability
|
||||
mcmmo.ability.woodcutting.leafblower:
|
||||
description: Allows access to Leaf Blower ability
|
||||
mcmmo.ability.woodcutting.doubledrops:
|
||||
description: Allows double drop chance when woodcutting
|
||||
mcmmo.ability.repair.*:
|
||||
description: Allows access to all Repair abilities
|
||||
children:
|
||||
mcmmo.ability.repair.repairbonus: true
|
||||
mcmmo.ability.repair.arcaneforging: true
|
||||
mcmmo.ability.repair.stonerepair: true
|
||||
mcmmo.ability.repair.ironrepair: true
|
||||
mcmmo.ability.repair.goldrepair: true
|
||||
mcmmo.ability.repair.diamondrepair: true
|
||||
mcmmo.ability.repair.armorrepair: true
|
||||
mcmmo.ability.repair.toolrepair: true
|
||||
mcmmo.ability.repair.repairbonus:
|
||||
description: Allows access to Super Repair bonus
|
||||
mcmmo.ability.repair.arcaneforging:
|
||||
description: Allows access to the Arcane Forging ability
|
||||
mcmmo.ability.repair.stonerepair:
|
||||
description: Allows ability to repair Stone tools
|
||||
mcmmo.ability.repair.ironrepair:
|
||||
description: Allows ability to repair Iron tools & armor
|
||||
mcmmo.ability.repair.goldrepair:
|
||||
description: Allows ability to repair Gold tools & armor
|
||||
mcmmo.ability.repair.diamondrepair:
|
||||
description: Allows ability to repair Diamond tools & armor
|
||||
mcmmo.ability.repair.armorrepair:
|
||||
description: Allows ability to repair armor
|
||||
mcmmo.ability.repair.toolrepair:
|
||||
description: Allows ability to repair tools
|
||||
mcmmo.ability.unarmed.*:
|
||||
description: Allows access to all Unarmed abilities
|
||||
children:
|
||||
mcmmo.ability.unarmed.bonusdamage: true
|
||||
mcmmo.ability.unarmed.disarm: true
|
||||
mcmmo.ability.unarmed.berserk: true
|
||||
mcmmo.ability.unarmed.deflect: true
|
||||
mcmmo.ability.unarmed.bonusdamage:
|
||||
description: Allows bonus damage from Unarmed
|
||||
mcmmo.ability.unarmed.disarm:
|
||||
description: Allows access to the Disarm ability
|
||||
mcmmo.ability.unarmed.berserk:
|
||||
description: Allows access to the Berserker ability
|
||||
mcmmo.ability.unarmed.deflect:
|
||||
description: Allows access to the Deflect ability
|
||||
mcmmo.ability.archery.*:
|
||||
description: Allows access to all Archery abilities
|
||||
children:
|
||||
mcmmo.ability.archery.trackarrows: true
|
||||
mcmmo.ability.archery.ignition: true
|
||||
mcmmo.ability.archery.daze: true
|
||||
mcmmo.ability.archery.trackarrows:
|
||||
description: Allows tracking & retrieval of arrows
|
||||
mcmmo.ability.archery.ignition:
|
||||
description: Allows access to the Ignition ability
|
||||
mcmmo.ability.archery.daze:
|
||||
description: Allows access to the Daze ability
|
||||
mcmmo.ability.herbalism.*:
|
||||
description: Allows access to all Herbalism abilities
|
||||
children:
|
||||
mcmmo.ability.herbalism.doubledrops: true
|
||||
mcmmo.ability.herbalism.greenterra: true
|
||||
mcmmo.ability.herbalism.greenthumbblocks: true
|
||||
mcmmo.ability.herbalism.greenthumbwheat: true
|
||||
mcmmo.ability.herbalism.doubledrops:
|
||||
description: Allows double drop chance from Herbalism
|
||||
mcmmo.ability.herbalism.greenterra:
|
||||
description: Allows access to the Green Terra ability
|
||||
mcmmo.ability.herbalism.greenthumbblocks:
|
||||
description: Allows access to the Green Thumb ability for blocks
|
||||
mcmmo.ability.herbalism.greenthumbwheat:
|
||||
description: Allows access to the Green Thumb ability for wheat
|
||||
mcmmo.ability.excavation.*:
|
||||
description: Allows access to all Excavation abilities
|
||||
children:
|
||||
mcmmo.ability.excavation.gigadrillbreaker: true
|
||||
mcmmo.ability.excavation.treasures: true
|
||||
mcmmo.ability.excavation.gigadrillbreaker:
|
||||
description: Allows access to the Giga Drill Breaker ability
|
||||
mcmmo.ability.excavation.treasures:
|
||||
description: Allows treasure drops from Excavation
|
||||
mcmmo.ability.swords.*:
|
||||
description: Allows access to all Swords abilities
|
||||
children:
|
||||
mcmmo.ability.swords.bleed: true
|
||||
mcmmo.ability.swords.serratedstrikes: true
|
||||
mcmmo.ability.swords.counterattack: true
|
||||
mcmmo.ability.swords.bleed:
|
||||
description: Allows access to the Bleed ability
|
||||
mcmmo.ability.swords.serratedstrikes:
|
||||
description: Allows access to the Serrated Strikes ability
|
||||
mcmmo.ability.swords.counterattack:
|
||||
description: Allows access to the Counter Attack ability
|
||||
mcmmo.ability.axes.*:
|
||||
description: Allows access to all Axes abilities
|
||||
children:
|
||||
mcmmo.ability.axes.skullsplitter: true
|
||||
mcmmo.ability.axes.bonusdamage: true
|
||||
mcmmo.ability.axes.critalhit: true
|
||||
mcmmo.ability.axes.impact: true
|
||||
mcmmo.ability.axes.skullsplitter:
|
||||
description: Allows access to the Skull Splitter ability
|
||||
mcmmo.ability.axes.bonusdamage:
|
||||
description: Allows bonus damage from Axes
|
||||
mcmmo.ability.axes.criticalhit:
|
||||
description: Allows access to the Critical Hit ability
|
||||
mcmmo.ability.axes.skullsplitter:
|
||||
description: Allows access to the Impact ability
|
||||
mcmmo.ability.acrobatics.*:
|
||||
description: Allows access to all Acrobatics abilities
|
||||
children:
|
||||
mcmmo.ability.acrobatics.roll: true
|
||||
mcmmo.ability.acrobatics.gracefulroll: true
|
||||
mcmmo.ability.acrobatics.dodge: true
|
||||
mcmmo.ability.acrobatics.roll:
|
||||
description: Allows access to the Roll ability
|
||||
mcmmo.ability.acrobatics.gracefulroll:
|
||||
description: Allows access to the Graceful Roll ability
|
||||
mcmmo.ability.acrobatics.dodge:
|
||||
description: Allows access to the Dodge ability
|
||||
mcmmo.ability.blastmining.*:
|
||||
description: Allows access to all Blast Mining abilities
|
||||
children:
|
||||
mcmmo.ability.blastmining.biggerbombs: true
|
||||
mcmmo.ability.blastmining.demolitionsexpertise: true
|
||||
mcmmo.ability.blastmining.biggerbombs:
|
||||
description: Allows access to the Bigger Bombs ability
|
||||
mcmmo.ability.blastmining.demolitionsexpertise:
|
||||
description: Allows access to the Demolitions Expertise ability
|
||||
mcmmo.item.*:
|
||||
description: Implies all mcmmo.item permissions.
|
||||
children:
|
||||
mcmmo.item.chimaerawing: true
|
||||
mcmmo.item.chimaerawing:
|
||||
description: Allows use of Chimaera Wing item
|
||||
description: Allows use of Chimaera Wing item
|
||||
mcmmo.motd:
|
||||
description: Allows access to the motd
|
||||
mcmmo.commands.*:
|
||||
@@ -202,6 +382,8 @@ permissions:
|
||||
mcmmo.skills.axes: true
|
||||
mcmmo.skills.acrobatics: true
|
||||
mcmmo.skills.blastmining: true
|
||||
mcmmo.skills.fishing:
|
||||
description: Allows access to the Fishing skill
|
||||
mcmmo.skills.taming:
|
||||
description: Allows access to the Taming skill
|
||||
mcmmo.skills.mining:
|
||||
|
||||
Reference in New Issue
Block a user