mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-18 01:42:32 +01:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e04e437e3 | ||
|
|
30e1d3fff3 | ||
|
|
bada2f5d0d | ||
|
|
1edc12af3b | ||
|
|
f9a73c38d8 | ||
|
|
ccdab96650 | ||
|
|
8deac175d1 | ||
|
|
d0b766a2d3 | ||
|
|
65692f2a83 | ||
|
|
d0b0786284 | ||
|
|
87ac1002de | ||
|
|
c51fde7f1f | ||
|
|
0a6735110f | ||
|
|
8a284c50a2 | ||
|
|
09431ef27c | ||
|
|
9f9de86d21 | ||
|
|
d9c04a09ba |
@@ -21,6 +21,9 @@ Version 1.4.08-dev
|
||||
+ Added new experience bonus perk 'mcmmo.perks.xp.customboost.<skillname>' multiplies incoming XP by the boost amount defined in the experience config
|
||||
+ Added Ender Dragon, Wither, and Witch to combat experience multipliers - they do not give XP by default
|
||||
+ Added support for multiple mod config files, naming can be done as either armor.<modname>.yml or <modname>.armor.yml
|
||||
= Fixed bug with updating (very) old user data.
|
||||
= Fixed bug with checking maximum durability of mod items.
|
||||
= Fixed exploit involving Call of The Wild.
|
||||
= Fixed bug where LeafBlower permissions were ignored
|
||||
= Fixed bug with toggle commands not properly displaying the success message.
|
||||
= Fixed IllegalArgumentException caused by an empty Fishing treasure category
|
||||
|
||||
@@ -47,5 +47,6 @@ Required Libraries:
|
||||
* JUnit
|
||||
* EMetrics
|
||||
* Bukkit
|
||||
* TagAPI
|
||||
|
||||
http://dev.bukkit.org/server-mods/mcmmo for more up to date information.
|
||||
|
||||
10
pom.xml
10
pom.xml
@@ -116,6 +116,10 @@
|
||||
<id>Plugin MetricsExtension</id>
|
||||
<url>http://repo.turt2live.com</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>TagAPI</id>
|
||||
<url>http://repo.kitteh.org/content/repositories/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -136,6 +140,12 @@
|
||||
<artifactId>MetricsExtension</artifactId>
|
||||
<version>0.0.5-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kitteh</groupId>
|
||||
<artifactId>tagapi</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
|
||||
@@ -30,7 +30,10 @@ public class McmmoCommand implements CommandExecutor {
|
||||
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "gjmcferrin@gmail.com" + ChatColor.GOLD + " Paypal");
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
|
||||
if (Permissions.showversion(sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
|
||||
}
|
||||
|
||||
mcMMO.getHolidayManager().anniversaryCheck(sender);
|
||||
return true;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.gmail.nossr50.config.mods;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ModManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ModManager;
|
||||
|
||||
public class ArmorConfigManager {
|
||||
public ArmorConfigManager(mcMMO plugin) {
|
||||
Pattern middlePattern = Pattern.compile("armor\\.(?:.+)\\.yml");
|
||||
@@ -15,7 +15,7 @@ public class ArmorConfigManager {
|
||||
ModManager modManager = mcMMO.getModManager();
|
||||
|
||||
if (!vanilla.exists()) {
|
||||
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "armor.default.yml", false);
|
||||
plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "armor.default.yml", false);
|
||||
}
|
||||
|
||||
for (String fileName : dataFolder.list()) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.gmail.nossr50.config.mods;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ModManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ModManager;
|
||||
|
||||
public class BlockConfigManager {
|
||||
public BlockConfigManager(mcMMO plugin) {
|
||||
Pattern middlePattern = Pattern.compile("blocks\\.(?:.+)\\.yml");
|
||||
@@ -15,7 +15,7 @@ public class BlockConfigManager {
|
||||
ModManager modManager = mcMMO.getModManager();
|
||||
|
||||
if (!vanilla.exists()) {
|
||||
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "blocks.default.yml", false);
|
||||
plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "blocks.default.yml", false);
|
||||
}
|
||||
|
||||
for (String fileName : dataFolder.list()) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.gmail.nossr50.config.mods;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ModManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ModManager;
|
||||
|
||||
public class EntityConfigManager {
|
||||
public EntityConfigManager(mcMMO plugin) {
|
||||
Pattern middlePattern = Pattern.compile("entities\\.(?:.+)\\.yml");
|
||||
@@ -15,7 +15,7 @@ public class EntityConfigManager {
|
||||
ModManager modManager = mcMMO.getModManager();
|
||||
|
||||
if (!vanilla.exists()) {
|
||||
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "entities.default.yml", false);
|
||||
plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "entities.default.yml", false);
|
||||
}
|
||||
|
||||
for (String fileName : dataFolder.list()) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.gmail.nossr50.config.mods;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ModManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ModManager;
|
||||
|
||||
public class ToolConfigManager {
|
||||
public ToolConfigManager(mcMMO plugin) {
|
||||
Pattern middlePattern = Pattern.compile("tools\\.(?:.+)\\.yml");
|
||||
@@ -15,7 +15,7 @@ public class ToolConfigManager {
|
||||
ModManager modManager = mcMMO.getModManager();
|
||||
|
||||
if (!vanilla.exists()) {
|
||||
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "tools.default.yml", false);
|
||||
plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "tools.default.yml", false);
|
||||
}
|
||||
|
||||
for (String fileName : dataFolder.list()) {
|
||||
|
||||
@@ -96,6 +96,10 @@ public class RepairConfig extends ConfigLoader {
|
||||
// Maximum Durability
|
||||
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : (short) config.getInt("Repairables." + key + ".MaximumDurability"));
|
||||
|
||||
if (maximumDurability <= 0) {
|
||||
maximumDurability = (short) config.getInt("Repairables." + key + ".MaximumDurability");
|
||||
}
|
||||
|
||||
if (maximumDurability <= 0) {
|
||||
reason.add("Maximum durability of " + key + " must be greater than 0!");
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@@ -26,6 +28,7 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
private final HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>();
|
||||
@@ -604,7 +607,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
|
||||
// Length checks depend on last character being ':'
|
||||
if (line.charAt(line.length() - 1) != ':') {
|
||||
line = line + ":";
|
||||
line = line.concat(":");
|
||||
}
|
||||
String[] character = line.split(":");
|
||||
|
||||
@@ -621,29 +624,33 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
|
||||
String oldVersion = null;
|
||||
|
||||
if (character.length <= 33) {
|
||||
// Introduction of HUDType
|
||||
// Version 1.1.06
|
||||
// commit 78f79213cdd7190cd11ae54526f3b4ea42078e8a
|
||||
line = line.concat(" :");
|
||||
character = line.split(":");
|
||||
oldVersion = "1.1.06";
|
||||
}
|
||||
|
||||
if (!character[33].isEmpty()) {
|
||||
// Removal of Spout Support
|
||||
// Version 1.4.07-dev2
|
||||
// commit 7bac0e2ca5143bce84dc160617fed97f0b1cb968
|
||||
line = line.replace(character[33], "");
|
||||
oldVersion = "1.4.07";
|
||||
if (oldVersion == null) {
|
||||
oldVersion = "1.4.07";
|
||||
}
|
||||
}
|
||||
|
||||
// If they're valid, rewrite them to the file.
|
||||
if (character.length > 40) {
|
||||
if (character.length == 41) {
|
||||
writer.append(line).append("\r\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
StringBuilder newLine = new StringBuilder(line);
|
||||
|
||||
if (character.length <= 33) {
|
||||
// Introduction of HUDType
|
||||
// Version 1.1.06
|
||||
// commit 78f79213cdd7190cd11ae54526f3b4ea42078e8a
|
||||
newLine.append(":");
|
||||
oldVersion = "1.1.06";
|
||||
}
|
||||
if (character.length <= 35) {
|
||||
// Introduction of Fishing
|
||||
// Version 1.2.00
|
||||
@@ -682,7 +689,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
oldVersion = "1.4.06";
|
||||
}
|
||||
}
|
||||
if (character.length <= 40) {
|
||||
if (character.length <= 39) {
|
||||
// Addition of Alchemy
|
||||
// Version 1.4.08
|
||||
newLine.append("0").append(":");
|
||||
@@ -692,6 +699,46 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any blanks that shouldn't be there, and validate the other fields
|
||||
String[] newCharacter = newLine.toString().split(":");
|
||||
boolean corrupted = false;
|
||||
|
||||
for (int i = 0; i < newCharacter.length; i++) {
|
||||
if (newCharacter[i].isEmpty() && !(i == 2 || i == 3 || i == 23 || i == 33)) {
|
||||
corrupted = true;
|
||||
|
||||
if (newCharacter.length != 41) {
|
||||
newCharacter = (String[]) ArrayUtils.remove(newCharacter, i);
|
||||
}
|
||||
else {
|
||||
if (i == 37) {
|
||||
newCharacter[i] = String.valueOf(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
else if (i == 38) {
|
||||
newCharacter[i] = Config.getInstance().getMobHealthbarDefault().toString();
|
||||
}
|
||||
else {
|
||||
newCharacter[i] = "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isInt(newCharacter[i]) && i == 38) {
|
||||
corrupted = true;
|
||||
newCharacter[i] = Config.getInstance().getMobHealthbarDefault().toString();
|
||||
}
|
||||
|
||||
if (!StringUtils.isInt(newCharacter[i]) && !(i == 0 || i == 2 || i == 3 || i == 23 || i == 33 || i == 38)) {
|
||||
corrupted = true;
|
||||
newCharacter[i] = "0";
|
||||
}
|
||||
}
|
||||
|
||||
if (corrupted) {
|
||||
mcMMO.p.debug("Updating corrupted database line for player " + newCharacter[0]);
|
||||
newLine = new StringBuilder(org.apache.commons.lang.StringUtils.join(newCharacter, ":"));
|
||||
}
|
||||
|
||||
if (oldVersion != null) {
|
||||
mcMMO.p.debug("Updating database line for player " + character[0] + " from before version " + oldVersion);
|
||||
}
|
||||
|
||||
@@ -91,6 +91,8 @@ public class McMMOPlayer {
|
||||
private boolean isUsingUnarmed;
|
||||
private final FixedMetadataValue playerMetadata;
|
||||
|
||||
private String nameTag;
|
||||
|
||||
public McMMOPlayer(Player player) {
|
||||
String playerName = player.getName();
|
||||
|
||||
@@ -949,4 +951,12 @@ public class McMMOPlayer {
|
||||
public FixedMetadataValue getPlayerMetadata() {
|
||||
return playerMetadata;
|
||||
}
|
||||
|
||||
public String getNameTag() {
|
||||
return nameTag;
|
||||
}
|
||||
|
||||
public void setNameTag(String nameTag) {
|
||||
this.nameTag = nameTag;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(defender) || !defender.isValid() || !(defender instanceof LivingEntity)) {
|
||||
if (Misc.isNPCEntity(defender) || !defender.isValid() || !(defender instanceof LivingEntity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
59
src/main/java/com/gmail/nossr50/listeners/TagListener.java
Normal file
59
src/main/java/com/gmail/nossr50/listeners/TagListener.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
|
||||
import org.kitteh.tag.AsyncPlayerReceiveNameTagEvent;
|
||||
|
||||
public class TagListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onAsyncPlayerReceiveNameTag(AsyncPlayerReceiveNameTagEvent event) {
|
||||
Player player = event.getNamedPlayer();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player, true);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String tag = event.getTag();
|
||||
String colorlessTag = ChatColor.stripColor(tag);
|
||||
|
||||
if (colorlessTag.equals(tag)) {
|
||||
mcMMOPlayer.setNameTag(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (colorlessTag.equals(player.getName()) && (mcMMOPlayer.getNameTag() == null || !mcMMOPlayer.getNameTag().equals(tag))) {
|
||||
mcMMOPlayer.setNameTag(tag);
|
||||
ScoreboardManager.tagUpdate(player);
|
||||
}
|
||||
|
||||
/*
|
||||
mbax:
|
||||
With TagAPI, you can set the name tag over anybody's head to any value.
|
||||
You can have five people with the name 'Notch' (And one named 'notch' for
|
||||
good measure). That makes it difficult to properly utilize the scoreboard
|
||||
feature to match a changed name to a score for below name objective display.
|
||||
|
||||
Additionally, every single player can be seeing a different username over
|
||||
the head of the same player. So even if you're just trying to detect colored usernames
|
||||
you could be encountering 16 different colors before a username (15, generally, who does white?)
|
||||
and maybe some format codes as well. The Scoreboard API doesn't support per-player setting of names,
|
||||
so you'd have to add an entry for each.
|
||||
|
||||
At best, what you could do is listen to TagAPI's event on MONITOR priority and track all the names.
|
||||
Check if a set name is the same as their actual name, sans colors. If yes, store that and each time
|
||||
you update a player's below-name objective, update an OfflinePlayer with that colored version as well.
|
||||
This is not a good idea if the objective will ever change DisplaySlot, particularly if it goes to the
|
||||
sidebar, since you'll then need to clear the color ones.
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,6 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.config.mods.ArmorConfigManager;
|
||||
import com.gmail.nossr50.config.mods.BlockConfigManager;
|
||||
import com.gmail.nossr50.config.mods.EntityConfigManager;
|
||||
import com.gmail.nossr50.config.mods.ToolConfigManager;
|
||||
import com.gmail.nossr50.util.ModManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
@@ -19,6 +14,10 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.HiddenConfig;
|
||||
import com.gmail.nossr50.config.mods.ArmorConfigManager;
|
||||
import com.gmail.nossr50.config.mods.BlockConfigManager;
|
||||
import com.gmail.nossr50.config.mods.EntityConfigManager;
|
||||
import com.gmail.nossr50.config.mods.ToolConfigManager;
|
||||
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
||||
import com.gmail.nossr50.config.skills.repair.RepairConfigManager;
|
||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||
@@ -29,6 +28,7 @@ import com.gmail.nossr50.listeners.EntityListener;
|
||||
import com.gmail.nossr50.listeners.InventoryListener;
|
||||
import com.gmail.nossr50.listeners.PlayerListener;
|
||||
import com.gmail.nossr50.listeners.SelfListener;
|
||||
import com.gmail.nossr50.listeners.TagListener;
|
||||
import com.gmail.nossr50.listeners.WorldListener;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.metrics.MetricsManager;
|
||||
@@ -48,6 +48,7 @@ import com.gmail.nossr50.util.ChimaeraWing;
|
||||
import com.gmail.nossr50.util.HolidayManager;
|
||||
import com.gmail.nossr50.util.LogFilter;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.ModManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManager;
|
||||
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManagerFactory;
|
||||
@@ -89,6 +90,7 @@ public class mcMMO extends JavaPlugin {
|
||||
private static boolean healthBarPluginEnabled;
|
||||
private static boolean noCheatPlusPluginEnabled;
|
||||
private static boolean compatNoCheatPlusPluginEnabled;
|
||||
private static boolean tagapiPluginEnabled;
|
||||
private static boolean mcpcEnabled;
|
||||
|
||||
// Config Validation Check
|
||||
@@ -130,6 +132,7 @@ public class mcMMO extends JavaPlugin {
|
||||
healthBarPluginEnabled = getServer().getPluginManager().getPlugin("HealthBar") != null;
|
||||
noCheatPlusPluginEnabled = getServer().getPluginManager().getPlugin("NoCheatPlus") != null;
|
||||
compatNoCheatPlusPluginEnabled = getServer().getPluginManager().getPlugin("CompatNoCheatPlus") != null;
|
||||
tagapiPluginEnabled = getServer().getPluginManager().getPlugin("TagAPI") != null && checkTagVersion();
|
||||
|
||||
setupFilePaths();
|
||||
|
||||
@@ -445,6 +448,10 @@ public class mcMMO extends JavaPlugin {
|
||||
pluginManager.registerEvents(new InventoryListener(this), this);
|
||||
pluginManager.registerEvents(new SelfListener(), this);
|
||||
pluginManager.registerEvents(new WorldListener(this), this);
|
||||
|
||||
if (tagapiPluginEnabled) {
|
||||
pluginManager.registerEvents(new TagListener(), this);
|
||||
}
|
||||
}
|
||||
|
||||
private void registerCustomRecipes() {
|
||||
@@ -509,4 +516,17 @@ public class mcMMO extends JavaPlugin {
|
||||
getLogger().info("To enable, set Mods.Entity_Mods_Enabled to TRUE in config.yml.");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkTagVersion() {
|
||||
try {
|
||||
Class.forName("org.kitteh.tag.AsyncPlayerReceiveNameTagEvent");
|
||||
}
|
||||
catch (final ClassNotFoundException e) {
|
||||
getLogger().info("This TagAPI version does not have AsyncPlayerReceiveNameTagEvent");
|
||||
getLogger().info("Please update TagAPI to ensure full compatibility with mcMMO");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public final class AlchemyPotionBrewer {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
ItemStack item = inventory.getItem(i).clone();
|
||||
ItemStack item = inventory.getItem(i);
|
||||
|
||||
if (isEmpty(item) || item.getType() == Material.GLASS_BOTTLE || !PotionConfig.getInstance().isValidPotion(item)) {
|
||||
continue;
|
||||
|
||||
@@ -90,7 +90,15 @@ public class RepairManager extends SkillManager {
|
||||
Material repairMaterial = repairable.getRepairMaterial();
|
||||
byte repairMaterialMetadata = repairable.getRepairMaterialMetadata();
|
||||
ItemStack toRemove = new MaterialData(repairMaterial, repairMaterialMetadata).toItemStack(1);
|
||||
|
||||
short startDurability = item.getDurability();
|
||||
|
||||
// Do not repair if at full durability
|
||||
if (startDurability <= 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.FullDurability"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if they have the proper material to repair with
|
||||
if (!inventory.contains(repairMaterial)) {
|
||||
String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairMaterial));
|
||||
@@ -103,14 +111,6 @@ public class RepairManager extends SkillManager {
|
||||
return;
|
||||
}
|
||||
|
||||
short startDurability = item.getDurability();
|
||||
|
||||
// Do not repair if at full durability
|
||||
if (startDurability <= 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.FullDurability"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not repair stacked items
|
||||
if (item.getAmount() != 1) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.StackedItems"));
|
||||
|
||||
@@ -260,7 +260,7 @@ public class TamingManager extends SkillManager {
|
||||
}
|
||||
}
|
||||
|
||||
player.setItemInHand(new ItemStack(heldItem.getType(), heldItemAmount - summonAmount));
|
||||
player.setItemInHand(heldItemAmount == summonAmount ? null : new ItemStack(heldItem.getType(), heldItemAmount - summonAmount));
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,9 @@ public final class Motd {
|
||||
* @param version Plugin version
|
||||
*/
|
||||
public static void displayVersion(Player player, String version) {
|
||||
player.sendMessage(LocaleLoader.getString("MOTD.Version", version));
|
||||
if (Permissions.showversion(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("MOTD.Version", version));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@ public final class Permissions {
|
||||
public static boolean mobHealthDisplay(Permissible permissible) { return permissible.hasPermission("mcmmo.mobhealthdisplay"); }
|
||||
public static boolean updateNotifications(Permissible permissible) {return permissible.hasPermission("mcmmo.tools.updatecheck"); }
|
||||
public static boolean chimaeraWing(Permissible permissible) { return permissible.hasPermission("mcmmo.item.chimaerawing"); }
|
||||
public static boolean showversion(Permissible permissible) { return permissible.hasPermission("mcmmo.showversion"); }
|
||||
|
||||
/* BYPASS */
|
||||
public static boolean hardcoreBypass(Permissible permissible) { return permissible.hasPermission("mcmmo.bypass.hardcoremode"); }
|
||||
|
||||
@@ -224,6 +224,15 @@ public class ScoreboardManager {
|
||||
}
|
||||
}
|
||||
|
||||
// Called by internal TagAPI event listener
|
||||
public static void tagUpdate(Player player) {
|
||||
String playerName = player.getName();
|
||||
|
||||
if (Config.getInstance().getPowerLevelTagsEnabled() && !dirtyPowerLevels.contains(playerName)) {
|
||||
dirtyPowerLevels.add(playerName);
|
||||
}
|
||||
}
|
||||
|
||||
// **** Setup methods **** //
|
||||
|
||||
public static void enablePlayerSkillScoreboard(Player player, SkillType skill) {
|
||||
@@ -342,6 +351,10 @@ public class ScoreboardManager {
|
||||
|
||||
for (ScoreboardWrapper wrapper : PLAYER_SCOREBOARDS.values()) {
|
||||
wrapper.updatePowerLevel(player, power);
|
||||
|
||||
if (mcMMOPlayer.getNameTag() != null) {
|
||||
wrapper.updatePowerLevel(mcMMO.p.getServer().getOfflinePlayer(mcMMOPlayer.getNameTag()), power);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
@@ -558,4 +559,8 @@ public class ScoreboardWrapper {
|
||||
public void updatePowerLevel(Player player, int newPowerLevel) {
|
||||
powerObjective.getScore(player).setScore(newPowerLevel);
|
||||
}
|
||||
|
||||
public void updatePowerLevel(OfflinePlayer offlinePlayer, int newPowerLevel) {
|
||||
powerObjective.getScore(offlinePlayer).setScore(newPowerLevel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ public final class CombatUtils {
|
||||
if (attacker instanceof Player && entityType == EntityType.PLAYER) {
|
||||
Player player = (Player) attacker;
|
||||
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1937,6 +1937,9 @@ permissions:
|
||||
children:
|
||||
mcmmo.ability.woodcutting.all: true
|
||||
mcmmo.commands.woodcutting: true
|
||||
mcmmo.showversion:
|
||||
default: true
|
||||
description: Show mcMMO version number in /mcmmo and motd
|
||||
mcmmo.tools.*:
|
||||
default: false
|
||||
description: Implies all mcmmo.tools permissions.
|
||||
|
||||
@@ -363,7 +363,7 @@ Potions:
|
||||
Children:
|
||||
FERMENTED_SPIDER_EYE: 8236
|
||||
REDSTONE: 8260
|
||||
SULPHUR: 16452
|
||||
SULPHUR: 16420
|
||||
8260: # Potion of Poison Extended
|
||||
Children:
|
||||
FERMENTED_SPIDER_EYE: 8204
|
||||
@@ -633,16 +633,16 @@ Potions:
|
||||
16388: # Splash Potion of Poison
|
||||
Children:
|
||||
FERMENTED_SPIDER_EYE: 16396
|
||||
GLOWSTONE_DUST: 16452
|
||||
GLOWSTONE_DUST: 16420
|
||||
REDSTONE: 16452
|
||||
16452: # Splash Potion of Poison II
|
||||
16420: # Splash Potion of Poison II
|
||||
Children:
|
||||
FERMENTED_SPIDER_EYE: 16428
|
||||
REDSTONE: 16452
|
||||
16452: # Splash Potion of Poison Extended
|
||||
Children:
|
||||
FERMENTED_SPIDER_EYE: 16396
|
||||
GLOWSTONE_DUST: 16452
|
||||
GLOWSTONE_DUST: 16420
|
||||
|
||||
21504: # Splash Potion of Decay
|
||||
Effects: ["WITHER 0 338"]
|
||||
|
||||
Reference in New Issue
Block a user