Better parameter names for TitleMixin

This commit is contained in:
Olof Larsson 2015-02-13 09:50:48 +01:00
parent 06ad16e624
commit 536b716d0e
5 changed files with 26 additions and 26 deletions

View File

@ -395,15 +395,15 @@ public class Mixin
// -------------------------------------------- // // -------------------------------------------- //
// Default // 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 // 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 // Available

View File

@ -3,10 +3,10 @@ package com.massivecraft.massivecore.mixin;
public interface TitleMixin public interface TitleMixin
{ {
// Abstract // 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 // 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 // Available
public boolean isTitlesAvailable(); public boolean isTitlesAvailable();

View File

@ -6,11 +6,11 @@ public abstract class TitleMixinAbstract implements TitleMixin
{ {
// Parsed // Parsed
@Override @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 (titleMain != null) titleMain = Txt.parse(titleMain);
if (subTitle != null) subTitle = Txt.parse(subTitle); if (titleSub != null) titleSub = Txt.parse(titleSub);
return this.sendTitleMessage(watcherObject, fadeIn, stay, fadeOut, mainTitle, subTitle); return this.sendTitleMessage(watcherObject, ticksIn, ticksStay, ticksOut, titleMain, titleSub);
} }
} }

View File

@ -19,17 +19,17 @@ public class TitleMixinDefault extends TitleMixinAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @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 // Get the player
Player player = IdUtil.getPlayer(watcherObject); Player player = IdUtil.getPlayer(watcherObject);
if (player == null) return false; if (player == null) return false;
// If we don't send any message (empty is ok) we might end up displaying old messages. // If we don't send any message (empty is ok) we might end up displaying old messages.
if (subTitle == null) subTitle = ""; if (titleSub == null) titleSub = "";
if (mainTitle == null) mainTitle = ""; if (titleMain == null) titleMain = "";
return TitleUtil.sendTitle(player, fadeIn, stay, fadeOut, mainTitle, subTitle); return TitleUtil.sendTitle(player, ticksIn, ticksStay, ticksOut, titleMain, titleSub);
} }
@Override @Override

View File

@ -113,7 +113,7 @@ public final class TitleUtil
// SEND TITLES // 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) if ( ! useTitles)
{ {
@ -123,7 +123,7 @@ public final class TitleUtil
try try
{ {
// Fadein, stay, fadeout // 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); sendPacket.invoke(playerConnection.get( getHandle.invoke(player) ), timesPacket);
} }
catch (Exception e) catch (Exception e)
@ -133,15 +133,15 @@ public final class TitleUtil
return false; return false;
} }
if (title != null) if (titleMain != null)
{ {
title = toJson(title); titleMain = toJson(titleMain);
try try
{ {
// Title // Title
Object titleMain = chatSerializer.invoke(null, title); Object titleMainChat = chatSerializer.invoke(null, titleMain);
Object titlePacket = packetConstructor.newInstance(titleEnum, titleMain); Object titleMainPacket = packetConstructor.newInstance(titleEnum, titleMainChat);
sendPacket.invoke(playerConnection.get(getHandle.invoke(player)), titlePacket); sendPacket.invoke(playerConnection.get(getHandle.invoke(player)), titleMainPacket);
} }
catch (Exception e) catch (Exception e)
{ {
@ -151,15 +151,15 @@ public final class TitleUtil
} }
} }
if (subtitle != null) if (titleSub != null)
{ {
subtitle = toJson(subtitle); titleSub = toJson(titleSub);
try try
{ {
// SubTitle // SubTitle
Object subtitleMain = chatSerializer.invoke(null, subtitle); Object titleSubChat = chatSerializer.invoke(null, titleSub);
Object subtitlesPacket = packetConstructor.newInstance(subtitleEnum, subtitleMain); Object titleSubPacket = packetConstructor.newInstance(subtitleEnum, titleSubChat);
sendPacket.invoke(playerConnection.get(getHandle.invoke(player)), subtitlesPacket); sendPacket.invoke(playerConnection.get(getHandle.invoke(player)), titleSubPacket);
} }
catch (Exception e) catch (Exception e)
{ {