Falling Block and Dropped Item now show their proper name for disguise name
This commit is contained in:
parent
a896d89633
commit
884f9471ca
@ -1,8 +1,12 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||||
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
|
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
||||||
|
import me.libraryaddict.disguise.utilities.translations.TranslateType;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class DroppedItemWatcher extends FlagWatcher {
|
public class DroppedItemWatcher extends FlagWatcher {
|
||||||
@ -17,5 +21,9 @@ public class DroppedItemWatcher extends FlagWatcher {
|
|||||||
public void setItemStack(ItemStack item) {
|
public void setItemStack(ItemStack item) {
|
||||||
setData(MetaIndex.DROPPED_ITEM, item);
|
setData(MetaIndex.DROPPED_ITEM, item);
|
||||||
sendData(MetaIndex.DROPPED_ITEM);
|
sendData(MetaIndex.DROPPED_ITEM);
|
||||||
|
|
||||||
|
getDisguise().setDisguiseName(TranslateType.DISGUISES.get(DisguiseType.DROPPED_ITEM.toReadable()) + " " +
|
||||||
|
TranslateType.DISGUISE_OPTIONS_PARAMETERS
|
||||||
|
.get(ReflectionManager.toReadable((item == null ? Material.AIR : item.getType()).name())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@ import me.libraryaddict.disguise.DisguiseAPI;
|
|||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
|
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
||||||
|
import me.libraryaddict.disguise.utilities.translations.TranslateType;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -85,6 +87,9 @@ public class FallingBlockWatcher extends FlagWatcher {
|
|||||||
|
|
||||||
this.block = block;
|
this.block = block;
|
||||||
|
|
||||||
|
getDisguise().setDisguiseName(TranslateType.DISGUISE_OPTIONS_PARAMETERS.get("Block") + " " +
|
||||||
|
TranslateType.DISGUISE_OPTIONS_PARAMETERS.get(ReflectionManager.toReadable(block.getType().name())));
|
||||||
|
|
||||||
if (DisguiseAPI.isDisguiseInUse(getDisguise()) && getDisguise().getWatcher() == this) {
|
if (DisguiseAPI.isDisguiseInUse(getDisguise()) && getDisguise().getWatcher() == this) {
|
||||||
DisguiseUtilities.refreshTrackers(getDisguise());
|
DisguiseUtilities.refreshTrackers(getDisguise());
|
||||||
}
|
}
|
||||||
|
@ -792,6 +792,7 @@ public class DisguiseParser {
|
|||||||
if (disguisePerm.getType() == DisguiseType.DROPPED_ITEM ||
|
if (disguisePerm.getType() == DisguiseType.DROPPED_ITEM ||
|
||||||
disguisePerm.getType() == DisguiseType.FALLING_BLOCK) {
|
disguisePerm.getType() == DisguiseType.FALLING_BLOCK) {
|
||||||
disguise = new MiscDisguise(disguisePerm.getType(), itemStack);
|
disguise = new MiscDisguise(disguisePerm.getType(), itemStack);
|
||||||
|
name = disguise.getDisguiseName();
|
||||||
} else {
|
} else {
|
||||||
disguise = new MiscDisguise(disguisePerm.getType(), miscId);
|
disguise = new MiscDisguise(disguisePerm.getType(), miscId);
|
||||||
}
|
}
|
||||||
|
@ -1841,7 +1841,7 @@ public class ReflectionManager {
|
|||||||
return split;
|
return split;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String toReadable(String string) {
|
public static String toReadable(String string) {
|
||||||
return StringUtils.join(splitReadable(string));
|
return StringUtils.join(splitReadable(string));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user