1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 04:25:15 +01:00

Show MythicMobs display name instead of id in info page

This commit is contained in:
Zrips 2018-04-11 12:59:57 +03:00
parent 13dd412def
commit aa69c40f83
7 changed files with 40 additions and 3 deletions

View File

@ -9,5 +9,9 @@ public interface MythicMobInterface {
boolean isMythicMob(LivingEntity lVictim); boolean isMythicMob(LivingEntity lVictim);
void registerListener(); void registerListener();
String getDisplayName(String id);
} }

View File

@ -9,6 +9,8 @@ import com.gamingmesh.jobs.Jobs;
import net.elseland.xikage.MythicMobs.MythicMobs; import net.elseland.xikage.MythicMobs.MythicMobs;
import net.elseland.xikage.MythicMobs.API.MythicMobsAPI; import net.elseland.xikage.MythicMobs.API.MythicMobsAPI;
import net.elseland.xikage.MythicMobs.API.Exceptions.InvalidMobTypeException;
import net.elseland.xikage.MythicMobs.Mobs.MythicMob;
public class MythicMobs2 implements MythicMobInterface { public class MythicMobs2 implements MythicMobInterface {
@ -56,4 +58,16 @@ public class MythicMobs2 implements MythicMobInterface {
return true; return true;
} }
@Override
public String getDisplayName(String id) {
try {
MythicMob mm = MMAPI.getMobAPI().getMythicMob(id);
if (mm != null)
return mm.getDisplayName();
} catch (InvalidMobTypeException e) {
return "";
}
return "";
}
} }

View File

@ -6,8 +6,11 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.stuff.Debug;
import io.lumine.xikage.mythicmobs.MythicMobs; import io.lumine.xikage.mythicmobs.MythicMobs;
import io.lumine.xikage.mythicmobs.api.bukkit.BukkitAPIHelper; import io.lumine.xikage.mythicmobs.api.bukkit.BukkitAPIHelper;
import io.lumine.xikage.mythicmobs.mobs.MythicMob;
public class MythicMobs4 implements MythicMobInterface { public class MythicMobs4 implements MythicMobInterface {
@ -56,4 +59,14 @@ public class MythicMobs4 implements MythicMobInterface {
return true; return true;
} }
@Override
public String getDisplayName(String id) {
Debug.D(id);
MythicMob mm = MMAPI.getMythicMob(id);
if (mm != null)
return mm.getDisplayName();
return "";
}
} }

View File

@ -101,7 +101,6 @@ public class NameTranslatorManager {
} }
break; break;
case CUSTOMKILL: case CUSTOMKILL:
case MMKILL:
case EXPLORE: case EXPLORE:
break; break;
case SHEAR: case SHEAR:
@ -112,6 +111,9 @@ public class NameTranslatorManager {
} }
} }
break; break;
case MMKILL:
return Jobs.getMythicManager().getDisplayName(materialName);
} }
return materialName; return materialName;

View File

@ -80,7 +80,7 @@ public class JobInfo {
public String getRealisticName() { public String getRealisticName() {
String materialName = getName().toLowerCase().replace('_', ' '); String materialName = getName().toLowerCase().replace('_', ' ');
materialName = Character.toUpperCase(materialName.charAt(0)) + materialName.substring(1); materialName = Character.toUpperCase(materialName.charAt(0)) + materialName.substring(1);
materialName = Jobs.getNameTranslatorManager().Translate(materialName, this); materialName = Jobs.getNameTranslatorManager().Translate(getActionType().equals(ActionType.MMKILL) ? getName() : materialName, this);
materialName = org.bukkit.ChatColor.translateAlternateColorCodes('&', materialName); materialName = org.bukkit.ChatColor.translateAlternateColorCodes('&', materialName);
return materialName; return materialName;
} }

View File

@ -73,6 +73,10 @@ Jobs:
Id: 17 Id: 17
# data of block, usualy its 0, but in example Diorite will have id of 1 and data of 3 # data of block, usualy its 0, but in example Diorite will have id of 1 and data of 3
Data: 2 Data: 2
# !OPTIONALY!
# Instead of providing item id and data you can provide skull owner name or UUID to use it in GUI
# In this case you don't need to use Id and Data fields
CustomSkull: Zrips
######################################################################## ########################################################################
# Section used to configure what items the job gets paid for, how much # Section used to configure what items the job gets paid for, how much
# they get paid and how much experience they gain. # they get paid and how much experience they gain.

View File

@ -1,7 +1,7 @@
name: Jobs name: Jobs
description: Jobs Plugin for the BukkitAPI description: Jobs Plugin for the BukkitAPI
main: com.gamingmesh.jobs.Jobs main: com.gamingmesh.jobs.Jobs
version: 4.5.2 version: 4.5.3
website: https://www.spigotmc.org/resources/jobs-reborn.4216/ website: https://www.spigotmc.org/resources/jobs-reborn.4216/
author: phrstbrn author: phrstbrn
softdepend: [Vault, iConomy, MythicMobs, McMMO, WorldGuard, MyPet] softdepend: [Vault, iConomy, MythicMobs, McMMO, WorldGuard, MyPet]