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-15 11:18:11 +08:00
parent dd5cf06126
commit 16f69d091a
106 changed files with 1713 additions and 1753 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cn.citycraft</groupId>
<artifactId>ResExtras</artifactId>
<version>1.0</version>
<version>1.1</version>
<name>ResExtras</name>
<description>领地扩展</description>
<build>
@ -55,7 +55,7 @@
</build>
<properties>
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
<update.description></update.description>
<update.description>&amp;c汉化提示条目 优化检测流程...</update.description>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>

View File

@ -1,9 +1,9 @@
package cn.citycraft.ResExtras;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
@ -12,92 +12,99 @@ import com.bekvon.bukkit.residence.protection.FlagPermissions;
import cn.citycraft.PluginHelper.config.FileConfig;
import cn.citycraft.PluginHelper.utils.VersionChecker;
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;
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.BlockForm;
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.DropItem;
import cn.citycraft.ResExtras.flags.Eggs;
import cn.citycraft.ResExtras.flags.EnderPearl;
import cn.citycraft.ResExtras.flags.Enderman;
import cn.citycraft.ResExtras.flags.FallDamage;
import cn.citycraft.ResExtras.flags.Fishing;
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.PickupItem;
import cn.citycraft.ResExtras.flags.Pig;
import cn.citycraft.ResExtras.flags.PiggySaddle;
import cn.citycraft.ResExtras.flags.PiggyZap;
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 FileConfig config;
public static FileConfig config;
public static String pluginname;
public static void sendMessage(final CommandSender sender, final String path) {
sender.sendMessage(pluginname + config.getMessage("§cMessage." + path));
}
@Override
public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
if (sender instanceof Player) {
if (args.length == 0) {
sendHelp(sender);
}
if (args.length == 1) {
switch (args[0].toLowerCase()) {
case "version":
if (sender.hasPermission("ResExtras.version")) {
sender.sendMessage("§6[§bResExtras§6] §av2.0.5 §6重制 §dBy §a喵♂呜");
}
return true;
case "list":
if (sender.hasPermission("ResExtras.list")) {
sender.sendMessage("§6[§bResExtras§6] §a 扩展Flags");
sender.sendMessage("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 ");
}
return true;
case "help":
sendHelp(sender);
return true;
if (args.length == 1) {
switch (args[0].toLowerCase()) {
case "version":
if (sender.hasPermission("ResExtras.version")) {
sender.sendMessage(pluginname + " §av" + this.getDescription().getVersion() + " §6重制 §dBy §a喵♂呜");
}
return true;
case "list":
if (sender.hasPermission("ResExtras.list")) {
sender.sendMessage(pluginname + " §a 扩展Flags");
sender.sendMessage("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 ");
}
return true;
case "reload":
if (sender.hasPermission("ResExtras.reload")) {
final PluginManager pm = Bukkit.getPluginManager();
pm.disablePlugin(this);
onLoad();
pm.enablePlugin(this);
sender.sendMessage(pluginname + "§a配置文件已重载!");
}
return true;
}
}
sendHelp(sender);
return true;
}
@ -163,167 +170,167 @@ public class ResExtras extends JavaPlugin implements CommandExecutor {
FlagPermissions.addResidenceOnlyFlag("day");
FlagPermissions.addResidenceOnlyFlag("night");
FlagPermissions.addResidenceOnlyFlag("blockdamage");
if (getConfig().getBoolean("Zombie", true)) {
pm.registerEvents(new zombie(), this);
if (getConfig().getBoolean("Flags.Zombie", true)) {
pm.registerEvents(new Zombie(), this);
}
if (getConfig().getBoolean("Skeleton", true)) {
pm.registerEvents(new skeleton(), this);
if (getConfig().getBoolean("Flags.Skeleton", true)) {
pm.registerEvents(new Skeleton(), this);
}
if (getConfig().getBoolean("Creeperspawn", true)) {
pm.registerEvents(new creeperspawn(), this);
if (getConfig().getBoolean("Flags.Creeperspawn", true)) {
pm.registerEvents(new CreeperSpawn(), this);
}
if (getConfig().getBoolean("Spider", true)) {
pm.registerEvents(new spider(), this);
if (getConfig().getBoolean("Flags.Spider", true)) {
pm.registerEvents(new Spider(), this);
}
if (getConfig().getBoolean("Cavespider", true)) {
pm.registerEvents(new cavespider(), this);
if (getConfig().getBoolean("Flags.Cavespider", true)) {
pm.registerEvents(new CaveSpider(), this);
}
if (getConfig().getBoolean("Slime", true)) {
pm.registerEvents(new slime(), this);
if (getConfig().getBoolean("Flags.Slime", true)) {
pm.registerEvents(new Slime(), this);
}
if (getConfig().getBoolean("Ghast", true)) {
pm.registerEvents(new ghast(), this);
if (getConfig().getBoolean("Flags.Ghast", true)) {
pm.registerEvents(new Ghast(), this);
}
if (getConfig().getBoolean("Blaze", true)) {
pm.registerEvents(new blaze(), this);
if (getConfig().getBoolean("Flags.Blaze", true)) {
pm.registerEvents(new Blaze(), this);
}
if (getConfig().getBoolean("Magmacube", true)) {
pm.registerEvents(new magmacube(), this);
if (getConfig().getBoolean("Flags.Magmacube", true)) {
pm.registerEvents(new MagmaCube(), this);
}
if (getConfig().getBoolean("Silverfish", true)) {
pm.registerEvents(new silverfish(), this);
if (getConfig().getBoolean("Flags.Silverfish", true)) {
pm.registerEvents(new SilverFish(), this);
}
if (getConfig().getBoolean("Snowgolem", true)) {
pm.registerEvents(new snowgolem(), this);
if (getConfig().getBoolean("Flags.Snowgolem", true)) {
pm.registerEvents(new SnowGolem(), this);
}
if (getConfig().getBoolean("Irongolem", true)) {
pm.registerEvents(new irongolem(), this);
if (getConfig().getBoolean("Flags.Irongolem", true)) {
pm.registerEvents(new IronGolem(), this);
}
if (getConfig().getBoolean("Enderman", true)) {
pm.registerEvents(new enderman(), this);
if (getConfig().getBoolean("Flags.Enderman", true)) {
pm.registerEvents(new Enderman(), this);
}
if (getConfig().getBoolean("Chicken", true)) {
pm.registerEvents(new chicken(), this);
if (getConfig().getBoolean("Flags.Chicken", true)) {
pm.registerEvents(new Chicken(), this);
}
if (getConfig().getBoolean("Cow", true)) {
pm.registerEvents(new cow(), this);
if (getConfig().getBoolean("Flags.Cow", true)) {
pm.registerEvents(new Cow(), this);
}
if (getConfig().getBoolean("Wolf", true)) {
pm.registerEvents(new wolf(), this);
if (getConfig().getBoolean("Flags.Wolf", true)) {
pm.registerEvents(new Wolf(), this);
}
if (getConfig().getBoolean("Mooshroom", true)) {
pm.registerEvents(new mooshroom(), this);
if (getConfig().getBoolean("Flags.Mooshroom", true)) {
pm.registerEvents(new Mooshroom(), this);
}
if (getConfig().getBoolean("Ocelot", true)) {
pm.registerEvents(new ocelot(), this);
if (getConfig().getBoolean("Flags.Ocelot", true)) {
pm.registerEvents(new Ocelot(), this);
}
if (getConfig().getBoolean("Zombiepigmen", true)) {
pm.registerEvents(new zombiepigmen(), this);
if (getConfig().getBoolean("Flags.Zombiepigmen", true)) {
pm.registerEvents(new ZombiePigmen(), this);
}
if (getConfig().getBoolean("Pig", true)) {
pm.registerEvents(new pig(), this);
if (getConfig().getBoolean("Flags.Pig", true)) {
pm.registerEvents(new Pig(), this);
}
if (getConfig().getBoolean("Sheep", true)) {
pm.registerEvents(new sheep(), this);
if (getConfig().getBoolean("Flags.Sheep", true)) {
pm.registerEvents(new Sheep(), this);
}
if (getConfig().getBoolean("Squid", true)) {
pm.registerEvents(new squid(), this);
if (getConfig().getBoolean("Flags.Squid", true)) {
pm.registerEvents(new Squid(), this);
}
if (getConfig().getBoolean("Villager", true)) {
pm.registerEvents(new villager(), this);
if (getConfig().getBoolean("Flags.Villager", true)) {
pm.registerEvents(new Villager(), this);
}
if (getConfig().getBoolean("Bat", true)) {
pm.registerEvents(new bat(), this);
if (getConfig().getBoolean("Flags.Bat", true)) {
pm.registerEvents(new Bat(), this);
}
if (getConfig().getBoolean("Witch", true)) {
pm.registerEvents(new witch(), this);
if (getConfig().getBoolean("Flags.Witch", true)) {
pm.registerEvents(new Witch(), this);
}
if (getConfig().getBoolean("Witherspawn", true)) {
pm.registerEvents(new witherspawn(), this);
if (getConfig().getBoolean("Flags.Witherspawn", true)) {
pm.registerEvents(new WitherSpawn(), this);
}
if (getConfig().getBoolean("Melt", true)) {
pm.registerEvents(new melt(), this);
if (getConfig().getBoolean("Flags.Melt", true)) {
pm.registerEvents(new Melt(), this);
}
if (getConfig().getBoolean("Form", true)) {
pm.registerEvents(new form(), this);
if (getConfig().getBoolean("Flags.Form", true)) {
pm.registerEvents(new BlockForm(), this);
}
if (getConfig().getBoolean("Animalkilling", true)) {
pm.registerEvents(new animalkilling(), this);
if (getConfig().getBoolean("Flags.Animalkilling", true)) {
pm.registerEvents(new Animalkilling(), this);
}
if (getConfig().getBoolean("Mobkilling", true)) {
pm.registerEvents(new mobkilling(), this);
if (getConfig().getBoolean("Flags.Mobkilling", true)) {
pm.registerEvents(new Mobkilling(), this);
}
if (getConfig().getBoolean("Drops", true)) {
pm.registerEvents(new drops(), this);
if (getConfig().getBoolean("Flags.DropItem", true)) {
pm.registerEvents(new DropItem(), this);
}
if (getConfig().getBoolean("Pickup", true)) {
pm.registerEvents(new pickup(), this);
if (getConfig().getBoolean("Flags.Pickup", true)) {
pm.registerEvents(new PickupItem(), this);
}
if (getConfig().getBoolean("Commands", true)) {
pm.registerEvents(new commands(), this);
if (getConfig().getBoolean("Flags.Commands", true)) {
pm.registerEvents(new Commands(), this);
}
if (getConfig().getBoolean("Enderpearl", true)) {
pm.registerEvents(new enderpearl(), this);
if (getConfig().getBoolean("Flags.Enderpearl", true)) {
pm.registerEvents(new EnderPearl(), this);
}
if (getConfig().getBoolean("Falldamage", true)) {
pm.registerEvents(new falldamage(), this);
if (getConfig().getBoolean("Flags.Falldamage", true)) {
pm.registerEvents(new FallDamage(), this);
}
if (getConfig().getBoolean("Portal", true)) {
pm.registerEvents(new portal(), this);
if (getConfig().getBoolean("Flags.Portal", true)) {
pm.registerEvents(new Portal(), this);
}
if (getConfig().getBoolean("Villagerkilling", true)) {
pm.registerEvents(new villagerkilling(), this);
if (getConfig().getBoolean("Flags.Villagerkilling", true)) {
pm.registerEvents(new VillagerKilling(), this);
}
if (getConfig().getBoolean("Vehicleprotect", true)) {
pm.registerEvents(new vehicleprotect(), this);
if (getConfig().getBoolean("Flags.Vehicleprotect", true)) {
pm.registerEvents(new VehicleProtect(), this);
}
if (getConfig().getBoolean("Lightning", true)) {
pm.registerEvents(new lightning(), this);
if (getConfig().getBoolean("Flags.Lightning", true)) {
pm.registerEvents(new Lightning(), this);
}
if (getConfig().getBoolean("Grow", true)) {
pm.registerEvents(new grow(), this);
if (getConfig().getBoolean("Flags.Grow", true)) {
pm.registerEvents(new Grow(), this);
}
if (getConfig().getBoolean("Hunger", true)) {
pm.registerEvents(new hunger(), this);
if (getConfig().getBoolean("Flags.Hunger", true)) {
pm.registerEvents(new Hunger(), this);
}
if (getConfig().getBoolean("Sprint", true)) {
pm.registerEvents(new sprint(), this);
if (getConfig().getBoolean("Flags.Sprint", true)) {
pm.registerEvents(new Sprint(), this);
}
if (getConfig().getBoolean("Fishing", true)) {
pm.registerEvents(new fishing(), this);
if (getConfig().getBoolean("Flags.Fishing", true)) {
pm.registerEvents(new Fishing(), this);
}
if (getConfig().getBoolean("Eggs", true)) {
pm.registerEvents(new eggs(), this);
if (getConfig().getBoolean("Flags.Eggs", true)) {
pm.registerEvents(new Eggs(), this);
}
if (getConfig().getBoolean("Sneak", true)) {
pm.registerEvents(new sneak(), this);
if (getConfig().getBoolean("Flags.Sneak", true)) {
pm.registerEvents(new Sneak(), this);
}
if (getConfig().getBoolean("Pigzap", true)) {
pm.registerEvents(new pigzap(), this);
if (getConfig().getBoolean("Flags.Pigzap", true)) {
pm.registerEvents(new PiggyZap(), this);
}
if (getConfig().getBoolean("Slimesplit", true)) {
pm.registerEvents(new slimesplit(), this);
if (getConfig().getBoolean("Flags.Slimesplit", true)) {
pm.registerEvents(new SlimeSplit(), this);
}
if (getConfig().getBoolean("Shear", true)) {
pm.registerEvents(new shear(), this);
if (getConfig().getBoolean("Flags.Shear", true)) {
pm.registerEvents(new Shear(), this);
}
if (getConfig().getBoolean("Pigsaddle", true)) {
pm.registerEvents(new pigsaddle(), this);
if (getConfig().getBoolean("Flags.Pigsaddle", true)) {
pm.registerEvents(new PiggySaddle(), this);
}
if (getConfig().getBoolean("Trade", true)) {
pm.registerEvents(new trade(), this);
if (getConfig().getBoolean("Flags.Trade", true)) {
pm.registerEvents(new Trade(), this);
}
if (getConfig().getBoolean("God", true)) {
pm.registerEvents(new god(), this);
if (getConfig().getBoolean("Flags.God", true)) {
pm.registerEvents(new God(), this);
}
if (getConfig().getBoolean("Weather", true)) {
pm.registerEvents(new weather(), this);
if (getConfig().getBoolean("Flags.Weather", true)) {
pm.registerEvents(new Weather(), this);
}
if (getConfig().getBoolean("Time", true)) {
pm.registerEvents(new time(), this);
if (getConfig().getBoolean("Flags.Time", true)) {
pm.registerEvents(new Time(), this);
}
if (getConfig().getBoolean("BlockDamage", true)) {
pm.registerEvents(new blockdamage(), this);
if (getConfig().getBoolean("Flags.BlockDamage", true)) {
pm.registerEvents(new BlockDamage(), this);
}
this.getLogger().info("领地扩展 版本 " + this.getDescription().getVersion() + " 已正确载入 重置 By 喵♂呜");
new VersionChecker(this);
@ -337,12 +344,14 @@ public class ResExtras extends JavaPlugin implements CommandExecutor {
@Override
public void onLoad() {
config = new FileConfig(this);
pluginname = config.getMessage("pluginname");
}
public void sendHelp(final CommandSender sender) {
sender.sendMessage("§6========= §6[§b领地扩展§6] §6插件帮助列表=========");
sender.sendMessage("§6/ResExtras help §6- §a显示帮助页面");
sender.sendMessage("§6/ResExtras version §6- §a显示插件版本");
sender.sendMessage("§6/ResExtras list §6- §a显示Flags列表");
sender.sendMessage("§6/ResExtras reload §6- §a重载插件");
sender.sendMessage("§6/ResExtras help §6- §a显示帮助页面");
}
}

View File

@ -1,6 +1,5 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
@ -15,14 +14,13 @@ 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;
import cn.citycraft.ResExtras.ResExtras;
@EventHandler(priority = EventPriority.NORMAL)
public class Animalkilling implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void AnimalKilling(final EntityDamageByEntityEvent event) {
if (event.isCancelled()) {
return;
}
Player p;
final Entity damager = event.getDamager();
if ((!(damager instanceof Arrow)) && (!(damager instanceof Player))) {
return;
@ -30,20 +28,20 @@ public class animalkilling implements Listener {
if ((damager instanceof Arrow) && (!(((Arrow) damager).getShooter() instanceof Player))) {
return;
} else if (damager instanceof Player) {
cause = (Player) damager;
p = (Player) damager;
} else {
cause = (Player) ((Arrow) damager).getShooter();
p = (Player) ((Arrow) damager).getShooter();
}
final boolean resadmin = Residence.isResAdminOn(cause);
final boolean resadmin = Residence.isResAdminOn(p);
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 (res != null && !res.getPermissions().playerHas(p.getName().toString(), "animalkilling", true)) {
if ((entity instanceof Animals) || (entity instanceof IronGolem) || (entity instanceof Snowman)) {
cause.sendMessage(ChatColor.RED + "You cannot kill animals here!");
ResExtras.sendMessage(p, "Animalkilling");
event.setCancelled(true);
}
}

View File

@ -0,0 +1,24 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
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
public void onBat(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Bat) {
if (FlagPermissions.has("bat", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,25 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onBlaze(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Blaze) {
if (FlagPermissions.has("blaze", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,21 @@
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, ignoreCancelled = true)
public void onBlockDamage(final EntityExplodeEvent event) {
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getLocation());
if (res != null) {
if (!res.getPermissions().has("blockdamage", true)) {
event.setCancelled(true);
}
}
}
}

View File

@ -0,0 +1,25 @@
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 BlockForm implements Listener {
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBlockForm(final BlockFormEvent event) {
final 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,25 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onCaveSpider(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.CaveSpider) {
if (FlagPermissions.has("cavespider", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,25 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onChicken(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Chicken) {
if (FlagPermissions.has("chicken", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,28 @@
package cn.citycraft.ResExtras.flags;
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;
import cn.citycraft.ResExtras.ResExtras;
public class Commands implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onCommands(final PlayerCommandPreprocessEvent event) {
final Player player = event.getPlayer();
final Location loc = event.getPlayer().getLocation();
final boolean resadmin = Residence.isResAdminOn(player);
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(loc);
final String playername = player.getName();
if (res != null && !res.getPermissions().playerHas(playername, "commands", true) && !resadmin) {
event.setCancelled(true);
ResExtras.sendMessage(event.getPlayer(), "Commands");
}
}
}

View File

@ -0,0 +1,25 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onCow(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Cow) {
if (FlagPermissions.has("cow", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,26 @@
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, ignoreCancelled = true)
public void onCreeperSpawn(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final 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,31 @@
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;
import cn.citycraft.ResExtras.ResExtras;
public class DropItem implements Listener {
ChatColor derpa = ChatColor.RED;
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onDrops(final PlayerDropItemEvent event) {
final Player player = event.getPlayer();
final boolean resadmin = Residence.isResAdminOn(player);
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getItemDrop().getLocation());
final String playername = player.getName();
if (res != null) {
if (!res.getPermissions().playerHas(playername, "drops", true) && !resadmin) {
event.setCancelled(true);
ResExtras.sendMessage(player, "DropItem");
}
}
}
}

View File

@ -0,0 +1,31 @@
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;
import cn.citycraft.ResExtras.ResExtras;
public class Eggs implements Listener {
ChatColor derpa = ChatColor.RED;
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEggs(final PlayerEggThrowEvent event) {
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, "eggs", true) && !resadmin) {
event.setHatching(false);
ResExtras.sendMessage(player, "Eggs");
}
}
}
}

View File

@ -0,0 +1,34 @@
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;
import cn.citycraft.ResExtras.ResExtras;
public class EnderPearl implements Listener {
ChatColor derpa = ChatColor.RED;
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEnderPearl(final PlayerTeleportEvent event) {
final Location loc = event.getTo();
final Player player = event.getPlayer();
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(loc);
final boolean resadmin = Residence.isResAdminOn(player);
final String playername = player.getName();
if (res != null) {
if (event.getCause() == TeleportCause.ENDER_PEARL && !res.getPermissions().playerHas(playername, "enderpearl", true) && !resadmin) {
event.setCancelled(true);
ResExtras.sendMessage(player, "EnderPearl");
}
}
}
}

View File

@ -0,0 +1,25 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onEnderman(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Enderman) {
if (FlagPermissions.has("enderman", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,27 @@
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, ignoreCancelled = true)
public void onFallDamage(final EntityDamageEvent event) {
final Entity entity = event.getEntity();
final 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,31 @@
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;
import cn.citycraft.ResExtras.ResExtras;
public class Fishing implements Listener {
ChatColor derpa = ChatColor.RED;
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onFishing(final PlayerFishEvent event) {
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, "fishing", true) && !resadmin) {
ResExtras.sendMessage(player, "Fishing");
event.setCancelled(true);
}
}
}
}

View File

@ -0,0 +1,24 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onGhast(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Ghast) {
if (!FlagPermissions.has("ghast", true))
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,38 @@
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, ignoreCancelled = true)
public void onGod(final EntityDamageEvent event) {
try {
final Entity entity = event.getEntity();
final Player player = ((Player) event.getEntity());
final World world = player.getWorld();
final String playername = player.getName();
final Location location = player.getLocation();
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(entity.getLocation());
if (event.getEntity() instanceof Player) {
if (res != null) {
if (res.getPermissions().playerHas(playername, "god", false)) {
world.playEffect(location, Effect.MOBSPAWNER_FLAMES, 4);
event.setCancelled(true);
}
}
}
} catch (final Exception ex) {
}
}
}

View File

@ -0,0 +1,46 @@
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, ignoreCancelled = true)
public void BlockGrow(final BlockGrowEvent event) {
final 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, ignoreCancelled = true)
public void BlockGrowSpread(final BlockSpreadEvent event) {
final 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, ignoreCancelled = true)
public void StructureGrow(final StructureGrowEvent event) {
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getLocation());
if (res != null) {
if (!res.getPermissions().has("grow", true)) {
event.setCancelled(true);
return;
}
}
}
}

View File

@ -0,0 +1,22 @@
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, ignoreCancelled = true)
public void onHunger(final FoodLevelChangeEvent event) {
final 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,26 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onIronGolem(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.IronGolem) {
if (FlagPermissions.has("irongolem", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,22 @@
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, ignoreCancelled = true)
public void onLightning(final LightningStrikeEvent event) {
final 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,25 @@
package cn.citycraft.ResExtras.flags;
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 MagmaCube implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onMagmaCube(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.MagmaCube) {
if (FlagPermissions.has("magmacube", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,25 @@
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, ignoreCancelled = true)
public void onMelt(final BlockFadeEvent event) {
final 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

@ -1,6 +1,5 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Monster;
@ -13,14 +12,13 @@ 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;
import cn.citycraft.ResExtras.ResExtras;
@EventHandler(priority = EventPriority.NORMAL)
public void Mobkilling(final EntityDamageByEntityEvent event) {
if (event.isCancelled()) {
return;
}
public class Mobkilling implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onMobkilling(final EntityDamageByEntityEvent event) {
Player cause;
final Entity damager = event.getDamager();
if ((!(damager instanceof Arrow)) && (!(damager instanceof Player))) {
return;
@ -41,7 +39,7 @@ public class mobkilling implements Listener {
if (res != null && !res.getPermissions().playerHas(cause.getName().toString(), "mobkilling", true)) {
if (entity instanceof Monster) {
cause.sendMessage(ChatColor.RED + "You cannot kill mobs here!");
ResExtras.sendMessage(cause, "Mobkilling");
event.setCancelled(true);
}
}

View File

@ -0,0 +1,26 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.MushroomCow;
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, ignoreCancelled = true)
public void onMooshroom(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final 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,25 @@
package cn.citycraft.ResExtras.flags;
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 Ocelot implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onOcelot(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Ocelot) {
if (FlagPermissions.has("ocelot", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,31 @@
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;
import cn.citycraft.ResExtras.ResExtras;
public class PickupItem implements Listener {
ChatColor derpa = ChatColor.RED;
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPickupItem(final PlayerPickupItemEvent event) {
final Player player = event.getPlayer();
final boolean resadmin = Residence.isResAdminOn(player);
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getItem().getLocation());
final String playername = player.getName();
if (res != null) {
if (!res.getPermissions().playerHas(playername, "pickup", true) && !resadmin) {
ResExtras.sendMessage(player, "PickupItem");
event.setCancelled(true);
}
}
}
}

View File

@ -0,0 +1,26 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onPig(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Pig) {
if (FlagPermissions.has("pig", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,36 @@
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;
import cn.citycraft.ResExtras.ResExtras;
public class PiggySaddle implements Listener {
ChatColor derpa = ChatColor.RED;
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPiggySaddle(final PlayerInteractEntityEvent event) {
final Entity pig = event.getRightClicked();
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, "pigsaddle", true) && !resadmin) {
if (pig.getType() == EntityType.PIG) {
ResExtras.sendMessage(player, "PiggySaddle");
event.setCancelled(true);
}
}
}
}
}

View File

@ -0,0 +1,22 @@
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 PiggyZap implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPiggyZap(final PigZapEvent event) {
final 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,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.PlayerPortalEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
import cn.citycraft.ResExtras.ResExtras;
public class Portal implements Listener {
ChatColor derpa = ChatColor.RED;
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPortal(final PlayerPortalEvent event) {
final Player player = event.getPlayer();
final Location loc = event.getPlayer().getLocation();
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(loc);
final boolean resadmin = Residence.isResAdminOn(player);
final String playername = player.getName();
if (res != null) {
if (!res.getPermissions().playerHas(playername, "portal", true) && !resadmin) {
ResExtras.sendMessage(player, "Pearl");
event.setCancelled(true);
}
}
}
}

View File

@ -0,0 +1,29 @@
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;
import cn.citycraft.ResExtras.ResExtras;
public class Shear implements Listener {
ChatColor derpa = ChatColor.RED;
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onShear(final PlayerShearEntityEvent event) {
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 && !res.getPermissions().playerHas(playername, "shear", true) && !resadmin) {
ResExtras.sendMessage(player, "Shear");
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,25 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onSheep(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Sheep) {
if (FlagPermissions.has("sheep", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,25 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onSilverFish(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Silverfish) {
if (FlagPermissions.has("silverfish", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,25 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onSkeleton(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Skeleton) {
if (FlagPermissions.has("skeleton", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,25 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onSlime(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Slime) {
if (FlagPermissions.has("slime", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,21 @@
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, ignoreCancelled = true)
public void onSlimeSplit(final SlimeSplitEvent event) {
final 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,38 @@
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 org.bukkit.event.player.PlayerMoveEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
import cn.citycraft.ResExtras.ResExtras;
public class Sneak implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onSneak(final PlayerMoveEvent event) {
final Player player = event.getPlayer();
if (!player.isSprinting() && (!player.isSneaking()))
return;
final boolean resadmin = Residence.isResAdminOn(player);
if (resadmin) {
return;
}
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
final String playername = player.getName();
if (res != null) {
if (!res.getPermissions().playerHas(playername, "sneak", true) && player.isSneaking()) {
event.setCancelled(true);
final long currentTime = System.currentTimeMillis();
if (currentTime % 2000 >= 0 && currentTime % 2000 <= 100) {
ResExtras.sendMessage(player, "Sneak");
return;
}
}
}
}
}

View File

@ -0,0 +1,26 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onSnowGolem(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Snowman) {
if (FlagPermissions.has("snowgolem", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,26 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onSpider(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Spider) {
if (FlagPermissions.has("spider", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,40 @@
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;
import cn.citycraft.ResExtras.ResExtras;
public class Sprint implements Listener {
ChatColor derpa = ChatColor.RED;
@EventHandler(priority = EventPriority.MONITOR)
public void onSprint(final PlayerMoveEvent event) {
final Player player = event.getPlayer();
final String playername = player.getName();
final boolean resadmin = Residence.isResAdminOn(player);
if (resadmin) {
return;
}
if (!player.isSprinting() && (!player.isSneaking()))
return;
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
if (res != null) {
if (!res.getPermissions().playerHas(playername, "sprint", true) && player.isSprinting()) {
event.setCancelled(true);
final long currentTime = System.currentTimeMillis();
if (currentTime % 2000 >= 0 && currentTime % 2000 <= 100) {
ResExtras.sendMessage(player, "Sprint");
return;
}
}
}
}
}

View File

@ -0,0 +1,25 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onSquid(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Squid) {
if (FlagPermissions.has("squid", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -2,16 +2,37 @@ 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.ResidenceChangedEvent;
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 {
public class Time implements Listener {
@EventHandler
public void onResidenceChange(final ResidenceChangedEvent e) {
final Player player = e.getPlayer();
final ClaimedResidence oldRes = e.getFrom();
final ClaimedResidence newRes = e.getTo();
if (oldRes != null) {
if (oldRes.getPermissions().has("night", false) || oldRes.getPermissions().has("day", false)) {
player.resetPlayerTime();
}
}
if (newRes != null) {
if (newRes.getPermissions().has("day", false)) {
player.setPlayerTime(6000, false);
return;
}
if (newRes.getPermissions().has("night", false)) {
player.setPlayerTime(14000, false);
return;
}
}
}
@EventHandler(priority = EventPriority.NORMAL)
@EventHandler
public void onResidenceFlag(final ResidenceFlagChangeEvent event) {
final ClaimedResidence res = event.getResidence();
if (event.getFlag().equalsIgnoreCase("day")) {
@ -37,12 +58,7 @@ public class time implements Listener {
player.setPlayerTime(14000, false);
}
}
if (event.getNewState() == FlagState.FALSE) {
for (final Player player : res.getPlayersInResidence()) {
player.resetPlayerTime();
}
}
if (event.getNewState() == FlagState.NEITHER) {
if (event.getNewState() == FlagState.FALSE || event.getNewState() == FlagState.NEITHER) {
for (final Player player : res.getPlayersInResidence()) {
player.resetPlayerTime();
}

View File

@ -12,11 +12,13 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
public class trade implements Listener {
import cn.citycraft.ResExtras.ResExtras;
public class Trade implements Listener {
ChatColor derpa = ChatColor.RED;
@EventHandler(priority = EventPriority.NORMAL)
public void Trade(final PlayerInteractEntityEvent event) {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onTrade(final PlayerInteractEntityEvent event) {
final Entity uglyguy = event.getRightClicked();
if (uglyguy.getType() == EntityType.VILLAGER) {
final Player player = event.getPlayer();
@ -25,8 +27,8 @@ public class trade implements Listener {
final String playername = player.getName();
if (res != null) {
if (!res.getPermissions().playerHas(playername, "trade", true) && !resadmin) {
ResExtras.sendMessage(player, "Trade");
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;
import cn.citycraft.ResExtras.ResExtras;
public class VehicleProtect implements Listener {
ChatColor derpa = ChatColor.RED;
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onVehicleDestroy(final VehicleDestroyEvent event) {
try {
final Location loc = event.getVehicle().getLocation();
final Entity attacker = event.getAttacker();
final Vehicle vehicle = event.getVehicle();
final Player player = (Player) attacker;
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(loc);
final boolean resadmin = Residence.isResAdminOn(player);
final 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)) {
ResExtras.sendMessage(player, "VehicleDestroy");
event.setCancelled(true);
return;
}
}
} catch (final Exception ex) {
}
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onVehicleDestroyEntity(final VehicleDestroyEvent event) {
final Location loc = event.getVehicle().getLocation();
final Entity attacker = event.getAttacker();
final Vehicle vehicle = event.getVehicle();
final 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;
}
}
}
}

View File

@ -0,0 +1,26 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onVillager(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Villager) {
if (FlagPermissions.has("villager", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -1,6 +1,5 @@
package cn.citycraft.ResExtras.flags;
import org.bukkit.ChatColor;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@ -13,14 +12,13 @@ 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;
import cn.citycraft.ResExtras.ResExtras;
@EventHandler(priority = EventPriority.NORMAL)
public void VillagerKilling(final EntityDamageByEntityEvent event) {
if (event.isCancelled()) {
return;
}
public class VillagerKilling implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onVillagerKilling(final EntityDamageByEntityEvent event) {
Player p = null;
final Entity damager = event.getDamager();
if ((!(damager instanceof Arrow)) && (!(damager instanceof Player))) {
return;
@ -28,20 +26,19 @@ public class villagerkilling implements Listener {
if ((damager instanceof Arrow) && (!(((Arrow) damager).getShooter() instanceof Player))) {
return;
} else if (damager instanceof Player) {
cause = (Player) damager;
p = (Player) damager;
} else {
cause = (Player) ((Arrow) damager).getShooter();
p = (Player) ((Arrow) damager).getShooter();
}
final boolean resadmin = Residence.isResAdminOn(cause);
final boolean resadmin = Residence.isResAdminOn(p);
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 (res != null && !res.getPermissions().playerHas(p.getName().toString(), "villagerkilling", true)) {
if (entity instanceof Villager) {
cause.sendMessage(ChatColor.RED + "You cannot kill villagers here!");
ResExtras.sendMessage(p, "VillagerKilling");
event.setCancelled(true);
}
}

View File

@ -3,15 +3,39 @@ 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.ResidenceChangedEvent;
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 class Weather implements Listener {
@EventHandler
public void onResidenceChange(final ResidenceChangedEvent e) {
final Player player = e.getPlayer();
final ClaimedResidence oldRes = e.getFrom();
final ClaimedResidence newRes = e.getTo();
if (oldRes != null) {
if (oldRes.getPermissions().isSet("weather")) {
player.resetPlayerWeather();
}
}
if (newRes != null) {
if (newRes.getPermissions().isSet("weather")) {
if (newRes.getPermissions().has("weather", true)) {
player.setPlayerWeather(WeatherType.DOWNFALL);
return;
}
if (!newRes.getPermissions().has("weather", false)) {
player.setPlayerWeather(WeatherType.CLEAR);
return;
}
}
}
}
@EventHandler
public void onResidenceFlag(final ResidenceFlagChangeEvent event) {
if (event.getFlag().equalsIgnoreCase("weather")) {
final ClaimedResidence res = event.getResidence();

View File

@ -0,0 +1,26 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onWitch(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Witch) {
if (FlagPermissions.has("witch", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,25 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onWitherSpawn(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Wither) {
if (FlagPermissions.has("Witherspawn", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,26 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onWolf(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Wolf) {
if (FlagPermissions.has("wolf", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,26 @@
package cn.citycraft.ResExtras.flags;
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, ignoreCancelled = true)
public void onZombie(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.Zombie) {
if (FlagPermissions.has("zombie", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,26 @@
package cn.citycraft.ResExtras.flags;
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 ZombiePigmen implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onZombiePigmen(final CreatureSpawnEvent event) {
final FlagPermissions FlagPermissions = Residence.getPermsByLoc(event.getLocation());
final LivingEntity Entity = event.getEntity();
if (FlagPermissions == null)
return;
if (Entity instanceof org.bukkit.entity.PigZombie) {
if (FlagPermissions.has("zombiepigmen", true))
return;
event.setCancelled(true);
}
}
}

View File

@ -1,29 +0,0 @@
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

@ -1,30 +0,0 @@
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

@ -1,23 +0,0 @@
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

@ -1,31 +0,0 @@
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

@ -1,30 +0,0 @@
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

@ -1,28 +0,0 @@
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

@ -1,29 +0,0 @@
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

@ -1,29 +0,0 @@
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

@ -1,30 +0,0 @@
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

@ -1,28 +0,0 @@
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

@ -1,28 +0,0 @@
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

@ -1,33 +0,0 @@
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

@ -1,29 +0,0 @@
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

@ -1,30 +0,0 @@
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

@ -1,28 +0,0 @@
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

@ -1,29 +0,0 @@
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

@ -1,41 +0,0 @@
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

@ -1,50 +0,0 @@
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

@ -1,24 +0,0 @@
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

@ -1,29 +0,0 @@
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

@ -1,24 +0,0 @@
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

@ -1,29 +0,0 @@
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

@ -1,28 +0,0 @@
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

@ -1,28 +0,0 @@
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

@ -1,29 +0,0 @@
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

@ -1,30 +0,0 @@
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

@ -1,29 +0,0 @@
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

@ -1,35 +0,0 @@
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

@ -1,24 +0,0 @@
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

@ -1,32 +0,0 @@
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

@ -1,28 +0,0 @@
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

@ -1,28 +0,0 @@
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

@ -1,28 +0,0 @@
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

@ -1,29 +0,0 @@
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

@ -1,28 +0,0 @@
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

@ -1,23 +0,0 @@
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

@ -1,39 +0,0 @@
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

@ -1,29 +0,0 @@
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

@ -1,29 +0,0 @@
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

@ -1,39 +0,0 @@
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

@ -1,28 +0,0 @@
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

@ -1,60 +0,0 @@
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

@ -1,29 +0,0 @@
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

@ -1,29 +0,0 @@
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);
}
}
}

Some files were not shown because too many files have changed in this diff Show More