/*
 * Copyright 2015 CrystalCraftMC
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package com.crystalcraftmc.iceball.main;

import com.crystalcraftmc.iceball.api.Utility;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;

/**Handles events related to gameplay*/
public class GameplayListener implements Listener {
	
	IceBall plugin;
	
	public GameplayListener(IceBall plugin) {
		this.plugin = plugin;
		plugin.getServer().getPluginManager().registerEvents(this, plugin);
	}
	
	@EventHandler
	public void tpBelow(PlayerInteractEvent e) {
		if(e.getAction() == Action.PHYSICAL) {
			Block b = e.getClickedBlock();
			if(Utility.isInsideSnowball(b.getLocation(), plugin)) {
				if(b.getType() == Material.IRON_PLATE) {
					Player p = e.getPlayer();
					int centerx = (plugin.snowballArea[0]+plugin.snowballArea[3])/2;
					int centerz = (plugin.snowballArea[2]+plugin.snowballArea[5])/2;
					int xOff = centerx > p.getLocation().getX() ? 1 : -1;
					int zOff = centerz > p.getLocation().getZ() ? 1 : -1;
					Location tp = p.getLocation().add(xOff, -3, zOff);
					tp.setPitch(15);
					if(xOff > 0 && zOff > 0)
						tp.setYaw(-45);
					else if(xOff > 0 && zOff < 0)
						tp.setYaw(-135);
					else if(xOff < 0 && zOff > 0)
						tp.setYaw(45);
					else if(xOff < 0 && zOff < 0)
						tp.setYaw(135);
					p.teleport(tp);
				}
			}
		}
	}
	
	@EventHandler
	public void noPvp(EntityDamageByEntityEvent e) {
		if(e.getEntity() instanceof Player) {
			Player p = (Player)e.getEntity();
			if(Utility.isInsideSnowball(p.getLocation(), plugin)) {
				if(e.getDamage() > 0) {
					e.setCancelled(true);
				}
			}
		}
	}
	
}

@@ -1,630 +1,4 @@
-/*%0A * Copyright 2015 CrystalCraftMC%0A *%0A *    Licensed under the Apache License, Version 2.0 (the %22License%22);%0A *    you may not use this file except in compliance with the License.%0A *    You may obtain a copy of the License at%0A *%0A *        http://www.apache.org/licenses/LICENSE-2.0%0A *%0A *    Unless required by applicable law or agreed to in writing, software%0A *    distributed under the License is distributed on an %22AS IS%22 BASIS,%0A *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A *    See the License for the specific language governing permissions and%0A *    limitations under the License.%0A */%0A%0A
 pack
@@ -16,27 +16,28 @@
 stalcraftmc.
-ice
+snow
 ball.main;%0A%0A
@@ -40,55 +40,8 @@
 n;%0A%0A
-import com.crystalcraftmc.iceball.api.Utility;%0A
 impo
@@ -377,16 +377,65 @@
 Event;%0A%0A
+import com.crystalcraftmc.snowball.api.Utility;%0A%0A
 /**Handl
@@ -521,20 +521,21 @@
 er %7B%0A%09%0A%09
-IceB
+Snowb
 all plug
@@ -569,12 +569,13 @@
 ner(
-IceB
+Snowb
 all 
@@ -865,32 +865,39 @@
 cation(), plugin
+, false
 )) %7B%0A%09%09%09%09if(b.ge
@@ -1757,16 +1757,23 @@
 , plugin
+, false
 )) %7B%0A%09%09%09

Update GameplayListener.java