Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
update

Co-Authored-By: solmex72 <solmex72@users.noreply.github.com>
  • Loading branch information
2 people authored and keough99 committed Oct 19, 2018
1 parent af87ea3 commit c045a4a
Show file tree
Hide file tree
Showing 42 changed files with 3,102 additions and 4,181 deletions.
1 change: 1 addition & 0 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
Expand Down
7 changes: 7 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,11 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
<linkedResources>
<link>
<name>resources</name>
<type>2</type>
<location>C:/Users/keoug/Documents/GitHub/NavyCraft/src/test/resources</location>
</link>
</linkedResources>
</projectDescription>
1 change: 0 additions & 1 deletion .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
import org.bukkit.inventory.EquipmentSlot;

import com.maximuspayne.navycraft.NavyCraft;
import com.maximuspayne.navycraft.PermissionInterface;
import com.maximuspayne.navycraft.Utils;

import net.md_5.bungee.api.ChatColor;

public class AimCannonPlayerListener implements Listener {
public static AimCannon plugin;

public static void onPlayerInteract(PlayerInteractEvent event) {

if (event.getHand() != EquipmentSlot.HAND)
Expand All @@ -26,7 +26,6 @@ public static void onPlayerInteract(PlayerInteractEvent event) {
///////stone button
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK ) {
if (event.getClickedBlock().getType() == Material.STONE_BUTTON) {
NavyCraft.instance.DebugMessage("Plugin found stone button!", 3);
Block b = null;
if (event.getClickedBlock().getRelative(BlockFace.NORTH_EAST).getType() == Material.DISPENSER) {
b = event.getClickedBlock().getRelative(BlockFace.NORTH_EAST);
Expand Down Expand Up @@ -104,7 +103,6 @@ else if(event.getAction() == Action.LEFT_CLICK_BLOCK)

if( b != null )
{
NavyCraft.instance.DebugMessage("Block wasn't null!", 3);
for (OneCannon onec : AimCannon.getCannons())
{
if (onec.isThisCannon(b.getLocation(), false, false) && ( onec.cannonType == 3 || onec.cannonType == 7 || onec.cannonType == 8))
Expand All @@ -121,7 +119,6 @@ else if(event.getAction() == Action.LEFT_CLICK_BLOCK)
}
}
} else {
NavyCraft.instance.DebugMessage("Got to dropper detection", 3);
if( event.getClickedBlock().getRelative(BlockFace.NORTH).getType() == Material.DROPPER )
{
b = event.getClickedBlock().getRelative(BlockFace.NORTH);
Expand All @@ -137,12 +134,9 @@ else if(event.getAction() == Action.LEFT_CLICK_BLOCK)
}
if( b != null )
{
NavyCraft.instance.DebugMessage("Got to cannon detection method", 3);
for (OneCannon onec : AimCannon.getCannons())
{
NavyCraft.instance.DebugMessage("Got to type detection", 3);
if (onec.isThisCannon(b.getLocation(), false, true) && (onec.cannonType == 13 || onec.cannonType == 14 )) {
NavyCraft.instance.DebugMessage("Got to left click detection method", 3);
if( event.getAction() == Action.LEFT_CLICK_BLOCK )
onec.fireMissileButton(event.getPlayer(), true);
else
Expand Down Expand Up @@ -350,16 +344,14 @@ else if(event.getAction() == Action.LEFT_CLICK_BLOCK)
onec.turnCannon(false,event.getPlayer());
}
event.getPlayer().sendMessage("Cannon turned..");
event.setCancelled(true);
return;
}
}
}
}
}

}else { //b != null
if (PermissionInterface.CheckEnabledWorld(event.getPlayer().getLocation())) {
if (Utils.CheckEnabledWorld(event.getPlayer().getLocation())) {
for (OneCannon onec : AimCannon.getCannons()) {
if (onec.isThisCannon(b.getLocation(), false, false)) {
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
Expand All @@ -384,7 +376,7 @@ else if(event.getAction() == Action.LEFT_CLICK_BLOCK)
for (OneCannon onec : AimCannon.getCannons())
{
if (onec.isThisCannon(event.getClickedBlock().getLocation(), false, false) || onec.isThisCannon(event.getClickedBlock().getLocation(), false, true)) {
if (PermissionInterface.CheckEnabledWorld(event.getClickedBlock().getLocation()) && !NavyCraft.checkSafeDockRegion(event.getClickedBlock().getLocation())) {
if (Utils.CheckEnabledWorld(event.getClickedBlock().getLocation()) && !NavyCraft.checkSafeDockRegion(event.getClickedBlock().getLocation())) {
if( event.getAction() == Action.LEFT_CLICK_BLOCK )
onec.Charge(event.getPlayer(), true);
else
Expand All @@ -401,7 +393,7 @@ else if(event.getAction() == Action.LEFT_CLICK_BLOCK)
// new Cannon
OneCannon oc = new OneCannon(event.getClickedBlock().getLocation(), NavyCraft.instance);
if ((oc.isValidCannon(event.getClickedBlock(), false) && event.getClickedBlock().getType() == Material.DISPENSER) || (oc.isValidCannon(event.getClickedBlock(), true) && event.getClickedBlock().getType() == Material.DROPPER)) {
if (PermissionInterface.CheckEnabledWorld(event.getClickedBlock().getLocation()) && !NavyCraft.checkSafeDockRegion(event.getClickedBlock().getLocation())) {
if (Utils.CheckEnabledWorld(event.getClickedBlock().getLocation()) && !NavyCraft.checkSafeDockRegion(event.getClickedBlock().getLocation())) {
if( event.getAction() == Action.LEFT_CLICK_BLOCK )
oc.Charge(event.getPlayer(), true);
else
Expand All @@ -421,7 +413,7 @@ else if(event.getAction() == Action.LEFT_CLICK_BLOCK)

@SuppressWarnings("deprecation")
public static void onBlockDispense(BlockDispenseEvent event) {
if( event.getBlock() != null && event.getBlock().getTypeId() == 23 )
if( event.getBlock() != null && (event.getBlock().getTypeId() == 23 || event.getBlock().getTypeId() == 158))
{
for (OneCannon onec : AimCannon.getCannons())
{
Expand Down
Loading

0 comments on commit c045a4a

Please sign in to comment.