This commit is contained in:
Tastybento 2018-02-02 08:22:00 -08:00
commit 1427f16bec
8 changed files with 33 additions and 111 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
/bin/
.classpath
.project
/.settings/
*.iml
/target

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/bskyblock.iml" filepath="$PROJECT_DIR$/bskyblock.iml" />
</modules>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -1,43 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="EclipseModuleManager">
<conelement value="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER" />
<src_description expected_position="0">
<src_folder value="file://$MODULE_DIR$/src/main/java" expected_position="0" />
<src_folder value="file://$MODULE_DIR$/locales" expected_position="1" />
<src_folder value="file://$MODULE_DIR$/src/test/java" expected_position="2" />
</src_description>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/locales" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="jdk" jdkName="1.8 (1)" jdkType="JavaSDK" />
<orderEntry type="library" name="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER" level="application" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.10.19" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.12.2-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.19" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.powermock:powermock-module-junit4:1.7.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.powermock:powermock-module-junit4-common:1.7.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.powermock:powermock-reflect:1.7.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.powermock:powermock-core:1.7.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.powermock:powermock-api-mockito:1.7.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.powermock:powermock-api-mockito-common:1.7.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.powermock:powermock-api-support:1.7.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:1.10.19" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.1" level="project" />
</component>
</module>

View File

@ -23,7 +23,7 @@ public class ItemDropPickUpListener extends AbstractFlagListener {
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onVisitorDrop(PlayerDropItemEvent e) {
checkIsland(e, e.getItemDrop().getLocation(), Flags.VISITOR_ITEM_DROP);
checkIsland(e, e.getItemDrop().getLocation(), Flags.ITEM_DROP);
}
/*
@ -33,7 +33,7 @@ public class ItemDropPickUpListener extends AbstractFlagListener {
public void onVisitorDrop(EntityPickupItemEvent e) {
if (e.getEntity() instanceof Player) {
setUser(User.getInstance(e.getEntity()));
checkIsland(e, e.getItem().getLocation(), Flags.VISITOR_ITEM_PICKUP);
checkIsland(e, e.getItem().getLocation(), Flags.ITEM_PICKUP);
}
}
}

View File

@ -43,9 +43,9 @@ public class PVPListener extends AbstractFlagListener {
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityDamage(final EntityDamageByEntityEvent e) {
if (e.getEntity() instanceof Player) {
Flag flag = Flags.PVP;
if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.NETHER_PVP;
else if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.END_PVP;
Flag flag = Flags.PVP_OVERWORLD;
if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.PVP_NETHER;
else if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.PVP_END;
respond(e, e.getDamager(), flag);
}
}
@ -72,9 +72,9 @@ public class PVPListener extends AbstractFlagListener {
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onFishing(PlayerFishEvent e) {
if (e.getCaught() != null && e.getCaught() instanceof Player) {
Flag flag = Flags.PVP;
if (e.getCaught().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.NETHER_PVP;
else if (e.getCaught().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.END_PVP;
Flag flag = Flags.PVP_OVERWORLD;
if (e.getCaught().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.PVP_NETHER;
else if (e.getCaught().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.PVP_END;
if (checkIsland(e, e.getCaught().getLocation(), flag)) {
e.getHook().remove();
return;
@ -89,9 +89,9 @@ public class PVPListener extends AbstractFlagListener {
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onSplashPotionSplash(final PotionSplashEvent e) {
// Deduce the world
Flag flag = Flags.PVP;
if (e.getPotion().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.NETHER_PVP;
else if (e.getPotion().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.END_PVP;
Flag flag = Flags.PVP_OVERWORLD;
if (e.getPotion().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.PVP_NETHER;
else if (e.getPotion().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.PVP_END;
// Try to get the thrower
Projectile projectile = (Projectile) e.getEntity();
@ -138,9 +138,9 @@ public class PVPListener extends AbstractFlagListener {
if (e.getCause().equals(DamageCause.ENTITY_ATTACK) && thrownPotions.containsKey(e.getDamager().getEntityId())) {
// Deduce the world
Flag flag = Flags.PVP;
if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.NETHER_PVP;
else if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.END_PVP;
Flag flag = Flags.PVP_OVERWORLD;
if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())) flag = Flags.PVP_NETHER;
else if (e.getEntity().getWorld().equals(plugin.getIslandWorldManager().getEndWorld())) flag = Flags.PVP_END;
UUID attacker = thrownPotions.get(e.getDamager().getEntityId());
// Self damage

View File

@ -4,22 +4,7 @@ import org.bukkit.Material;
import us.tastybento.bskyblock.api.flags.Flag;
import us.tastybento.bskyblock.api.flags.FlagBuilder;
import us.tastybento.bskyblock.listeners.flags.BlockInteractionListener;
import us.tastybento.bskyblock.listeners.flags.BreakBlocksListener;
import us.tastybento.bskyblock.listeners.flags.BreedingListener;
import us.tastybento.bskyblock.listeners.flags.BucketListener;
import us.tastybento.bskyblock.listeners.flags.EggListener;
import us.tastybento.bskyblock.listeners.flags.EntityInteractListener;
import us.tastybento.bskyblock.listeners.flags.FireListener;
import us.tastybento.bskyblock.listeners.flags.HurtingListener;
import us.tastybento.bskyblock.listeners.flags.InventoryListener;
import us.tastybento.bskyblock.listeners.flags.LeashListener;
import us.tastybento.bskyblock.listeners.flags.PVPListener;
import us.tastybento.bskyblock.listeners.flags.PhysicalInteractionListener;
import us.tastybento.bskyblock.listeners.flags.PlaceBlocksListener;
import us.tastybento.bskyblock.listeners.flags.PortalListener;
import us.tastybento.bskyblock.listeners.flags.ShearingListener;
import us.tastybento.bskyblock.listeners.flags.TeleportationListener;
import us.tastybento.bskyblock.listeners.flags.*;
public class Flags {
/*
@ -43,8 +28,8 @@ public class Flags {
public static final Flag GATE = new FlagBuilder().id("GATE").allowedByDefault(true).icon(Material.FENCE_GATE).build();
public static final Flag MUSIC = new FlagBuilder().id("MUSIC").icon(Material.JUKEBOX).build();
public static final Flag LEVER_BUTTON = new FlagBuilder().id("LEVER_BUTTON").icon(Material.LEVER).build();
public static final Flag REDSTONE = new FlagBuilder().id("REDSTONE").icon(Material.REDSTONE).listener(new PlaceBlocksListener()).build();
public static final Flag SPAWN_EGGS = new FlagBuilder().id("SPAWN_EGGS").icon(Material.MONSTER_EGG).listener(new PlaceBlocksListener()).build();
public static final Flag REDSTONE = new FlagBuilder().id("REDSTONE").icon(Material.REDSTONE).build();
public static final Flag SPAWN_EGGS = new FlagBuilder().id("SPAWN_EGGS").icon(Material.MONSTER_EGG).build();
// Entity interactions
public static final Flag ARMOR_STAND = new FlagBuilder().id("ARMOR_STAND").icon(Material.ARMOR_STAND).listener(new EntityInteractListener()).build();
@ -99,22 +84,23 @@ public class Flags {
public static final Flag PORTAL = new FlagBuilder().id("PORTAL").icon(Material.OBSIDIAN).listener(new PortalListener()).build();
// PVP
public static final Flag PVP = new FlagBuilder().id("PVP").icon(Material.ARROW).listener(new PVPListener()).build();
public static final Flag NETHER_PVP = new FlagBuilder().id("NETHER_PVP").icon(Material.IRON_AXE).build();
public static final Flag END_PVP = new FlagBuilder().id("END_PVP").icon(Material.END_CRYSTAL).build();
public static final Flag PVP_OVERWORLD = new FlagBuilder().id("PVP_OVERWORLD").icon(Material.ARROW).listener(new PVPListener()).build();
public static final Flag PVP_NETHER = new FlagBuilder().id("PVP_NETHER").icon(Material.IRON_AXE).build();
public static final Flag PVP_END = new FlagBuilder().id("PVP_END").icon(Material.END_CRYSTAL).build();
// Shearing
public static final Flag SHEARING = new FlagBuilder().id("SHEARING").icon(Material.SHEARS).listener(new ShearingListener()).build();
// Visitor item pickup or drop
public static final Flag VISITOR_ITEM_DROP = new FlagBuilder().id("VISITOR_ITEM_DROP").icon(Material.DIRT).listener(new PlaceBlocksListener()).build();
public static final Flag VISITOR_ITEM_PICKUP = new FlagBuilder().id("VISITOR_ITEM_PICKUP").icon(Material.DIRT).listener(new PlaceBlocksListener()).build();
// Item pickup or drop
public static final Flag ITEM_DROP = new FlagBuilder().id("ITEM_DROP").icon(Material.DIRT).listener(new ItemDropPickUpListener()).build();
public static final Flag ITEM_PICKUP = new FlagBuilder().id("ITEM_PICKUP").icon(Material.DIRT).build();
/*
* Non-protection flags
*/
public static final Flag ENTER_EXIT_MESSAGES = new FlagBuilder().id("ENTER_EXIT_MESSAGES").icon(Material.DIRT).allowedByDefault(true).listener(new PlaceBlocksListener()).build();
public static final Flag MOB_SPAWN = new FlagBuilder().id("MOB_SPAWN").icon(Material.APPLE).allowedByDefault(true).listener(new PlaceBlocksListener()).build();
public static final Flag MONSTER_SPAWN = new FlagBuilder().id("MONSTER_SPAWN").icon(Material.MOB_SPAWNER).allowedByDefault(true).listener(new PlaceBlocksListener()).build();
public static final Flag ENTER_EXIT_MESSAGES = new FlagBuilder().id("ENTER_EXIT_MESSAGES").icon(Material.DIRT).allowedByDefault(true).build();
public static final Flag MOB_SPAWN = new FlagBuilder().id("MOB_SPAWN").icon(Material.APPLE).allowedByDefault(true).build();
public static final Flag MONSTER_SPAWN = new FlagBuilder().id("MONSTER_SPAWN").icon(Material.MOB_SPAWNER).allowedByDefault(true).build();
}