Skip to content

Commit

Permalink
Update SpongeAPI and fix minor issues from #23
Browse files Browse the repository at this point in the history
  • Loading branch information
simon816 committed Jul 13, 2015
1 parent 4104d1b commit 825d95a
Show file tree
Hide file tree
Showing 48 changed files with 134 additions and 194 deletions.
2 changes: 1 addition & 1 deletion SpongeAPI
Submodule SpongeAPI updated 23 files
+1 −1 src/main/java/org/spongepowered/api/Server.java
+6 −4 src/main/java/org/spongepowered/api/data/property/DisplacementProperty.java
+7 −4 src/main/java/org/spongepowered/api/entity/projectile/source/ProjectileSource.java
+10 −6 src/main/java/org/spongepowered/api/entity/projectile/source/UnknownProjectileSource.java
+2 −2 src/main/java/org/spongepowered/api/event/SpongeEventFactory.java
+1 −2 src/main/java/org/spongepowered/api/event/entity/player/PlayerResourcePackStatusEvent.java
+0 −2 src/main/java/org/spongepowered/api/extra/skylands/SkylandsUtil.java
+2 −3 src/main/java/org/spongepowered/api/item/inventory/ItemStackBuilder.java
+0 −1 src/main/java/org/spongepowered/api/item/inventory/ItemStackComparators.java
+0 −3 src/main/java/org/spongepowered/api/text/Texts.java
+4 −2 src/main/java/org/spongepowered/api/text/sink/MessageSinkFactory.java
+5 −2 src/main/java/org/spongepowered/api/text/sink/MessageSinks.java
+3 −2 src/main/java/org/spongepowered/api/text/translation/ResourceBundleTranslation.java
+5 −5 src/main/java/org/spongepowered/api/util/Direction.java
+1 −1 src/main/java/org/spongepowered/api/util/ban/Ban.java
+17 −14 src/main/java/org/spongepowered/api/util/blockray/BlockRay.java
+3 −3 src/main/java/org/spongepowered/api/util/command/args/CommandContext.java
+2 −2 src/main/java/org/spongepowered/api/util/command/args/CommandFlags.java
+9 −7 src/main/java/org/spongepowered/api/util/command/args/GenericArguments.java
+11 −11 src/main/java/org/spongepowered/api/util/command/spec/CommandSpec.java
+1 −1 src/main/java/org/spongepowered/api/util/weighted/WeightedItem.java
+7 −4 src/main/java/org/spongepowered/api/world/Location.java
+9 −4 src/main/java/org/spongepowered/api/world/extent/Extent.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
package org.spongepowered.common.command;

import static org.spongepowered.api.util.command.args.GenericArguments.choices;
import static org.spongepowered.api.util.command.args.GenericArguments.dimension;
import static org.spongepowered.api.util.command.args.GenericArguments.firstParsing;
import static org.spongepowered.api.util.command.args.GenericArguments.flags;
Expand All @@ -35,23 +34,19 @@
import static org.spongepowered.api.util.command.args.GenericArguments.world;

import com.google.common.base.Function;
import com.google.common.base.Functions;
import com.google.common.base.Optional;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldServer;
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
import org.spongepowered.api.plugin.PluginContainer;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.TextBuilder;
import org.spongepowered.api.text.Texts;
import org.spongepowered.api.text.action.TextAction;
import org.spongepowered.api.text.action.TextActions;
import org.spongepowered.api.text.format.TextColors;
import org.spongepowered.api.text.format.TextStyles;
import org.spongepowered.api.util.annotation.NonnullByDefault;
import org.spongepowered.api.util.command.CommandCallable;
import org.spongepowered.api.util.command.CommandException;
import org.spongepowered.api.util.command.CommandResult;
import org.spongepowered.api.util.command.CommandSource;
Expand All @@ -76,7 +71,6 @@
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;

import javax.annotation.Nullable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.spongepowered.api.data.manipulator.DisplayNameData;
import org.spongepowered.api.service.persistence.InvalidDataException;
import org.spongepowered.api.text.Texts;
import org.spongepowered.api.util.TextMessageException;
import org.spongepowered.common.data.SpongeDataProcessor;
import org.spongepowered.common.data.manipulator.SpongeDisplayNameData;
import org.spongepowered.common.text.SpongeTexts;
Expand Down Expand Up @@ -84,7 +83,6 @@ public Optional<DisplayNameData> createFrom(DataHolder dataHolder) {
if (mainCompound != null && mainCompound.hasKey("Name", 8)) {
final String displayString = mainCompound.getString("Name");
final DisplayNameData data = new SpongeDisplayNameData();
System.err.println("The retrieved displayname from an item stack was: " + displayString);
data.setDisplayName(Texts.legacy().fromUnchecked(displayString));
data.setCustomNameVisible(true);
return Optional.of(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import static com.google.common.base.Preconditions.checkNotNull;

import org.omg.CORBA.DynAnyPackage.Invalid;
import org.spongepowered.api.data.DataQuery;
import org.spongepowered.api.data.DataView;
import org.spongepowered.api.service.persistence.InvalidDataException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.spongepowered.api.entity.projectile.Projectile;
import org.spongepowered.api.entity.projectile.source.BlockProjectileSource;
import org.spongepowered.api.entity.projectile.source.ProjectileSource;
import org.spongepowered.api.entity.projectile.source.UnknownProjectileSource;
import org.spongepowered.common.util.VecHelper;

import java.util.UUID;
Expand Down Expand Up @@ -69,7 +68,7 @@ public static ProjectileSource fromNbt(World worldObj, NBTBase tag) {
return (ProjectileSource) tileEntity;
}
}
return new UnknownProjectileSource();
return ProjectileSource.UNKNOWN;
}

public static void writeSourceToNbt(NBTTagCompound compound, ProjectileSource projectileSource, net.minecraft.entity.Entity potentialEntity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void register(List<RegisteredHandler<?>> handlers) {
synchronized (this.lock) {
boolean changed = false;

for (RegisteredHandler handler : handlers) {
for (RegisteredHandler<?> handler : handlers) {
if (this.handlersByEvent.put(handler.getEventClass(), handler)) {
changed = true;
}
Expand Down Expand Up @@ -243,7 +243,7 @@ protected RegisteredHandler.Cache getHandlerCache(Event event) {

@SuppressWarnings("unchecked")
protected static boolean post(Event event, List<RegisteredHandler<?>> handlers) {
for (RegisteredHandler handler : handlers) {
for (@SuppressWarnings("rawtypes") RegisteredHandler handler : handlers) {
try {
handler.handle(event);
} catch (Throwable e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public ItemStackBuilder quantity(int quantity) throws IllegalArgumentException {
}

@Override
@SuppressWarnings("unchecked")
public ItemStackBuilder itemData(final DataManipulator<?> itemData) throws IllegalArgumentException {
checkNotNull(itemData, "Must have a non-null item data!");
checkNotNull(this.type, "Cannot set item data without having set a type first!");
Expand All @@ -92,6 +91,7 @@ public ItemStackBuilder fromItemStack(ItemStack itemStack) {
this.type = itemStack.getItem();
this.quantity = itemStack.getQuantity();
this.maxQuantity = itemStack.getMaxStackQuantity();
this.itemDataSet.addAll(itemStack.getManipulators());
return this;
}

Expand All @@ -104,6 +104,7 @@ public ItemStackBuilder reset() {
return this;
}

@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public ItemStack build() throws IllegalStateException {
checkState(this.type != null, "Item type has not been set");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public abstract class MixinEntityAIMate {

@Inject(method = "spawnBaby()V", at = @At(value = "INVOKE_ASSIGN", target = "net/minecraft/entity/passive/EntityAnimal.createChild(Lnet/minecraft/entity/EntityAgeable;)Lnet/minecraft/entity/EntityAgeable;", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILEXCEPTION, cancellable = true)
public void callBreedEvent(CallbackInfo ci, EntityAgeable entityageable) {
final EntityBreedEvent event = SpongeEventFactory.createEntityBreed(Sponge.getGame(), (Ageable)entityageable, (Ageable)theAnimal, (Ageable)targetMate);
final EntityBreedEvent event = SpongeEventFactory.createEntityBreed(Sponge.getGame(), (Ageable)entityageable, (Ageable)this.theAnimal, (Ageable)this.targetMate);
Sponge.getGame().getEventManager().post(event);
if(event.isCancelled()) {
ci.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
import com.google.common.base.Optional;
import net.minecraft.entity.EntityLivingBase;
import org.spongepowered.api.data.DataContainer;
import org.spongepowered.api.data.DataQuery;
import org.spongepowered.api.data.manipulator.entity.ExplosiveRadiusData;
import org.spongepowered.api.data.manipulator.entity.FuseData;
import org.spongepowered.api.entity.explosive.PrimedTNT;
import org.spongepowered.api.entity.living.Living;
import org.spongepowered.api.service.persistence.InvalidDataException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

import com.flowpowered.math.vector.Vector3d;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.NetHandlerPlayServer;
Expand Down Expand Up @@ -203,7 +202,7 @@ public void sendMessage(ChatType type, Iterable<Text> messages) {

@Override
public void setMessageSink(MessageSink sink) {
Preconditions.checkNotNull(sink, "sink");
checkNotNull(sink, "sink");
this.sink = sink;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import net.minecraft.nbt.NBTTagCompound;
import org.spongepowered.api.entity.projectile.Arrow;
import org.spongepowered.api.entity.projectile.source.ProjectileSource;
import org.spongepowered.api.entity.projectile.source.UnknownProjectileSource;
import org.spongepowered.api.util.annotation.NonnullByDefault;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
Expand Down Expand Up @@ -63,7 +62,7 @@ public ProjectileSource getShooter() {
} else if (this.shootingEntity instanceof ProjectileSource) {
return (ProjectileSource) this.shootingEntity;
}
return new UnknownProjectileSource();
return ProjectileSource.UNKNOWN;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import net.minecraft.nbt.NBTTagCompound;
import org.spongepowered.api.entity.projectile.EyeOfEnder;
import org.spongepowered.api.entity.projectile.source.ProjectileSource;
import org.spongepowered.api.entity.projectile.source.UnknownProjectileSource;
import org.spongepowered.api.util.annotation.NonnullByDefault;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -44,7 +43,7 @@ public abstract class MixinEntityEnderEye extends MixinEntity implements EyeOfEn
@Shadow private double targetZ;
@Shadow private boolean shatterOrDrop;

private ProjectileSource projectileSource = new UnknownProjectileSource();
private ProjectileSource projectileSource = ProjectileSource.UNKNOWN;

public Vector3d getTargetedLocation() {
return new Vector3d(this.targetX, this.targetY, this.targetZ);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import net.minecraft.nbt.NBTTagCompound;
import org.spongepowered.api.entity.projectile.Firework;
import org.spongepowered.api.entity.projectile.source.ProjectileSource;
import org.spongepowered.api.entity.projectile.source.UnknownProjectileSource;
import org.spongepowered.api.util.annotation.NonnullByDefault;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -41,7 +40,7 @@ public abstract class MixinEntityFireworkRocket extends MixinEntity implements F
@Shadow private int lifetime;
@Shadow private int fireworkAge;

private ProjectileSource projectileSource = new UnknownProjectileSource();
private ProjectileSource projectileSource = ProjectileSource.UNKNOWN;

public int getFuseDuration() {
return this.lifetime - this.fireworkAge;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.entity.projectile.FishHook;
import org.spongepowered.api.entity.projectile.source.ProjectileSource;
import org.spongepowered.api.entity.projectile.source.UnknownProjectileSource;
import org.spongepowered.api.event.SpongeEventFactory;
import org.spongepowered.api.event.entity.player.fishing.PlayerHookedEntityEvent;
import org.spongepowered.api.event.entity.player.fishing.PlayerRetractFishingLineEvent;
Expand Down Expand Up @@ -77,7 +76,7 @@ public ProjectileSource getShooter() {
} else if (this.angler != null && this.angler instanceof ProjectileSource) {
return (ProjectileSource) this.angler;
}
return new UnknownProjectileSource();
return ProjectileSource.UNKNOWN;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import net.minecraft.nbt.NBTTagCompound;
import org.spongepowered.api.entity.projectile.Projectile;
import org.spongepowered.api.entity.projectile.source.ProjectileSource;
import org.spongepowered.api.entity.projectile.source.UnknownProjectileSource;
import org.spongepowered.api.util.annotation.NonnullByDefault;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand Down Expand Up @@ -58,7 +57,7 @@ public ProjectileSource getShooter() {
return (ProjectileSource) this.getThrower();
}

return new UnknownProjectileSource();
return ProjectileSource.UNKNOWN;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.spongepowered.api.data.manipulator.entity.DamagingData;
import org.spongepowered.api.entity.projectile.explosive.fireball.Fireball;
import org.spongepowered.api.entity.projectile.source.ProjectileSource;
import org.spongepowered.api.entity.projectile.source.UnknownProjectileSource;
import org.spongepowered.api.util.annotation.NonnullByDefault;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -52,7 +51,7 @@ public ProjectileSource getShooter() {
if (this.shootingEntity != null) {
this.projectileSource = (ProjectileSource) this.shootingEntity;
} else {
this.projectileSource = new UnknownProjectileSource();
this.projectileSource = ProjectileSource.UNKNOWN;
}
}
return this.projectileSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@

import static org.spongepowered.api.data.DataQuery.of;

import com.google.common.collect.Lists;
import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
import org.spongepowered.api.data.DataContainer;
import org.spongepowered.api.data.DataManipulator;
import org.spongepowered.api.data.DataQuery;
import org.spongepowered.api.data.MemoryDataContainer;
import org.spongepowered.api.item.ItemType;
import org.spongepowered.api.item.inventory.ItemStack;
Expand All @@ -42,7 +40,6 @@
import org.spongepowered.common.interfaces.item.IMixinItem;

import java.util.Collection;
import java.util.List;

@SuppressWarnings("serial")
@NonnullByDefault
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@

import net.minecraft.scoreboard.Score;
import net.minecraft.scoreboard.Scoreboard;
import org.spongepowered.api.scoreboard.objective.Objective;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.Texts;
import org.spongepowered.api.util.annotation.NonnullByDefault;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -41,11 +36,6 @@
import org.spongepowered.common.interfaces.IMixinScoreboard;
import org.spongepowered.common.scoreboard.SpongeScore;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

@NonnullByDefault
@Mixin(Score.class)
public abstract class MixinScore implements IMixinScore {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,21 @@
*/
package org.spongepowered.common.mixin.core.scoreboard;

import com.google.common.collect.Maps;
import net.minecraft.scoreboard.IScoreObjectiveCriteria;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.Scoreboard;
import org.spongepowered.api.scoreboard.Score;
import org.spongepowered.api.scoreboard.critieria.Criterion;
import org.spongepowered.api.scoreboard.objective.Objective;
import org.spongepowered.api.scoreboard.objective.displaymode.ObjectiveDisplayMode;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.Texts;
import org.spongepowered.api.util.annotation.NonnullByDefault;
import org.spongepowered.api.world.ChunkManager;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
import org.spongepowered.asm.mixin.Intrinsic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.common.Sponge;
import org.spongepowered.common.interfaces.IMixinScore;
import org.spongepowered.common.interfaces.IMixinScoreObjective;
import org.spongepowered.common.interfaces.IMixinScoreboard;
import org.spongepowered.common.registry.SpongeGameRegistry;
import org.spongepowered.common.scoreboard.SpongeObjective;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

@NonnullByDefault
@Mixin(ScoreObjective.class)
public abstract class MixinScoreObjective implements IMixinScoreObjective {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,21 @@
*/
package org.spongepowered.common.mixin.core.scoreboard;

import com.google.common.base.Optional;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.util.EnumChatFormatting;
import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.entity.player.User;
import org.spongepowered.api.scoreboard.Team;
import org.spongepowered.api.scoreboard.Visibility;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.Texts;
import org.spongepowered.api.text.format.TextColor;
import org.spongepowered.api.text.format.TextColors;
import org.spongepowered.api.util.annotation.NonnullByDefault;
import org.spongepowered.api.world.ChunkManager;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
import org.spongepowered.asm.mixin.Intrinsic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.common.Sponge;
import org.spongepowered.common.interfaces.IMixinScoreboard;
import org.spongepowered.common.interfaces.IMixinTeam;
import org.spongepowered.common.registry.SpongeGameRegistry;
import org.spongepowered.common.scoreboard.SpongeTeam;
import org.spongepowered.common.scoreboard.SpongeVisibility;
import org.spongepowered.common.text.format.SpongeTextColor;

import java.util.HashSet;
import java.util.Set;

@NonnullByDefault
Expand Down
Loading

0 comments on commit 825d95a

Please sign in to comment.