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:
parent
13dd412def
commit
aa69c40f83
@ -9,5 +9,9 @@ public interface MythicMobInterface {
|
||||
boolean isMythicMob(LivingEntity lVictim);
|
||||
|
||||
void registerListener();
|
||||
|
||||
String getDisplayName(String id);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import com.gamingmesh.jobs.Jobs;
|
||||
|
||||
import net.elseland.xikage.MythicMobs.MythicMobs;
|
||||
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 {
|
||||
|
||||
@ -56,4 +58,16 @@ public class MythicMobs2 implements MythicMobInterface {
|
||||
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 "";
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,11 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
|
||||
import io.lumine.xikage.mythicmobs.MythicMobs;
|
||||
import io.lumine.xikage.mythicmobs.api.bukkit.BukkitAPIHelper;
|
||||
import io.lumine.xikage.mythicmobs.mobs.MythicMob;
|
||||
|
||||
public class MythicMobs4 implements MythicMobInterface {
|
||||
|
||||
@ -56,4 +59,14 @@ public class MythicMobs4 implements MythicMobInterface {
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName(String id) {
|
||||
Debug.D(id);
|
||||
MythicMob mm = MMAPI.getMythicMob(id);
|
||||
if (mm != null)
|
||||
return mm.getDisplayName();
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -101,7 +101,6 @@ public class NameTranslatorManager {
|
||||
}
|
||||
break;
|
||||
case CUSTOMKILL:
|
||||
case MMKILL:
|
||||
case EXPLORE:
|
||||
break;
|
||||
case SHEAR:
|
||||
@ -112,6 +111,9 @@ public class NameTranslatorManager {
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MMKILL:
|
||||
return Jobs.getMythicManager().getDisplayName(materialName);
|
||||
}
|
||||
|
||||
return materialName;
|
||||
|
@ -80,7 +80,7 @@ public class JobInfo {
|
||||
public String getRealisticName() {
|
||||
String materialName = getName().toLowerCase().replace('_', ' ');
|
||||
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);
|
||||
return materialName;
|
||||
}
|
||||
|
@ -73,6 +73,10 @@ Jobs:
|
||||
Id: 17
|
||||
# data of block, usualy its 0, but in example Diorite will have id of 1 and data of 3
|
||||
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
|
||||
# they get paid and how much experience they gain.
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: Jobs
|
||||
description: Jobs Plugin for the BukkitAPI
|
||||
main: com.gamingmesh.jobs.Jobs
|
||||
version: 4.5.2
|
||||
version: 4.5.3
|
||||
website: https://www.spigotmc.org/resources/jobs-reborn.4216/
|
||||
author: phrstbrn
|
||||
softdepend: [Vault, iConomy, MythicMobs, McMMO, WorldGuard, MyPet]
|
||||
|
Loading…
Reference in New Issue
Block a user