1
0
mirror of https://e.coding.net/circlecloud/ResExtras.git synced 2024-11-21 10:38:47 +00:00

首次提交...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2015-12-14 21:08:14 +08:00
commit 4d47b6c8c3
60 changed files with 2560 additions and 0 deletions

31
.classpath Normal file
View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

38
.gitignore vendored Normal file
View File

@ -0,0 +1,38 @@
# Eclipse stuff
/.settings
# netbeans
/nbproject
# we use maven!
/build.xml
# maven
/target
/repo
# vim
.*.sw[a-p]
# various other potential build files
/build
/bin
/dist
/manifest.mf
/world
# Mac filesystem dust
*.DS_Store
# intellij
*.iml
*.ipr
*.iws
.idea/
# Project Stuff
/src/main/resources/Soulbound
# Atlassian Stuff
/atlassian-ide-plugin.xml

23
.project Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ResExtras</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

85
pom.xml Normal file
View File

@ -0,0 +1,85 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.citycraft</groupId>
<artifactId>ResExtras</artifactId>
<version>1.0</version>
<name>ResExtras</name>
<description>领地扩展</description>
<build>
<finalName>${project.name}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
<artifactSet>
<includes>
<include>cn.citycraft:PluginHelper</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>cn.citycraft.PluginHelper</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
<update.description></update.description>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>citycraft-repo</id>
<url>${jenkins.url}/plugin/repository/everything/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<type>jar</type>
<version>1.8.8-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.citycraft</groupId>
<artifactId>Residence</artifactId>
<type>jar</type>
<version>2.8.1.4</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,627 @@
package cn.citycraft.ResExtras;
import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.Configuration;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
import cn.citycraft.ResExtras.flags.animalkilling;
import cn.citycraft.ResExtras.flags.bat;
import cn.citycraft.ResExtras.flags.blaze;
import cn.citycraft.ResExtras.flags.blockdamage;
import cn.citycraft.ResExtras.flags.cavespider;
import cn.citycraft.ResExtras.flags.chicken;
import cn.citycraft.ResExtras.flags.commands;
import cn.citycraft.ResExtras.flags.cow;
import cn.citycraft.ResExtras.flags.creeperspawn;
import cn.citycraft.ResExtras.flags.drops;
import cn.citycraft.ResExtras.flags.eggs;
import cn.citycraft.ResExtras.flags.enderman;
import cn.citycraft.ResExtras.flags.enderpearl;
import cn.citycraft.ResExtras.flags.falldamage;
import cn.citycraft.ResExtras.flags.fishing;
import cn.citycraft.ResExtras.flags.form;
import cn.citycraft.ResExtras.flags.ghast;
import cn.citycraft.ResExtras.flags.god;
import cn.citycraft.ResExtras.flags.grow;
import cn.citycraft.ResExtras.flags.hunger;
import cn.citycraft.ResExtras.flags.irongolem;
import cn.citycraft.ResExtras.flags.lightning;
import cn.citycraft.ResExtras.flags.magmacube;
import cn.citycraft.ResExtras.flags.melt;
import cn.citycraft.ResExtras.flags.mobkilling;
import cn.citycraft.ResExtras.flags.mooshroom;
import cn.citycraft.ResExtras.flags.ocelot;
import cn.citycraft.ResExtras.flags.pickup;
import cn.citycraft.ResExtras.flags.pig;
import cn.citycraft.ResExtras.flags.pigsaddle;
import cn.citycraft.ResExtras.flags.pigzap;
import cn.citycraft.ResExtras.flags.portal;
import cn.citycraft.ResExtras.flags.shear;
import cn.citycraft.ResExtras.flags.sheep;
import cn.citycraft.ResExtras.flags.silverfish;
import cn.citycraft.ResExtras.flags.skeleton;
import cn.citycraft.ResExtras.flags.slime;
import cn.citycraft.ResExtras.flags.slimesplit;
import cn.citycraft.ResExtras.flags.sneak;
import cn.citycraft.ResExtras.flags.snowgolem;
import cn.citycraft.ResExtras.flags.spider;
import cn.citycraft.ResExtras.flags.sprint;
import cn.citycraft.ResExtras.flags.squid;
import cn.citycraft.ResExtras.flags.time;
import cn.citycraft.ResExtras.flags.trade;
import cn.citycraft.ResExtras.flags.vehicleprotect;
import cn.citycraft.ResExtras.flags.villager;
import cn.citycraft.ResExtras.flags.villagerkilling;
import cn.citycraft.ResExtras.flags.weather;
import cn.citycraft.ResExtras.flags.witch;
import cn.citycraft.ResExtras.flags.witherspawn;
import cn.citycraft.ResExtras.flags.wolf;
import cn.citycraft.ResExtras.flags.zombie;
import cn.citycraft.ResExtras.flags.zombiepigmen;
public class ResExtras extends JavaPlugin implements CommandExecutor {
public static final String PLUGIN_NAME = "ResExtras";
public static final String LOG_HEADER = "[" + PLUGIN_NAME + "] ";
private Logger log;
public Configuration config;
// very long config
// Going to make this shorter but I'm too lazy
// To be honest I just made it like that way since it was in my other plugin so I just copy and pasta'd I'm really lazy :3
// and I like making little stories in my code...I'm insane o.o
/*
* I love ramen since its like the only thing I actually know how to make. I used to make
* pancakes but I forgot how to make them which kinda pisses me off. Oh by the way I'm
* only 17 :P. Its nice to know that someone has to read this (I think) since one of my friends
* is on the DevBukkit team so its nice to meet you :D. You can even message me on Bukkit(Tonkovich)
* just so I know you read this. Well thats all I really know what to type since I kinda just typed
* random stuff. I have a pokeball :3
*
* Dafuq did you just read o.O
*/
public void loadDefaults() {
final FileConfiguration configG = getConfig();
final File configFile = new File("plugins/ResExtras/config.yml");
config = YamlConfiguration.loadConfiguration(configFile);
configG.options().header("This completely disables parts of ResExtras increasing efficiency.");
if (config.contains("Zombie")) {
} else {
getConfig().addDefault("Zombie", true);
}
if (config.contains("Skeleton")) {
} else {
getConfig().addDefault("Skeleton", true);
}
if (config.contains("Spider")) {
} else {
getConfig().addDefault("Spider", true);
}
if (config.contains("Creeperspawn")) {
} else {
getConfig().addDefault("Creeperspawn", true);
}
if (config.contains("Blaze")) {
} else {
getConfig().addDefault("Blaze", true);
}
if (config.contains("Cavespider")) {
} else {
getConfig().addDefault("Cavespider", true);
}
if (config.contains("Ghast")) {
} else {
getConfig().addDefault("Ghast", true);
}
if (config.contains("Slime")) {
} else {
getConfig().addDefault("Slime", true);
}
if (config.contains("Magmacube")) {
} else {
getConfig().addDefault("Magmacube", true);
}
if (config.contains("Silverfish")) {
} else {
getConfig().addDefault("Silverfish", true);
}
if (config.contains("Snowgolem")) {
} else {
getConfig().addDefault("Snowgolem", true);
}
if (config.contains("Irongolem")) {
} else {
getConfig().addDefault("Irongolem", true);
}
if (config.contains("Enderman")) {
} else {
getConfig().addDefault("Enderman", true);
}
if (config.contains("Zombiepigmen")) {
} else {
getConfig().addDefault("Zombiepigmen", true);
}
if (config.contains("Chicken")) {
} else {
getConfig().addDefault("Chicken", true);
}
if (config.contains("Cow")) {
} else {
getConfig().addDefault("Cow", true);
}
if (config.contains("Mooshroom")) {
} else {
getConfig().addDefault("Mooshroom", true);
}
if (config.contains("Ocelot")) {
} else {
getConfig().addDefault("Ocelot", true);
}
if (config.contains("Pig")) {
} else {
getConfig().addDefault("Pig", true);
}
if (config.contains("Sheep")) {
} else {
getConfig().addDefault("Sheep", true);
}
if (config.contains("Squid")) {
} else {
getConfig().addDefault("Squid", true);
}
if (config.contains("Villager")) {
} else {
getConfig().addDefault("Villager", true);
}
if (config.contains("Wolf")) {
} else {
getConfig().addDefault("Wolf", true);
}
if (config.contains("Bat")) {
} else {
getConfig().addDefault("Bat", true);
}
if (config.contains("Witherspawn")) {
} else {
getConfig().addDefault("Witherspawn", true);
}
if (config.contains("Witch")) {
} else {
getConfig().addDefault("Witch", true);
}
if (config.contains("Form")) {
} else {
getConfig().addDefault("Form", true);
}
if (config.contains("Melt")) {
} else {
getConfig().addDefault("Melt", true);
}
if (config.contains("Commands")) {
} else {
getConfig().addDefault("Commands", true);
}
if (config.contains("Falldamage")) {
} else {
getConfig().addDefault("Falldamage", true);
}
if (config.contains("Portal")) {
} else {
getConfig().addDefault("Portal", true);
}
if (config.contains("Enderpearl")) {
} else {
getConfig().addDefault("Enderpearl", true);
}
if (config.contains("Mobkilling")) {
} else {
getConfig().addDefault("Mobkilling", true);
}
if (config.contains("Animalkilling")) {
} else {
getConfig().addDefault("Animalkilling", true);
}
if (config.contains("Villagerkilling")) {
} else {
getConfig().addDefault("Villagerkilling", true);
}
if (config.contains("Drops")) {
} else {
getConfig().addDefault("Drops", true);
}
if (config.contains("Pickup")) {
} else {
getConfig().addDefault("Pickup", true);
}
if (config.contains("Vehicleprotect")) {
} else {
getConfig().addDefault("Vehicleprotect", true);
}
if (config.contains("Lightning")) {
} else {
getConfig().addDefault("Lightning", true);
}
if (config.contains("Grow")) {
} else {
getConfig().addDefault("Grow", true);
}
if (config.contains("Hunger")) {
} else {
getConfig().addDefault("Hunger", true);
}
if (config.contains("Sprint")) {
} else {
getConfig().addDefault("Sprint", true);
}
if (config.contains("Fishing")) {
} else {
getConfig().addDefault("Fishing", true);
}
if (config.contains("Eggs")) {
} else {
getConfig().addDefault("Eggs", true);
}
if (config.contains("Sneak")) {
} else {
getConfig().addDefault("Sneak", true);
}
if (config.contains("Pigzap")) {
} else {
getConfig().addDefault("Pigzap", true);
}
if (config.contains("Slimesplit")) {
} else {
getConfig().addDefault("Slimesplit", true);
}
if (config.contains("Shear")) {
} else {
getConfig().addDefault("Shear", true);
}
if (config.contains("Pigsaddle")) {
} else {
getConfig().addDefault("Pigsaddle", true);
}
if (config.contains("Trade")) {
} else {
getConfig().addDefault("Trade", true);
}
if (config.contains("God")) {
} else {
getConfig().addDefault("God", true);
}
if (config.contains("Time")) {
} else {
getConfig().addDefault("Time", true);
}
if (config.contains("Weather")) {
} else {
getConfig().addDefault("Weather", true);
}
if (config.contains("BlockDamage")) {
} else {
getConfig().addDefault("BlockDamage", true);
}
/*
* if(config.contains("CrystalProtect")){
* }
* else {
* getConfig().addDefault("CrystalProtect", true);
* }
*/
configG.options().copyDefaults(true);
saveConfig();
}
public void logError(final String _message) {
log.log(Level.SEVERE, String.format("%s %s", LOG_HEADER, _message));
}
public void logInfo(final String _message) {
log.log(Level.INFO, String.format("%s %s", LOG_HEADER, _message));
}
@Override
public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
if (sender instanceof Player) {
if (args.length == 0) {
if (cmd.getName().equalsIgnoreCase("resextras")) {
if (sender.hasPermission("ResExtras.help")) {
sender.sendMessage(ChatColor.GOLD + "----------------" + ChatColor.BLUE + "[ResExtras] Help Menu" + ChatColor.GOLD + "----------------");
sender.sendMessage(ChatColor.RED + "/ResExtras" + ChatColor.GREEN + " Displays help menu ");
sender.sendMessage(ChatColor.RED + "/ResExtras help" + ChatColor.GREEN + " Displays help menu ");
sender.sendMessage(ChatColor.RED + "/ResExtras version" + ChatColor.GREEN + " Displays version Number ");
sender.sendMessage(ChatColor.RED + "/ResExtras list" + ChatColor.GREEN + " Displays flag list ");
sender.sendMessage(ChatColor.GOLD + "---------------------------------------------------");
}
}
}
if (args.length == 1) {
if (args[0].equalsIgnoreCase("version")) {
if (sender.hasPermission("ResExtras.version")) {
sender.sendMessage(ChatColor.BLUE + "[ResExtras]" + ChatColor.GREEN + " v2.0.5 ");
}
}
if (args[0].equalsIgnoreCase("list")) {
if (sender.hasPermission("ResExtras.list")) {
sender.sendMessage(ChatColor.BLUE + "[ResExtras]" + ChatColor.GREEN + " Flags");
sender.sendMessage(ChatColor.WHITE
+ " Zombie, Skeleton, Spider, Creeperspawn, Blaze, Cavespider, Ghast, Slime, Magmacube, Silverfish, Snowgolem, Irongolem, Enderman, Zombiepigmen, Chicken, Cow, Mooshroom, Ocelot, Pig, Sheep, Squid, Villager, Wolf, Bat, Witherspawn, Witch, Form, Melt, Commands, FallDamage, Portal, Enderperal, Mobkilling, AnimalKilling, VillagerKilling, Drops, Pickup, VehicleProtect, Lightning, Grow, Hunger, Sprint, Fishing, Eggs, Sneak, PigZap, SlimeSplit, Shear, PigSaddle, Trade, God, Weather, Time, BlockDamage ");
}
}
if (args[0].equalsIgnoreCase("help")) {
if (sender.hasPermission("ResExtras.help")) {
sender.sendMessage(ChatColor.GOLD + "----------------" + ChatColor.BLUE + "[ResExtras] Help Menu" + ChatColor.GOLD + "----------------");
sender.sendMessage(ChatColor.RED + "/ResExtras" + ChatColor.GREEN + " Displays help menu ");
sender.sendMessage(ChatColor.RED + "/ResExtras help" + ChatColor.GREEN + " Displays help menu ");
sender.sendMessage(ChatColor.RED + "/ResExtras version" + ChatColor.GREEN + " Displays version Number ");
sender.sendMessage(ChatColor.RED + "/ResExtras list" + ChatColor.GREEN + " Displays flag list ");
sender.sendMessage(ChatColor.GOLD + "---------------------------------------------------");
}
}
}
return true;
}
return true;
}
@Override
public void onDisable() {
saveConfig();
}
// very long start up lolz
@Override
public void onEnable() {
log = Logger.getLogger("Minecraft");
loadDefaults();
final PluginManager pm = getServer().getPluginManager();
final Plugin p = pm.getPlugin("Residence");
if (p != null) {
if (p.isEnabled()) {
logInfo("Enabled");
pm.enablePlugin(p);
FlagPermissions.addResidenceOnlyFlag("zombie");
FlagPermissions.addResidenceOnlyFlag("skeleton");
FlagPermissions.addResidenceOnlyFlag("creeperspawn");
FlagPermissions.addResidenceOnlyFlag("spider");
FlagPermissions.addResidenceOnlyFlag("cavespider");
FlagPermissions.addResidenceOnlyFlag("slime");
FlagPermissions.addResidenceOnlyFlag("ghast");
FlagPermissions.addResidenceOnlyFlag("blaze");
FlagPermissions.addResidenceOnlyFlag("magmacube");
FlagPermissions.addResidenceOnlyFlag("silverfish");
FlagPermissions.addResidenceOnlyFlag("snowgolem");
FlagPermissions.addResidenceOnlyFlag("irongolem");
FlagPermissions.addResidenceOnlyFlag("enderman");
FlagPermissions.addResidenceOnlyFlag("wolf");
FlagPermissions.addResidenceOnlyFlag("zombiepigmen");
FlagPermissions.addResidenceOnlyFlag("chicken");
FlagPermissions.addResidenceOnlyFlag("cow");
FlagPermissions.addResidenceOnlyFlag("mooshroom");
FlagPermissions.addResidenceOnlyFlag("ocelot");
FlagPermissions.addResidenceOnlyFlag("pig");
FlagPermissions.addResidenceOnlyFlag("sheep");
FlagPermissions.addResidenceOnlyFlag("squid");
FlagPermissions.addResidenceOnlyFlag("villager");
FlagPermissions.addResidenceOnlyFlag("bat");
FlagPermissions.addResidenceOnlyFlag("witch");
FlagPermissions.addResidenceOnlyFlag("witherspawn");
FlagPermissions.addResidenceOnlyFlag("melt");
FlagPermissions.addResidenceOnlyFlag("form");
FlagPermissions.addFlag("drops");
FlagPermissions.addFlag("pickup");
FlagPermissions.addFlag("animalkilling");
FlagPermissions.addFlag("villagerkilling");
FlagPermissions.addFlag("mobkilling");
FlagPermissions.addFlag("falldamage");
FlagPermissions.addFlag("enderpearl");
FlagPermissions.addFlag("commands");
FlagPermissions.addFlag("portal");
FlagPermissions.addFlag("vehicleprotect");
FlagPermissions.addResidenceOnlyFlag("lightning");
FlagPermissions.addResidenceOnlyFlag("grow");
FlagPermissions.addFlag("hunger");
FlagPermissions.addFlag("sprint");
FlagPermissions.addFlag("fishing");
FlagPermissions.addFlag("eggs");
FlagPermissions.addFlag("sneak");
FlagPermissions.addResidenceOnlyFlag("pigzap");
FlagPermissions.addFlag("slimesplit");
FlagPermissions.addFlag("shear");
FlagPermissions.addFlag("pigsaddle");
FlagPermissions.addFlag("trade");
FlagPermissions.addFlag("god");
FlagPermissions.addResidenceOnlyFlag("weather");
FlagPermissions.addResidenceOnlyFlag("day");
FlagPermissions.addResidenceOnlyFlag("night");
FlagPermissions.addResidenceOnlyFlag("blockdamage");
// FlagPermissions.addFlag("crystalprotect");
if (getConfig().getBoolean("Zombie", true)) {
pm.registerEvents(new zombie(), this);
}
if (getConfig().getBoolean("Skeleton", true)) {
pm.registerEvents(new skeleton(), this);
}
if (getConfig().getBoolean("Creeperspawn", true)) {
pm.registerEvents(new creeperspawn(), this);
}
if (getConfig().getBoolean("Spider", true)) {
pm.registerEvents(new spider(), this);
}
if (getConfig().getBoolean("Cavespider", true)) {
pm.registerEvents(new cavespider(), this);
}
if (getConfig().getBoolean("Slime", true)) {
pm.registerEvents(new slime(), this);
}
if (getConfig().getBoolean("Ghast", true)) {
pm.registerEvents(new ghast(), this);
}
if (getConfig().getBoolean("Blaze", true)) {
pm.registerEvents(new blaze(), this);
}
if (getConfig().getBoolean("Magmacube", true)) {
pm.registerEvents(new magmacube(), this);
}
if (getConfig().getBoolean("Silverfish", true)) {
pm.registerEvents(new silverfish(), this);
}
if (getConfig().getBoolean("Snowgolem", true)) {
pm.registerEvents(new snowgolem(), this);
}
if (getConfig().getBoolean("Irongolem", true)) {
pm.registerEvents(new irongolem(), this);
}
if (getConfig().getBoolean("Enderman", true)) {
pm.registerEvents(new enderman(), this);
}
if (getConfig().getBoolean("Chicken", true)) {
pm.registerEvents(new chicken(), this);
}
if (getConfig().getBoolean("Cow", true)) {
pm.registerEvents(new cow(), this);
}
if (getConfig().getBoolean("Wolf", true)) {
pm.registerEvents(new wolf(), this);
}
if (getConfig().getBoolean("Mooshroom", true)) {
pm.registerEvents(new mooshroom(), this);
}
if (getConfig().getBoolean("Ocelot", true)) {
pm.registerEvents(new ocelot(), this);
}
if (getConfig().getBoolean("Zombiepigmen", true)) {
pm.registerEvents(new zombiepigmen(), this);
}
if (getConfig().getBoolean("Pig", true)) {
pm.registerEvents(new pig(), this);
}
if (getConfig().getBoolean("Sheep", true)) {
pm.registerEvents(new sheep(), this);
}
if (getConfig().getBoolean("Squid", true)) {
pm.registerEvents(new squid(), this);
}
if (getConfig().getBoolean("Villager", true)) {
pm.registerEvents(new villager(), this);
}
if (getConfig().getBoolean("Bat", true)) {
pm.registerEvents(new bat(), this);
}
if (getConfig().getBoolean("Witch", true)) {
pm.registerEvents(new witch(), this);
}
if (getConfig().getBoolean("Witherspawn", true)) {
pm.registerEvents(new witherspawn(), this);
}
if (getConfig().getBoolean("Melt", true)) {
pm.registerEvents(new melt(), this);
}
if (getConfig().getBoolean("Form", true)) {
pm.registerEvents(new form(), this);
}
if (getConfig().getBoolean("Animalkilling", true)) {
pm.registerEvents(new animalkilling(), this);
}
if (getConfig().getBoolean("Mobkilling", true)) {
pm.registerEvents(new mobkilling(), this);
}
if (getConfig().getBoolean("Drops", true)) {
pm.registerEvents(new drops(), this);
}
if (getConfig().getBoolean("Pickup", true)) {
pm.registerEvents(new pickup(), this);
}
if (getConfig().getBoolean("Commands", true)) {
pm.registerEvents(new commands(), this);
}
if (getConfig().getBoolean("Enderpearl", true)) {
pm.registerEvents(new enderpearl(), this);
}
if (getConfig().getBoolean("Falldamage", true)) {
pm.registerEvents(new falldamage(), this);
}
if (getConfig().getBoolean("Portal", true)) {
pm.registerEvents(new portal(), this);
}
if (getConfig().getBoolean("Villagerkilling", true)) {
pm.registerEvents(new villagerkilling(), this);
}
if (getConfig().getBoolean("Vehicleprotect", true)) {
pm.registerEvents(new vehicleprotect(), this);
}
if (getConfig().getBoolean("Lightning", true)) {
pm.registerEvents(new lightning(), this);
}
if (getConfig().getBoolean("Grow", true)) {
pm.registerEvents(new grow(), this);
}
if (getConfig().getBoolean("Hunger", true)) {
pm.registerEvents(new hunger(), this);
}
if (getConfig().getBoolean("Sprint", true)) {
pm.registerEvents(new sprint(), this);
}
if (getConfig().getBoolean("Fishing", true)) {
pm.registerEvents(new fishing(), this);
}
if (getConfig().getBoolean("Eggs", true)) {
pm.registerEvents(new eggs(), this);
}
if (getConfig().getBoolean("Sneak", true)) {
pm.registerEvents(new sneak(), this);
}
if (getConfig().getBoolean("Pigzap", true)) {
pm.registerEvents(new pigzap(), this);
}
if (getConfig().getBoolean("Slimesplit", true)) {
pm.registerEvents(new slimesplit(), this);
}
if (getConfig().getBoolean("Shear", true)) {
pm.registerEvents(new shear(), this);
}
if (getConfig().getBoolean("Pigsaddle", true)) {
pm.registerEvents(new pigsaddle(), this);
}
if (getConfig().getBoolean("Trade", true)) {
pm.registerEvents(new trade(), this);
}
if (getConfig().getBoolean("God", true)) {
pm.registerEvents(new god(), this);
}
if (getConfig().getBoolean("Weather", true)) {
pm.registerEvents(new weather(), this);
}
if (getConfig().getBoolean("Time", true)) {
pm.registerEvents(new time(), this);
}
if (getConfig().getBoolean("BlockDamage", true)) {
pm.registerEvents(new blockdamage(), this);
}
/*
* if(getConfig().getBoolean("CrystalProtect", true)){
* pm.registerEvents(new crystalprotect(), this);
* }
*/
}
} else {
logInfo("Can't find plugin Residence!");
this.setEnabled(false);
}
}
}

View File

@ -0,0 +1,51 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.IronGolem;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowman;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class animalkilling implements Listener {
public Player cause;
@EventHandler(priority = EventPriority.NORMAL)
public void AnimalKilling(final EntityDamageByEntityEvent event) {
if (event.isCancelled()) {
return;
}
final Entity damager = event.getDamager();
if ((!(damager instanceof Arrow)) && (!(damager instanceof Player))) {
return;
}
if ((damager instanceof Arrow) && (!(((Arrow) damager).getShooter() instanceof Player))) {
return;
} else if (damager instanceof Player) {
cause = (Player) damager;
} else {
cause = (Player) ((Arrow) damager).getShooter();
}
final boolean resadmin = Residence.isResAdminOn(cause);
if (resadmin) {
return;
}
final Entity entity = event.getEntity();
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(entity.getLocation());
if (res != null && !res.getPermissions().playerHas(cause.getName().toString(), "animalkilling", true)) {
if ((entity instanceof Animals) || (entity instanceof IronGolem) || (entity instanceof Snowman)) {
cause.sendMessage(ChatColor.RED + "You cannot kill animals here!");
event.setCancelled(true);
}
}
}
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Bat;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class bat implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Bat(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Bat)
{
if (FlagPermissions.has("bat", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,30 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Blaze;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class blaze implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Blaze(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Blaze)
{
if (FlagPermissions.has("blaze", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,23 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class blockdamage implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void BlockDamage(EntityExplodeEvent event) {
if(event.isCancelled())
return;
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getLocation());
if(res!=null) {
if(!res.getPermissions().has("blockdamage", true)) {
event.setCancelled(true);
}
}
}
}

View File

@ -0,0 +1,31 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.CaveSpider;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class cavespider implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void CaveSpider(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof CaveSpider)
{
if (FlagPermissions.has("cavespider", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,30 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class chicken implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Chicken(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Chicken)
{
if (FlagPermissions.has("chicken", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,28 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class commands implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Commands(PlayerCommandPreprocessEvent event){
Player player = event.getPlayer();
Location loc = event.getPlayer().getLocation();
boolean resadmin = Residence.isResAdminOn(player);
ClaimedResidence res = Residence.getResidenceManager().getByLoc(loc);
String playername = player.getName();
if(res!=null && !res.getPermissions().playerHas(playername, "commands", true)&&!resadmin){
event.setCancelled(true);
event.getPlayer().sendMessage(derpa + "You cannot use commands here!");
}
}
ChatColor derpa = ChatColor.RED;
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Cow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class cow implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Cow(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Cow)
{
if (FlagPermissions.has("cow", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class creeperspawn implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void CreeperSpawn(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Creeper)
{
if (FlagPermissions.has("creeperspawn", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,30 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerDropItemEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class drops implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Drops(PlayerDropItemEvent event){
if(event.isCancelled())
return;
Player player = event.getPlayer();
boolean resadmin = Residence.isResAdminOn(player);
ClaimedResidence res = Residence.getResidenceManager().getByLoc (event.getItemDrop().getLocation());
String playername = player.getName();
if(res!=null){
if(!res.getPermissions().playerHas(playername, "drops", true)&&!resadmin){
event.setCancelled(true);
event.getPlayer().sendMessage(derpa + "You cannot drop items here!");
}
}
}
ChatColor derpa = ChatColor.RED;
}

View File

@ -0,0 +1,28 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerEggThrowEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class eggs implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Eggs(PlayerEggThrowEvent event){
Player player = event.getPlayer();
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
boolean resadmin = Residence.isResAdminOn(player);
String playername = player.getName();
if(res!=null) {
if(!res.getPermissions().playerHas(playername, "eggs", true) && !resadmin) {
event.setHatching(false);
event.getPlayer().sendMessage(derpa + "You cannot throw eggys!");
}
}
}
ChatColor derpa = ChatColor.RED;
}

View File

@ -0,0 +1,28 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class enderman implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Enderman(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Enderman)
{
if (FlagPermissions.has("enderman", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,33 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class enderpearl implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Enderpearl(PlayerTeleportEvent event){
if(event.isCancelled())
return;
Location loc = event.getTo();
Player player = event.getPlayer();
ClaimedResidence res = Residence.getResidenceManager().getByLoc(loc);
boolean resadmin = Residence.isResAdminOn(player);
String playername = player.getName();
if(res!=null){
if(event.getCause()==TeleportCause.ENDER_PEARL && !res.getPermissions().playerHas(playername, "enderpearl", true)&&!resadmin){
event.setCancelled(true);
event.getPlayer().sendMessage(derpa + "You cannot use ender pearls here!");
}
}
}
ChatColor derpa = ChatColor.RED;
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class falldamage implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void FallDamage(EntityDamageEvent event){
if(event.isCancelled())
return;
Entity entity = event.getEntity();
ClaimedResidence res = Residence.getResidenceManager().getByLoc(entity.getLocation());
if(event.getCause() == DamageCause.FALL && event.getEntity() instanceof Player){
if(res!=null){
if(!res.getPermissions().has("falldamage", true)){
event.setCancelled(true);
}
}
}
}
}

View File

@ -0,0 +1,30 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerFishEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class fishing implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Fishing(PlayerFishEvent event){
if(event.isCancelled())
return;
Player player = event.getPlayer();
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
boolean resadmin = Residence.isResAdminOn(player);
String playername = player.getName();
if(res!=null) {
if(!res.getPermissions().playerHas(playername, "fishing", true) && !resadmin) {
event.setCancelled(true);
event.getPlayer().sendMessage(derpa + "You cannot fish here!");
}
}
}
ChatColor derpa = ChatColor.RED;
}

View File

@ -0,0 +1,28 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockFormEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class form implements Listener {
@EventHandler(priority = EventPriority.LOW)
public void Form(BlockFormEvent event) {
if(event.isCancelled())
return;
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getBlock().getLocation());
if(res!=null) {
if(!res.getPermissions().has("form", true)) {
event.setCancelled(true);
}
}
else {
if (!Residence.getWorldFlags().getPerms(event.getBlock().getWorld().getName()).has("form", true)) {
event.setCancelled(true);
}
}
}
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class ghast implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Ghast(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Ghast)
{
if (FlagPermissions.has("ghast", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,41 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class god implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void God(EntityDamageEvent event){
if(event.isCancelled())
return;
try {
Entity entity = event.getEntity();
Player player = ((Player) event.getEntity());
World world = player.getWorld();
String playername = player.getName();
Location location = player.getLocation();
ClaimedResidence res = Residence.getResidenceManager().getByLoc(entity.getLocation());
if(event.getEntity() instanceof Player){
if(res!=null){
if(res.getPermissions().playerHas(playername, "god", false)){
event.setCancelled(true);
world.playEffect(location, Effect.MOBSPAWNER_FLAMES, 4);
}
}
}
} catch (Exception ex) {
}
}
}

View File

@ -0,0 +1,50 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockGrowEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.world.StructureGrowEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class grow implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void StructureGrow(StructureGrowEvent event){
if(event.isCancelled())
return;
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getLocation());
if(res!=null) {
if(!res.getPermissions().has("grow", true)) {
event.setCancelled(true);
return;
}
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void BlockGrow(BlockGrowEvent event){
if(event.isCancelled())
return;
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getBlock().getLocation());
if(res!=null) {
if(!res.getPermissions().has("grow", true)) {
event.setCancelled(true);
return;
}
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void BlockGrowSpread(BlockSpreadEvent event){
if(event.isCancelled())
return;
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getBlock().getLocation());
if(res!=null) {
if(!res.getPermissions().has("grow", true)) {
event.setCancelled(true);
return;
}
}
}
}

View File

@ -0,0 +1,24 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class hunger implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Hunger(FoodLevelChangeEvent event){
if(event.isCancelled())
return;
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getEntity().getLocation());
if(res!=null) {
if(!res.getPermissions().has("hunger", true)) {
event.setCancelled(true);
return;
}
}
}
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.IronGolem;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class irongolem implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void IronGolem(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof IronGolem)
{
if (FlagPermissions.has("irongolem", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,24 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.weather.LightningStrikeEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class lightning implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Lightning(LightningStrikeEvent event){
if(event.isCancelled())
return;
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getLightning().getLocation());
if(res!=null) {
if(!res.getPermissions().has("lightning", true)) {
event.setCancelled(true);
return;
}
}
}
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.MagmaCube;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class magmacube implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void MagmaCube(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof MagmaCube)
{
if (FlagPermissions.has("magmacube", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,28 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockFadeEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class melt implements Listener {
@EventHandler(priority = EventPriority.LOW)
public void Melt(BlockFadeEvent event) {
if(event.isCancelled())
return;
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getBlock().getLocation());
if(res!=null) {
if(!res.getPermissions().has("melt", true)) {
event.setCancelled(true);
}
}
else {
if (!Residence.getWorldFlags().getPerms(event.getBlock().getWorld().getName()).has("melt", true)) {
event.setCancelled(true);
}
}
}
}

View File

@ -0,0 +1,49 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class mobkilling implements Listener {
public Player cause;
@EventHandler(priority = EventPriority.NORMAL)
public void Mobkilling(final EntityDamageByEntityEvent event) {
if (event.isCancelled()) {
return;
}
final Entity damager = event.getDamager();
if ((!(damager instanceof Arrow)) && (!(damager instanceof Player))) {
return;
}
if ((damager instanceof Arrow) && (!(((Arrow) damager).getShooter() instanceof Player))) {
return;
} else if (damager instanceof Player) {
cause = (Player) damager;
} else {
cause = (Player) ((Arrow) damager).getShooter();
}
final boolean resadmin = Residence.isResAdminOn(cause);
if (resadmin) {
return;
}
final Entity entity = event.getEntity();
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(entity.getLocation());
if (res != null && !res.getPermissions().playerHas(cause.getName().toString(), "mobkilling", true)) {
if (entity instanceof Monster) {
cause.sendMessage(ChatColor.RED + "You cannot kill mobs here!");
event.setCancelled(true);
}
}
}
}

View File

@ -0,0 +1,28 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.MushroomCow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class mooshroom implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Mooshroom(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof MushroomCow)
{
if (FlagPermissions.has("mooshroom", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Ocelot;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class ocelot implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Ocelot(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Ocelot)
{
if (FlagPermissions.has("ocelot", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,30 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerPickupItemEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class pickup implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void PickupItem(PlayerPickupItemEvent event){
if(event.isCancelled())
return;
Player player = event.getPlayer();
boolean resadmin = Residence.isResAdminOn(player);
ClaimedResidence res = Residence.getResidenceManager().getByLoc (event.getItem().getLocation());
String playername = player.getName();
if(res!=null){
if(!res.getPermissions().playerHas(playername, "pickup", true)&&!resadmin){
event.setCancelled(true);
event.getPlayer().sendMessage(derpa + "You cannot pickup items here!");
}
}
}
ChatColor derpa = ChatColor.RED;
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Pig;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class pig implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Pig(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Pig)
{
if (FlagPermissions.has("pig", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,35 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class pigsaddle implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void PiggySaddle(PlayerInteractEntityEvent event){
if(event.isCancelled())
return;
Entity pig = event.getRightClicked();
Player player = event.getPlayer();
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
boolean resadmin = Residence.isResAdminOn(player);
String playername = player.getName();
if(res!=null) {
if(!res.getPermissions().playerHas(playername, "pigsaddle", true)&&!resadmin) {
if(pig.getType() == EntityType.PIG){
event.setCancelled(true);
event.getPlayer().sendMessage(derpa + "You cannot derp here!");
}
}
}
}
ChatColor derpa = ChatColor.RED;
}

View File

@ -0,0 +1,24 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PigZapEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class pigzap implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void PiggyZap(PigZapEvent event){
if(event.isCancelled())
return;
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getEntity().getLocation());
if(res!=null) {
if(!res.getPermissions().has("pigzap", true)) {
event.setCancelled(true);
}
}
}
}

View File

@ -0,0 +1,32 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerPortalEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class portal implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Portal(PlayerPortalEvent event){
Player player = event.getPlayer();
Location loc = event.getPlayer().getLocation();
if(event.isCancelled())
return;
ClaimedResidence res = Residence.getResidenceManager().getByLoc(loc);
boolean resadmin = Residence.isResAdminOn(player);
String playername = player.getName();
if(res!=null){
if(!res.getPermissions().playerHas(playername, "portal", true)&&!resadmin){
event.setCancelled(true);
event.getPlayer().sendMessage(derpa + "You cannot use portals here!");
}
}
}
ChatColor derpa = ChatColor.RED;
}

View File

@ -0,0 +1,28 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerShearEntityEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class shear implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Shear(PlayerShearEntityEvent event){
if(event.isCancelled())
return;
Player player = event.getPlayer();
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
boolean resadmin = Residence.isResAdminOn(player);
String playername = player.getName();
if(res!=null && !res.getPermissions().playerHas(playername, "shear", true)&&!resadmin){
event.setCancelled(true);
event.getPlayer().sendMessage(derpa + "You cannot shear here!");
}
}
ChatColor derpa = ChatColor.RED;
}

View File

@ -0,0 +1,28 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class sheep implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Sheep(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Sheep)
{
if (FlagPermissions.has("sheep", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,28 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Silverfish;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class silverfish implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Silverfish(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Silverfish)
{
if (FlagPermissions.has("silverfish", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class skeleton implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Skeleton(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Skeleton)
{
if (FlagPermissions.has("skeleton", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,28 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Slime;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class slime implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Slime(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Slime)
{
if (FlagPermissions.has("slime", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,23 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.SlimeSplitEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class slimesplit implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void SlimeSplit(SlimeSplitEvent event){
if(event.isCancelled())
return;
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getEntity().getLocation());
if(res!=null) {
if(!res.getPermissions().has("slimesplit", true)) {
event.setCancelled(true);
}
}
}
}

View File

@ -0,0 +1,39 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class sneak implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void Sneak(PlayerMoveEvent event){
if(event.isCancelled())
return;
Player player = event.getPlayer();
if(!player.isSprinting() && (!player.isSneaking()))
return;
boolean resadmin = Residence.isResAdminOn(player);
if (resadmin) {
return;
}
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
String playername = player.getName();
if(res!=null) {
if(!res.getPermissions().playerHas(playername, "sneak", true) && player.isSneaking()) {
long currentTime = System.currentTimeMillis();
if(currentTime%2000>=0 && currentTime%2000<=100){
event.setCancelled(true);
player.sendMessage(derpa + "You cannot sneak here!");
return;
}
}
}
}
ChatColor derpa = ChatColor.RED;
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Snowman;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class snowgolem implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void SnowGolem(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Snowman)
{
if (FlagPermissions.has("snowgolem", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Spider;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class spider implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Spider(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Spider)
{
if (FlagPermissions.has("spider", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,39 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class sprint implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void Sprint(PlayerMoveEvent event){
if(event.isCancelled())
return;
Player player = event.getPlayer();
String playername = player.getName();
boolean resadmin = Residence.isResAdminOn(player);
if (resadmin) {
return;
}
if(!player.isSprinting() && (!player.isSneaking()))
return;
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
if(res!=null) {
if(!res.getPermissions().playerHas(playername, "sprint", true) && player.isSprinting()) {
event.setCancelled(true);
long currentTime = System.currentTimeMillis();
if(currentTime%2000>=0 && currentTime%2000<=100){
event.getPlayer().sendMessage(derpa + "You cannot sprint here!");
return;
}
}
}
}
ChatColor derpa = ChatColor.RED;
}

View File

@ -0,0 +1,28 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Squid;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class squid implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Squid(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Squid)
{
if (FlagPermissions.has("squid", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,52 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import com.bekvon.bukkit.residence.event.ResidenceFlagChangeEvent;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
import com.bekvon.bukkit.residence.protection.FlagPermissions.FlagState;
public class time implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void onResidenceFlag(final ResidenceFlagChangeEvent event) {
final ClaimedResidence res = event.getResidence();
if (event.getFlag().equalsIgnoreCase("day")) {
if (event.getNewState() == FlagState.TRUE) {
for (final Player player : res.getPlayersInResidence()) {
player.setPlayerTime(6000, false);
}
}
if (event.getNewState() == FlagState.FALSE) {
for (final Player player : res.getPlayersInResidence()) {
player.resetPlayerTime();
}
}
if (event.getNewState() == FlagState.NEITHER) {
for (final Player player : res.getPlayersInResidence()) {
player.resetPlayerTime();
}
}
}
if (event.getFlag().equalsIgnoreCase("night")) {
if (event.getNewState() == FlagState.TRUE) {
for (final Player player : res.getPlayersInResidence()) {
player.setPlayerTime(14000, false);
}
}
if (event.getNewState() == FlagState.FALSE) {
for (final Player player : res.getPlayersInResidence()) {
player.resetPlayerTime();
}
}
if (event.getNewState() == FlagState.NEITHER) {
for (final Player player : res.getPlayersInResidence()) {
player.resetPlayerTime();
}
}
}
}
}

View File

@ -0,0 +1,34 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class trade implements Listener {
ChatColor derpa = ChatColor.RED;
@EventHandler(priority = EventPriority.NORMAL)
public void Trade(final PlayerInteractEntityEvent event) {
final Entity uglyguy = event.getRightClicked();
if (uglyguy.getType() == EntityType.VILLAGER) {
final Player player = event.getPlayer();
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
final boolean resadmin = Residence.isResAdminOn(player);
final String playername = player.getName();
if (res != null) {
if (!res.getPermissions().playerHas(playername, "trade", true) && !resadmin) {
event.setCancelled(true);
event.getPlayer().sendMessage(derpa + "You cannot trade here!");
}
}
}
}
}

View File

@ -0,0 +1,60 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.vehicle.VehicleDestroyEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class vehicleprotect implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void onVehicleDestroy(VehicleDestroyEvent event){
if(event.isCancelled())
return;
try {
Location loc = event.getVehicle().getLocation();
Entity attacker = event.getAttacker();
Vehicle vehicle = event.getVehicle();
Player player;
player = (Player)attacker;
ClaimedResidence res = Residence.getResidenceManager().getByLoc(loc);
boolean resadmin = Residence.isResAdminOn(player);
String playername = player.getName();
if(res!=null){
if(res.getPermissions().playerHas(playername, "vehicleprotect", false) && !resadmin && (vehicle instanceof Minecart || vehicle instanceof Boat) && (attacker instanceof Player || attacker instanceof Monster)){
event.setCancelled(true);
player.sendMessage(derpa + "You cannot destroy vehicles here!");
return;
}
}
} catch (Exception ex) {
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onVehicleDestroyEntity(VehicleDestroyEvent event){
if(event.isCancelled())
return;
Location loc = event.getVehicle().getLocation();
Entity attacker = event.getAttacker();
Vehicle vehicle = event.getVehicle();
ClaimedResidence res = Residence.getResidenceManager().getByLoc(loc);
if(res!=null){
if(res.getPermissions().has("vehicleprotect", false) && (vehicle instanceof Minecart || vehicle instanceof Boat) && attacker instanceof Monster){
event.setCancelled(true);
return;
}
}
}
ChatColor derpa = ChatColor.RED;
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Villager;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class villager implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Villager(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Villager)
{
if (FlagPermissions.has("villager", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,49 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Villager;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class villagerkilling implements Listener {
public Player cause;
@EventHandler(priority = EventPriority.NORMAL)
public void VillagerKilling(final EntityDamageByEntityEvent event) {
if (event.isCancelled()) {
return;
}
final Entity damager = event.getDamager();
if ((!(damager instanceof Arrow)) && (!(damager instanceof Player))) {
return;
}
if ((damager instanceof Arrow) && (!(((Arrow) damager).getShooter() instanceof Player))) {
return;
} else if (damager instanceof Player) {
cause = (Player) damager;
} else {
cause = (Player) ((Arrow) damager).getShooter();
}
final boolean resadmin = Residence.isResAdminOn(cause);
if (resadmin) {
return;
}
final Entity entity = event.getEntity();
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(entity.getLocation());
if (res != null && !res.getPermissions().playerHas(cause.getName().toString(), "villagerkilling", true)) {
if (entity instanceof Villager) {
cause.sendMessage(ChatColor.RED + "You cannot kill villagers here!");
event.setCancelled(true);
}
}
}
}

View File

@ -0,0 +1,35 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.WeatherType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import com.bekvon.bukkit.residence.event.ResidenceFlagChangeEvent;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
import com.bekvon.bukkit.residence.protection.FlagPermissions.FlagState;
public class weather implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void onResidenceFlag(final ResidenceFlagChangeEvent event) {
if (event.getFlag().equalsIgnoreCase("weather")) {
final ClaimedResidence res = event.getResidence();
if (event.getNewState() == FlagState.TRUE) {
for (final Player player : res.getPlayersInResidence()) {
player.setPlayerWeather(WeatherType.DOWNFALL);
}
}
if (event.getNewState() == FlagState.FALSE) {
for (final Player player : res.getPlayersInResidence()) {
player.setPlayerWeather(WeatherType.CLEAR);
}
}
if (event.getNewState() == FlagState.NEITHER) {
for (final Player player : res.getPlayersInResidence()) {
player.resetPlayerWeather();
}
}
}
}
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Witch;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class witch implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Witch(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Witch)
{
if (FlagPermissions.has("witch", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,28 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Wither;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class witherspawn implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void WitherSpawn(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Wither)
{
if (FlagPermissions.has("Witherspawn", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class wolf implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Wolf(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Wolf)
{
if (FlagPermissions.has("wolf", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.Zombie;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class zombie implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void Zombie(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof Zombie)
{
if (FlagPermissions.has("zombie", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,29 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.PigZombie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.FlagPermissions;
public class zombiepigmen implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void ZombiePigmen(CreatureSpawnEvent event)
{
FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof PigZombie)
{
if (FlagPermissions.has("zombiepigmen", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,29 @@
name: ${project.artifactId}
description: ${project.description}
main: ${project.groupId}.${project.artifactId}.${project.artifactId}
version: ${project.version}-Build#${env.BUILD_NUMBER}
author: [Tonkovich,喵♂呜]
website: ${jenkins.url}/job/${project.artifactId}/
depend: [Residence]
permissions:
ResExtras.*:
description: Allows all permissions from ResExtras.
children:
ResExtras.version: true
ResExtras.list: true
ResExtras.help: true
ResExtras.version:
description: ResExtras Version permission.
default: true
ResExtras.list:
description: Lists all the ResExtras Flags.
default: true
ResExtras.help:
description: Displays help menu.
default: true
commands:
resextras:
aliases:
- re
description: 领地扩展主命令
usage: /<command>