Skip to content

Commit

Permalink
Fix remaining compile errors
Browse files Browse the repository at this point in the history
Note: Sponge version needs a number of things implemented before it will
actually run
  • Loading branch information
boy0001 committed Feb 19, 2016
1 parent 92b3ddb commit eabb5f3
Show file tree
Hide file tree
Showing 8 changed files with 263 additions and 279 deletions.
18 changes: 3 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</properties>

<build>
<finalName>${project.name}-Bukkit</finalName>
<finalName>${project.name}-Uber-${project.version}</finalName>
<sourceDirectory>src/main/java</sourceDirectory>

<resources>
Expand All @@ -78,7 +78,7 @@
TODO: fix sponge compilation
-->

<!-- Invalid
<!-- Invalid -->
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
Expand Down Expand Up @@ -129,7 +129,6 @@
</execution>
</executions>
</plugin>
-->

<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -138,9 +137,6 @@
<configuration>
<source>1.7</source>
<target>${javaVersion}</target>
<excludes>
<exclude>**/com/plotsquared/sponge/**</exclude>
</excludes>
</configuration>
</plugin>

Expand Down Expand Up @@ -200,8 +196,6 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>

<!--
<repository>
<id>sponge-maven-repo</id>
<url>http://repo.spongepowered.org/maven</url>
Expand All @@ -212,13 +206,10 @@
<enabled>true</enabled>
</snapshots>
</repository>
-->

<repository>
<id>sk89q</id>
<url>http://maven.sk89q.com/repo/</url>
</repository>

<repository>
<id>vault-repo</id>
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
Expand Down Expand Up @@ -249,8 +240,7 @@
</exclusion>
</exclusions>
</dependency>

<!-- Sponge API
<!-- Sponge API -->
<dependency>
<groupId>org.spongepowered</groupId>
<artifactId>spongeapi</artifactId>
Expand All @@ -264,8 +254,6 @@
</exclusion>
</exclusions>
</dependency>
-->

<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@ public ReflectionUtils(final String version) {
preClassM += "." + version;
}

public static <T> List<T> getStaticFields(Class clazz) {
ArrayList<T> list = new ArrayList<T>();
try {
Field[] fields = clazz.getFields();
for (int i = 0; i < fields.length; i++) {
Object value = fields[i].get(null);
try {
list.add((T) value);
} catch (ClassCastException e) {}
}
} catch (Throwable e) {
e.printStackTrace();
}
return list;
}

public static Class<?> getNmsClass(final String name) {
final String className = "net.minecraft.server." + version + "." + name;
return getClass(className);
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/plotsquared/sponge/SpongeMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
import com.plotsquared.sponge.util.SpongeTaskManager;
import com.plotsquared.sponge.util.SpongeTitleManager;
import com.plotsquared.sponge.util.SpongeUtil;
import com.plotsquared.sponge.util.SpongeWorldUtil;
import com.plotsquared.sponge.util.block.FastQueue;
import com.plotsquared.sponge.util.block.SlowQueue;
import com.plotsquared.sponge.uuid.SpongeLowerOfflineUUIDWrapper;
Expand Down Expand Up @@ -421,7 +420,7 @@ public PlotQueue initPlotQueue() {

@Override
public WorldUtil initWorldUtil() {
return new SpongeWorldUtil();
return new SpongeUtil();
}

@Override
Expand Down
19 changes: 6 additions & 13 deletions src/main/java/com/plotsquared/sponge/util/SpongeChunkManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,11 @@
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
import com.intellectualcrafters.plot.util.TaskManager;

public class SpongeChunkManager extends ChunkManager {

@Override
public void setChunk(final ChunkWrapper loc, final PlotBlock[][] result) {
// TODO Auto-generated method stub
}

@Override
public int[] countEntities(final Plot plot) {
final Location pos1 = plot.getBottomAbs();
Expand Down Expand Up @@ -94,12 +87,6 @@ public boolean copyRegion(final Location pos1, final Location pos2, final Locati
return false;
}

@Override
public boolean regenerateRegion(final Location pos1, final Location pos2, final Runnable whenDone) {
TaskManager.runTask(whenDone);
return false;
}

@Override
public void clearAllEntities(final Location pos1, final Location pos2) {
final String worldname = pos1.getWorld();
Expand Down Expand Up @@ -139,4 +126,10 @@ public void unloadChunk(String world, ChunkLoc loc, boolean save, boolean safe)
}
}

@Override
public boolean regenerateRegion(Location pos1, Location pos2, boolean ignoreAugment, Runnable whenDone) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void open(final PlotInventory inv) {
final SpongePlayer sp = (SpongePlayer) inv.player;
final Player player = sp.player;

final CustomInventory inventory = SpongeMain.THIS.getGame().getRegistry().createBuilder(CustomInventory.Builder.class).name(SpongeMain.THIS.getTranslation(inv.getTitle()).getTranslation()).size(inv.size).build();
final CustomInventory inventory = SpongeMain.THIS.getGame().getRegistry().createBuilder(CustomInventory.Builder.class).name(SpongeUtil.getTranslation(inv.getTitle())).size(inv.size).build();
final PlotItemStack[] items = inv.getItems();
for (int i = 0; i < (inv.size * 9); i++) {
final PlotItemStack item = items[i];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
package com.plotsquared.sponge.util;

import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.title.Title;

import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.AbstractTitle;
import com.plotsquared.sponge.SpongeMain;
import com.plotsquared.sponge.object.SpongePlayer;

public class SpongeTitleManager extends AbstractTitle {

@Override
public void sendTitle(final PlotPlayer player, final String head, final String sub, final int in, final int delay, final int out) {
final Title title = Title.builder().title(SpongeMain.THIS.getText(head)).subtitle(SpongeMain.THIS.getText(sub)).fadeIn(in * 20).stay
(delay * 20).fadeOut(out * 20).build();
final Title title = Title.builder()
.title(Text.of(head))
.subtitle(Text.of(sub))
.fadeIn(in * 20)
.stay(delay * 20)
.fadeOut(out * 20)
.build();
((SpongePlayer) player).player.sendTitle(title);
}
}
Loading

0 comments on commit eabb5f3

Please sign in to comment.