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>
<groupId>org.TheDgtl</groupId>
<artifactId>Stargate</artifactId>
<version>0.7.9.11</version>
<version>0.7.9.11-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@ -20,15 +20,41 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
<version>1.12-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.5</version>
<version>1.6</version>
</dependency>
</dependencies>
<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>
</project>

View File

@ -973,29 +973,6 @@ public class Stargate extends JavaPlugin {
if ((!portal.isOpen()) && (!portal.isFixed())) {
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;
// Handle keeping portal material and buttons around
if (block.getTypeId() == 90) {
if (block.getType() == Material.PORTAL) {
portal = Portal.getByEntrance(block);
} else if (block.getTypeId() == 77) {
} else if (block.getType() == Material.STONE_BUTTON) {
portal = Portal.getByControl(block);
}
if (portal != null) event.setCancelled(true);
@ -1119,9 +1096,13 @@ public class Stargate extends JavaPlugin {
@EventHandler
public void onPistonRetract(BlockPistonRetractEvent event) {
if (!event.isSticky()) return;
Block affected = event.getRetractLocation().getBlock();
Portal portal = Portal.getByBlock(affected);
if (portal != null) event.setCancelled(true);
for(Block block : event.getBlocks()) {
Portal portal = Portal.getByBlock(block);
if (portal != null) {
event.setCancelled(true);
return;
}
}
}
}
@ -1140,10 +1121,14 @@ public class Stargate extends JavaPlugin {
public void onWorldUnload(WorldUnloadEvent event) {
Stargate.debug("onWorldUnload", "Reloading all Stargates");
World w = event.getWorld();
Portal.clearGates();
for (World world : server.getWorlds()) {
if (world.equals(w)) continue;
Portal.loadAllGates(world);
String location = Stargate.getSaveLocation();
File db = new File(location, w.getName() + ".db");
if (db.exists()) {
Portal.clearGates();
for (World world : server.getWorlds()) {
if (world.equals(w)) continue;
Portal.loadAllGates(world);
}
}
}
}
@ -1163,15 +1148,7 @@ 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
/*
@Override
@ -1278,8 +1255,8 @@ public class Stargate extends JavaPlugin {
while (System.nanoTime() - sTime < 50000000) {
BloxPopulator b = Stargate.blockPopulatorQueue.poll();
if (b == null) return;
b.getBlox().getBlock().setTypeId(b.getMat());
b.getBlox().getBlock().setData(b.getData());
b.getBlox().getBlock().setTypeId(b.getMat(), false);
b.getBlox().getBlock().setData(b.getData(), false);
}
}
}