Use Xlib guava some more

This commit is contained in:
Olof Larsson 2017-12-17 13:25:59 +01:00
parent 5a380503e0
commit 9c5f6a06a4
10 changed files with 14 additions and 74 deletions

View File

@ -1,58 +0,0 @@
package com.massivecraft.massivecore.item;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
public class ConverterListImmutable<EX, EY> extends Converter<Iterable<EX>, ImmutableList<EY>>
{
// -------------------------------------------- //
// FIELD
// -------------------------------------------- //
private final Converter<EX, EY> converterElement;
public Converter<EX, EY> getConverterElement() { return this.converterElement; }
// -------------------------------------------- //
// CREATE
// -------------------------------------------- //
public ConverterListImmutable(Converter<EX, EY> converterElement)
{
this.converterElement = converterElement;
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public ImmutableList<EY> convert(Iterable<EX> exs)
{
// Null
if (exs == null) return null;
// Create
Builder<EY> eys = ImmutableList.builder();
// Fill
for (EX ex : exs)
{
EY ey = null;
try
{
ey = this.getConverterElement().convert(ex);
}
catch (Throwable t)
{
t.printStackTrace();
continue;
}
eys.add(ey);
}
// Return
return eys.build();
}
}

View File

@ -2,7 +2,7 @@ package com.massivecraft.massivecore.item;
import org.bukkit.Color;
public class ConverterToColors extends ConverterListImmutable<Integer, Color>
public class ConverterToColors extends ConverterList<Integer, Color>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.item;
import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableBiMap;
import com.massivecraft.massivecore.xlib.guava.collect.BiMap;
import com.massivecraft.massivecore.xlib.guava.collect.ImmutableBiMap;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionType;

View File

@ -1,12 +1,11 @@
package com.massivecraft.massivecore.item;
import com.google.common.collect.ImmutableList;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import java.util.List;
public class WriterFireworkEffectColors extends WriterAbstractFireworkEffect<List<Integer>, ImmutableList<Color>>
public class WriterFireworkEffectColors extends WriterAbstractFireworkEffect<List<Integer>, List<Color>>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
@ -38,9 +37,9 @@ public class WriterFireworkEffectColors extends WriterAbstractFireworkEffect<Lis
}
@Override
public ImmutableList<Color> getB(FireworkEffect cb, Object d)
public List<Color> getB(FireworkEffect cb, Object d)
{
return (ImmutableList<Color>) cb.getColors();
return cb.getColors();
}
}

View File

@ -1,12 +1,11 @@
package com.massivecraft.massivecore.item;
import com.google.common.collect.ImmutableList;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import java.util.List;
public class WriterFireworkEffectFadeColors extends WriterAbstractFireworkEffect<List<Integer>, ImmutableList<Color>>
public class WriterFireworkEffectFadeColors extends WriterAbstractFireworkEffect<List<Integer>, List<Color>>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
@ -38,9 +37,9 @@ public class WriterFireworkEffectFadeColors extends WriterAbstractFireworkEffect
}
@Override
public ImmutableList<Color> getB(FireworkEffect cb, Object d)
public List<Color> getB(FireworkEffect cb, Object d)
{
return (ImmutableList<Color>) cb.getFadeColors();
return cb.getFadeColors();
}
}

View File

@ -1,6 +1,5 @@
package com.massivecraft.massivecore.mson;
import com.google.common.collect.ImmutableList;
import com.massivecraft.massivecore.adapter.AdapterLowercaseEnum;
import com.massivecraft.massivecore.adapter.AdapterMsonEventFix;
import com.massivecraft.massivecore.collections.MassiveList;
@ -14,6 +13,7 @@ import com.massivecraft.massivecore.xlib.gson.GsonBuilder;
import com.massivecraft.massivecore.xlib.gson.JsonElement;
import com.massivecraft.massivecore.xlib.gson.JsonNull;
import com.massivecraft.massivecore.xlib.gson.JsonPrimitive;
import com.massivecraft.massivecore.xlib.guava.collect.ImmutableList;
import org.apache.commons.lang.mutable.MutableInt;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

View File

@ -1,8 +1,8 @@
package com.massivecraft.massivecore.nms;
import com.google.common.collect.ImmutableSet;
import com.massivecraft.massivecore.particleeffect.ReflectionUtils.PackageType;
import com.massivecraft.massivecore.util.ReflectionUtil;
import com.massivecraft.massivecore.xlib.guava.collect.ImmutableSet;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team;

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore.predicate;
import com.google.common.collect.ImmutableList;
import com.massivecraft.massivecore.xlib.guava.collect.ImmutableList;
import java.util.Collection;
import java.util.List;

View File

@ -1,6 +1,5 @@
package com.massivecraft.massivecore.store;
import com.google.common.base.Objects;
import com.massivecraft.massivecore.Named;
import com.massivecraft.massivecore.PlayerState;
import com.massivecraft.massivecore.event.EventMassiveCoreAknowledge;
@ -13,6 +12,7 @@ import com.massivecraft.massivecore.mson.Mson;
import com.massivecraft.massivecore.store.cleanable.Cleanable;
import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.PermissionUtil;
import com.massivecraft.massivecore.xlib.guava.base.Objects;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;

View File

@ -1,8 +1,8 @@
package com.massivecraft.massivecore.util;
import com.google.common.collect.ImmutableList;
import com.massivecraft.massivecore.SenderPresence;
import com.massivecraft.massivecore.SenderType;
import com.massivecraft.massivecore.xlib.guava.collect.ImmutableList;
import java.util.Collections;
import java.util.EnumMap;