Remove List Name Mixin. Not used.

This commit is contained in:
Olof Larsson 2014-06-18 23:28:12 +02:00
parent 19d5682741
commit 951367c586
5 changed files with 0 additions and 145 deletions

View File

@ -1,7 +0,0 @@
package com.massivecraft.massivecore.mixin;
public interface ListNameMixin
{
public String getListName(Object senderObject);
public void setListName(Object senderObject, String listName);
}

View File

@ -1,6 +0,0 @@
package com.massivecraft.massivecore.mixin;
public abstract class ListNameMixinAbstract implements ListNameMixin
{
}

View File

@ -1,92 +0,0 @@
package com.massivecraft.massivecore.mixin;
import java.util.Map;
import java.util.TreeMap;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.massivecraft.massivecore.util.IdUtil;
public class ListNameMixinDefault extends ListNameMixinAbstract
{
public final static ChatColor DEFAULT_COLOR = ChatColor.WHITE;
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static ListNameMixinDefault i = new ListNameMixinDefault();
public static ListNameMixinDefault get() { return i; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
protected Map<String, String> idToListName = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public String getListName(Object senderObject)
{
String senderId = IdUtil.getId(senderObject);
if (senderId == null) return null;
// Our Map
String ret = this.idToListName.get(senderId);
// Bukkit
if (ret == null)
{
Player player = IdUtil.getPlayer(senderObject);
if (player != null)
{
ret = player.getPlayerListName();
}
}
// Fixed Name
if (ret == null)
{
ret = IdUtil.getName(senderObject);
}
// Id Fallback
if (ret == null)
{
ret = senderId;
}
// Ensure Colored
if (ChatColor.stripColor(ret).equals(ret))
{
ret = DEFAULT_COLOR.toString()+ret;
}
return ret;
}
@Override
public void setListName(Object senderObject, String listName)
{
String senderId = IdUtil.getId(senderObject);
if (senderId == null) return;
if (listName == null)
{
this.idToListName.remove(senderId);
}
else
{
this.idToListName.put(senderId, listName);
}
Player player = IdUtil.getPlayer(senderObject);
if (player == null) return;
player.setPlayerListName(this.getListName(senderObject));
}
}

View File

@ -29,10 +29,6 @@ public class Mixin
public static DisplayNameMixin getDisplayNameMixin() { return displayNameMixin; } public static DisplayNameMixin getDisplayNameMixin() { return displayNameMixin; }
public static void setDisplayNameMixin(DisplayNameMixin val) { displayNameMixin = val; } public static void setDisplayNameMixin(DisplayNameMixin val) { displayNameMixin = val; }
private static ListNameMixin listNameMixin = ListNameMixinDefault.get();
public static ListNameMixin getListNameMixin() { return listNameMixin; }
public static void setListNameMixin(ListNameMixin val) { listNameMixin = val; }
private static SenderPsMixin senderPsMixin = SenderPsMixinDefault.get(); private static SenderPsMixin senderPsMixin = SenderPsMixinDefault.get();
public static SenderPsMixin getSenderPsMixin() { return senderPsMixin; } public static SenderPsMixin getSenderPsMixin() { return senderPsMixin; }
public static void setSenderPsMixin(SenderPsMixin val) { senderPsMixin = val; } public static void setSenderPsMixin(SenderPsMixin val) { senderPsMixin = val; }
@ -133,30 +129,6 @@ public class Mixin
getDisplayNameMixin().setDisplayName(senderObject, displayName); getDisplayNameMixin().setDisplayName(senderObject, displayName);
} }
// -------------------------------------------- //
// STATIC EXPOSE: LIST NAME
// -------------------------------------------- //
public static String getListName(String senderId)
{
return getListNameMixin().getListName(senderId);
}
public static void setListName(String senderId, String listName)
{
getListNameMixin().setListName(senderId, listName);
}
public static String getListName(CommandSender sender)
{
return getListNameMixin().getListName(sender);
}
public static void setListName(CommandSender sender, String listName)
{
getListNameMixin().setListName(sender, listName);
}
// -------------------------------------------- // // -------------------------------------------- //
// STATIC EXPOSE: SENDER PS // STATIC EXPOSE: SENDER PS
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -105,18 +105,6 @@ public abstract class SenderEntity<E extends SenderEntity<E>> extends Entity<E>
Mixin.setDisplayName(this.getId(), displayName); Mixin.setDisplayName(this.getId(), displayName);
} }
// LIST NAME
public String getListName()
{
return Mixin.getListName(this.getId());
}
public void setListName(String listName)
{
Mixin.setListName(this.getId(), listName);
}
// CONVENIENCE SEND MESSAGE // CONVENIENCE SEND MESSAGE
public boolean sendMessage(String message) public boolean sendMessage(String message)