Better parameter names for TitleMixin
This commit is contained in:
parent
06ad16e624
commit
536b716d0e
@ -395,15 +395,15 @@ public class Mixin
|
||||
// -------------------------------------------- //
|
||||
|
||||
// Default
|
||||
public static boolean sendTitleMessage(Object watcherObject, int fadeIn, int stay, int fadeOut, String mainTitle, String subTitle)
|
||||
public static boolean sendTitleMessage(Object watcherObject, int ticksIn, int ticksStay, int ticksOut, String titleMain, String titleSub)
|
||||
{
|
||||
return getTitleMixin().sendTitleMessage(watcherObject, fadeIn, stay, fadeOut, mainTitle, subTitle);
|
||||
return getTitleMixin().sendTitleMessage(watcherObject, ticksIn, ticksStay, ticksOut, titleMain, titleSub);
|
||||
}
|
||||
|
||||
// Parsed
|
||||
public static boolean sendTitleMsg(Object watcherObject, int fadeIn, int stay, int fadeOut, String mainTitle, String subTitle)
|
||||
public static boolean sendTitleMsg(Object watcherObject, int ticksIn, int ticksStay, int ticksOut, String titleMain, String titleSub)
|
||||
{
|
||||
return getTitleMixin().sendTitleMsg(watcherObject, fadeIn, stay, fadeOut, mainTitle, subTitle);
|
||||
return getTitleMixin().sendTitleMsg(watcherObject, ticksIn, ticksStay, ticksOut, titleMain, titleSub);
|
||||
}
|
||||
|
||||
// Available
|
||||
|
@ -3,10 +3,10 @@ package com.massivecraft.massivecore.mixin;
|
||||
public interface TitleMixin
|
||||
{
|
||||
// Abstract
|
||||
public boolean sendTitleMessage(Object watcherObject, int fadeIn, int stay, int fadeOut, String mainTitle, String subTitle);
|
||||
public boolean sendTitleMessage(Object watcherObject, int ticksIn, int ticksStay, int ticksOut, String titleMain, String titleSub);
|
||||
|
||||
// Parsed
|
||||
public boolean sendTitleMsg(Object watcherObject, int fadeIn, int stay, int fadeOut, String mainTitle, String subTitle);
|
||||
public boolean sendTitleMsg(Object watcherObject, int ticksIn, int ticksStay, int ticksOut, String titleMain, String titleSub);
|
||||
|
||||
// Available
|
||||
public boolean isTitlesAvailable();
|
||||
|
@ -6,11 +6,11 @@ public abstract class TitleMixinAbstract implements TitleMixin
|
||||
{
|
||||
// Parsed
|
||||
@Override
|
||||
public boolean sendTitleMsg(Object watcherObject, int fadeIn, int stay, int fadeOut, String mainTitle, String subTitle)
|
||||
public boolean sendTitleMsg(Object watcherObject, int ticksIn, int ticksStay, int ticksOut, String titleMain, String titleSub)
|
||||
{
|
||||
if (mainTitle != null) mainTitle = Txt.parse(mainTitle);
|
||||
if (subTitle != null) subTitle = Txt.parse(subTitle);
|
||||
return this.sendTitleMessage(watcherObject, fadeIn, stay, fadeOut, mainTitle, subTitle);
|
||||
if (titleMain != null) titleMain = Txt.parse(titleMain);
|
||||
if (titleSub != null) titleSub = Txt.parse(titleSub);
|
||||
return this.sendTitleMessage(watcherObject, ticksIn, ticksStay, ticksOut, titleMain, titleSub);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,17 +19,17 @@ public class TitleMixinDefault extends TitleMixinAbstract
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public boolean sendTitleMessage(Object watcherObject, int fadeIn, int stay, int fadeOut, String mainTitle, String subTitle)
|
||||
public boolean sendTitleMessage(Object watcherObject, int ticksIn, int ticksStay, int ticksOut, String titleMain, String titleSub)
|
||||
{
|
||||
// Get the player
|
||||
Player player = IdUtil.getPlayer(watcherObject);
|
||||
if (player == null) return false;
|
||||
|
||||
// If we don't send any message (empty is ok) we might end up displaying old messages.
|
||||
if (subTitle == null) subTitle = "";
|
||||
if (mainTitle == null) mainTitle = "";
|
||||
if (titleSub == null) titleSub = "";
|
||||
if (titleMain == null) titleMain = "";
|
||||
|
||||
return TitleUtil.sendTitle(player, fadeIn, stay, fadeOut, mainTitle, subTitle);
|
||||
return TitleUtil.sendTitle(player, ticksIn, ticksStay, ticksOut, titleMain, titleSub);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -113,7 +113,7 @@ public final class TitleUtil
|
||||
// SEND TITLES
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static boolean sendTitle(Player player, int fadeIn, int stay, int fadeOut, String title, String subtitle)
|
||||
public static boolean sendTitle(Player player, int ticksIn, int ticksStay, int ticksOut, String titleMain, String titleSub)
|
||||
{
|
||||
if ( ! useTitles)
|
||||
{
|
||||
@ -123,7 +123,7 @@ public final class TitleUtil
|
||||
try
|
||||
{
|
||||
// Fadein, stay, fadeout
|
||||
Object timesPacket = packetConstructorTimes.newInstance(timesEnum, null, fadeIn, stay, fadeOut);
|
||||
Object timesPacket = packetConstructorTimes.newInstance(timesEnum, null, ticksIn, ticksStay, ticksOut);
|
||||
sendPacket.invoke(playerConnection.get( getHandle.invoke(player) ), timesPacket);
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -133,15 +133,15 @@ public final class TitleUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
if (title != null)
|
||||
if (titleMain != null)
|
||||
{
|
||||
title = toJson(title);
|
||||
titleMain = toJson(titleMain);
|
||||
try
|
||||
{
|
||||
// Title
|
||||
Object titleMain = chatSerializer.invoke(null, title);
|
||||
Object titlePacket = packetConstructor.newInstance(titleEnum, titleMain);
|
||||
sendPacket.invoke(playerConnection.get(getHandle.invoke(player)), titlePacket);
|
||||
Object titleMainChat = chatSerializer.invoke(null, titleMain);
|
||||
Object titleMainPacket = packetConstructor.newInstance(titleEnum, titleMainChat);
|
||||
sendPacket.invoke(playerConnection.get(getHandle.invoke(player)), titleMainPacket);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -151,15 +151,15 @@ public final class TitleUtil
|
||||
}
|
||||
}
|
||||
|
||||
if (subtitle != null)
|
||||
if (titleSub != null)
|
||||
{
|
||||
subtitle = toJson(subtitle);
|
||||
titleSub = toJson(titleSub);
|
||||
try
|
||||
{
|
||||
// SubTitle
|
||||
Object subtitleMain = chatSerializer.invoke(null, subtitle);
|
||||
Object subtitlesPacket = packetConstructor.newInstance(subtitleEnum, subtitleMain);
|
||||
sendPacket.invoke(playerConnection.get(getHandle.invoke(player)), subtitlesPacket);
|
||||
Object titleSubChat = chatSerializer.invoke(null, titleSub);
|
||||
Object titleSubPacket = packetConstructor.newInstance(subtitleEnum, titleSubChat);
|
||||
sendPacket.invoke(playerConnection.get(getHandle.invoke(player)), titleSubPacket);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user