Various updates

This commit is contained in:
PseudoKnight 2017-06-19 23:35:08 -07:00
parent cbee91bbf3
commit 3be9124344
2 changed files with 50 additions and 47 deletions

34
pom.xml
View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.TheDgtl</groupId> <groupId>org.TheDgtl</groupId>
<artifactId>Stargate</artifactId> <artifactId>Stargate</artifactId>
<version>0.7.9.11</version> <version>0.7.9.11-SNAPSHOT</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
@ -20,15 +20,41 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.8-R0.1-SNAPSHOT</version> <version>1.12-R0.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.milkbowl.vault</groupId> <groupId>net.milkbowl.vault</groupId>
<artifactId>VaultAPI</artifactId> <artifactId>VaultAPI</artifactId>
<version>1.5</version> <version>1.6</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<sourceDirectory>${basedir}/src</sourceDirectory> <sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<targetPath>net/TheDgtl/Stargate/resources</targetPath>
<directory>src/net/TheDgtl/Stargate/resources</directory>
<includes>
<include>*.txt</include>
</includes>
</resource>
<resource>
<directory>src</directory>
<includes>
<include>*.yml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build> </build>
</project> </project>

View File

@ -973,29 +973,6 @@ public class Stargate extends JavaPlugin {
if ((!portal.isOpen()) && (!portal.isFixed())) { if ((!portal.isOpen()) && (!portal.isFixed())) {
portal.cycleDestination(player, -1); portal.cycleDestination(player, -1);
} }
return;
}
// Check if we're pushing a button.
if (block.getType() == Material.STONE_BUTTON) {
Portal portal = Portal.getByBlock(block);
if (portal == null) return;
event.setUseInteractedBlock(Result.DENY);
if (player.getGameMode().equals(GameMode.CREATIVE)) {
event.setCancelled(true);
}
boolean deny = false;
if (!Stargate.canAccessNetwork(player, portal.getNetwork())) {
deny = true;
}
if (!Stargate.canAccessPortal(player, portal, deny)) {
Stargate.sendMessage(player, Stargate.getString("denyMsg"));
return;
}
openPortal(player, portal);
} }
} }
} }
@ -1088,9 +1065,9 @@ public class Stargate extends JavaPlugin {
Portal portal = null; Portal portal = null;
// Handle keeping portal material and buttons around // Handle keeping portal material and buttons around
if (block.getTypeId() == 90) { if (block.getType() == Material.PORTAL) {
portal = Portal.getByEntrance(block); portal = Portal.getByEntrance(block);
} else if (block.getTypeId() == 77) { } else if (block.getType() == Material.STONE_BUTTON) {
portal = Portal.getByControl(block); portal = Portal.getByControl(block);
} }
if (portal != null) event.setCancelled(true); if (portal != null) event.setCancelled(true);
@ -1119,9 +1096,13 @@ public class Stargate extends JavaPlugin {
@EventHandler @EventHandler
public void onPistonRetract(BlockPistonRetractEvent event) { public void onPistonRetract(BlockPistonRetractEvent event) {
if (!event.isSticky()) return; if (!event.isSticky()) return;
Block affected = event.getRetractLocation().getBlock(); for(Block block : event.getBlocks()) {
Portal portal = Portal.getByBlock(affected); Portal portal = Portal.getByBlock(block);
if (portal != null) event.setCancelled(true); if (portal != null) {
event.setCancelled(true);
return;
}
}
} }
} }
@ -1140,10 +1121,14 @@ public class Stargate extends JavaPlugin {
public void onWorldUnload(WorldUnloadEvent event) { public void onWorldUnload(WorldUnloadEvent event) {
Stargate.debug("onWorldUnload", "Reloading all Stargates"); Stargate.debug("onWorldUnload", "Reloading all Stargates");
World w = event.getWorld(); World w = event.getWorld();
Portal.clearGates(); String location = Stargate.getSaveLocation();
for (World world : server.getWorlds()) { File db = new File(location, w.getName() + ".db");
if (world.equals(w)) continue; if (db.exists()) {
Portal.loadAllGates(world); Portal.clearGates();
for (World world : server.getWorlds()) {
if (world.equals(w)) continue;
Portal.loadAllGates(world);
}
} }
} }
} }
@ -1163,14 +1148,6 @@ public class Stargate extends JavaPlugin {
} }
} }
} }
// TODO: Uncomment when Bukkit pulls SnowmanTrailEvent
/*
@Override
public void onSnowmanTrail(SnowmanTrailEvent event) {
Portal p = Portal.getByEntrance(event.getBlock());
if (p != null) event.setCancelled(true);
}
*/
// Going to leave this commented out until they fix EntityDamagebyBlock // Going to leave this commented out until they fix EntityDamagebyBlock
/* /*
@ -1278,8 +1255,8 @@ public class Stargate extends JavaPlugin {
while (System.nanoTime() - sTime < 50000000) { while (System.nanoTime() - sTime < 50000000) {
BloxPopulator b = Stargate.blockPopulatorQueue.poll(); BloxPopulator b = Stargate.blockPopulatorQueue.poll();
if (b == null) return; if (b == null) return;
b.getBlox().getBlock().setTypeId(b.getMat()); b.getBlox().getBlock().setTypeId(b.getMat(), false);
b.getBlox().getBlock().setData(b.getData()); b.getBlox().getBlock().setData(b.getData(), false);
} }
} }
} }