mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
Move all miscellaneous Spout code to a single location.
This commit is contained in:
@ -40,6 +40,30 @@ public class Repair {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getAnvilMessage(int blockId) {
|
||||
if (blockId == repairAnvilId) {
|
||||
return LocaleLoader.getString("Repair.Listener.Anvil");
|
||||
}
|
||||
|
||||
if (blockId == salvageAnvilId) {
|
||||
return LocaleLoader.getString("Repair.Listener.Anvil2");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String[] getSpoutAnvilMessages(int blockId) {
|
||||
if (blockId == repairAnvilId) {
|
||||
return new String[] {LocaleLoader.getString("Repair.AnvilPlaced.Spout1"), LocaleLoader.getString("Repair.AnvilPlaced.Spout2")};
|
||||
}
|
||||
|
||||
if (blockId == salvageAnvilId) {
|
||||
return new String[] {"[mcMMO] Anvil Placed", "Right click to salvage!"};
|
||||
}
|
||||
|
||||
return new String[] {"", ""};
|
||||
}
|
||||
|
||||
/**
|
||||
* Search the inventory for an item and return the index.
|
||||
*
|
||||
@ -99,30 +123,6 @@ public class Repair {
|
||||
inventory.removeItem(item);
|
||||
}
|
||||
|
||||
protected static String[] getSpoutAnvilMessages(int blockId) {
|
||||
if (blockId == repairAnvilId) {
|
||||
return new String[] {LocaleLoader.getString("Repair.AnvilPlaced.Spout1"), LocaleLoader.getString("Repair.AnvilPlaced.Spout2")};
|
||||
}
|
||||
|
||||
if (blockId == salvageAnvilId) {
|
||||
return new String[] {"[mcMMO] Anvil Placed", "Right click to salvage!"};
|
||||
}
|
||||
|
||||
return new String[] {"", ""};
|
||||
}
|
||||
|
||||
protected static String getAnvilMessage(int blockId) {
|
||||
if (blockId == repairAnvilId) {
|
||||
return LocaleLoader.getString("Repair.Listener.Anvil");
|
||||
}
|
||||
|
||||
if (blockId == salvageAnvilId) {
|
||||
return LocaleLoader.getString("Repair.Listener.Anvil2");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
protected static Material getSalvagedItem(ItemStack inHand) {
|
||||
if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
|
||||
return Material.DIAMOND;
|
||||
|
@ -10,8 +10,6 @@ import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
@ -26,6 +24,7 @@ import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.util.spout.SpoutUtils;
|
||||
|
||||
public class RepairManager extends SkillManager {
|
||||
public RepairManager(McMMOPlayer mcMMOPlayer) {
|
||||
@ -45,15 +44,7 @@ public class RepairManager extends SkillManager {
|
||||
}
|
||||
|
||||
if (mcMMO.isSpoutEnabled()) {
|
||||
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
|
||||
|
||||
if (spoutPlayer.isSpoutCraftEnabled()) {
|
||||
String[] spoutMessages = Repair.getSpoutAnvilMessages(anvilId);
|
||||
spoutPlayer.sendNotification(spoutMessages[0], spoutMessages[1], Material.getMaterial(anvilId));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(Repair.getAnvilMessage(anvilId));
|
||||
}
|
||||
SpoutUtils.sendRepairNotifications(player, anvilId);
|
||||
}
|
||||
else {
|
||||
player.sendMessage(Repair.getAnvilMessage(anvilId));
|
||||
|
Reference in New Issue
Block a user