mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-13 05:53:57 +01:00
Merge branch 'development'
This commit is contained in:
commit
33482e5ccb
32
pom.xml
32
pom.xml
@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>skyblock</artifactId>
|
||||
<version>2.3.12</version>
|
||||
<version>2.3.13</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@ -105,11 +105,6 @@
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>mvdw-software</id>
|
||||
<name>MVdW Public Repositories</name>
|
||||
<url>http://repo.mvdw-software.be/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
@ -140,7 +135,7 @@
|
||||
</repository>
|
||||
<repository>
|
||||
<id>public</id>
|
||||
<url>http://repo.songoda.com/repository/public/</url>
|
||||
<url>https://repo.songoda.com/repository/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
@ -165,8 +160,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.16.1</version>
|
||||
<scope>provided</scope>
|
||||
<version>1.16.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
@ -218,7 +212,7 @@
|
||||
<dependency>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>worldedit-bukkit</artifactId>
|
||||
<version>7.1.0</version>
|
||||
<version>7.1.0R1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.papermc</groupId>
|
||||
@ -232,23 +226,17 @@
|
||||
<version>LATEST</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.Zrips</groupId>
|
||||
<artifactId>Residence</artifactId>
|
||||
<scope>provided</scope>
|
||||
<version>4.9.0.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net</groupId>
|
||||
<artifactId>coreprotect</artifactId>
|
||||
<scope>provided</scope>
|
||||
<version>2.18.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.eatthepath</groupId>
|
||||
<artifactId>fast-uuid</artifactId>
|
||||
<version>0.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.Zrips</groupId>
|
||||
<artifactId>Residence</artifactId>
|
||||
<scope>provided</scope>
|
||||
<version>4.9.0.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -7,6 +7,7 @@ import com.songoda.core.compatibility.ServerProject;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.core.configuration.Config;
|
||||
import com.songoda.core.gui.GuiManager;
|
||||
import com.songoda.core.hooks.LogManager;
|
||||
import com.songoda.skyblock.api.SkyBlockAPI;
|
||||
import com.songoda.skyblock.ban.BanManager;
|
||||
import com.songoda.skyblock.bank.BankManager;
|
||||
@ -48,19 +49,12 @@ import com.songoda.skyblock.usercache.UserCacheManager;
|
||||
import com.songoda.skyblock.visit.VisitManager;
|
||||
import com.songoda.skyblock.visit.VisitTask;
|
||||
import com.songoda.skyblock.world.WorldManager;
|
||||
import com.songoda.skyblock.world.generator.VoidGenerator;
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.CoreProtectAPI;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import java.io.File;
|
||||
@ -101,9 +95,8 @@ public class SkyBlock extends SongodaPlugin {
|
||||
private BankManager bankManager;
|
||||
private PermissionManager permissionManager;
|
||||
|
||||
private CoreProtectAPI coreProtectAPI;
|
||||
private Permission vaultPermission;
|
||||
|
||||
|
||||
private boolean paper;
|
||||
private boolean paperAsync;
|
||||
|
||||
@ -136,11 +129,11 @@ public class SkyBlock extends SongodaPlugin {
|
||||
|
||||
@Override
|
||||
public void onPluginEnable() {
|
||||
if(ServerVersion.isServerVersionAbove(ServerVersion.V1_16) || ServerVersion.isServerVersionBelow(ServerVersion.V1_8)) {
|
||||
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_16) || ServerVersion.isServerVersionBelow(ServerVersion.V1_8)) {
|
||||
this.getLogger().warning("This Minecraft version is not officially supported.");
|
||||
}
|
||||
|
||||
if(paper = ServerProject.isServer(ServerProject.PAPER)){
|
||||
|
||||
if (paper = ServerProject.isServer(ServerProject.PAPER)) {
|
||||
try {
|
||||
Bukkit.spigot().getClass().getMethod("getPaperConfig");
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) {
|
||||
@ -250,8 +243,8 @@ public class SkyBlock extends SongodaPlugin {
|
||||
pluginManager.registerEvents(new PistonListeners(this), this);
|
||||
pluginManager.registerEvents(new FallBreakListeners(this), this);
|
||||
pluginManager.registerEvents(new WorldListeners(this), this);
|
||||
|
||||
if(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) {
|
||||
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) {
|
||||
pluginManager.registerEvents(new SpongeListeners(this), this);
|
||||
}
|
||||
|
||||
@ -259,17 +252,17 @@ public class SkyBlock extends SongodaPlugin {
|
||||
pluginManager.registerEvents(new EpicSpawners(this), this);
|
||||
if (pluginManager.isPluginEnabled("UltimateStacker"))
|
||||
pluginManager.registerEvents(new UltimateStacker(this), this);
|
||||
|
||||
|
||||
pluginManager.registerEvents(new Levelling(), this);
|
||||
pluginManager.registerEvents(new Generator(), this);
|
||||
pluginManager.registerEvents(new Creator(), this);
|
||||
|
||||
this.getCommand("skyblock").setExecutor(new SkyBlockCommand());
|
||||
|
||||
|
||||
if (pluginManager.isPluginEnabled("Vault")) {
|
||||
this.vaultPermission = getServer().getServicesManager().getRegistration(Permission.class).getProvider();
|
||||
}
|
||||
|
||||
|
||||
switch (this.config.getString("Economy.Manager", "Default")) {
|
||||
case "Vault":
|
||||
getEconomyManager().setEconomy("Vault");
|
||||
@ -283,8 +276,8 @@ public class SkyBlock extends SongodaPlugin {
|
||||
default:
|
||||
this.getLogger().warning("EconomyManager is default");
|
||||
}
|
||||
|
||||
this.coreProtectAPI = loadCoreProtect();
|
||||
|
||||
LogManager.load();
|
||||
|
||||
SkyBlockAPI.setImplementation(INSTANCE);
|
||||
}
|
||||
@ -319,21 +312,6 @@ public class SkyBlock extends SongodaPlugin {
|
||||
public void onDataLoad() {
|
||||
}
|
||||
|
||||
private CoreProtectAPI loadCoreProtect() {
|
||||
Plugin plugin = getServer().getPluginManager().getPlugin("CoreProtect");
|
||||
|
||||
if (plugin != null) { // Check before loading classes
|
||||
if (plugin instanceof CoreProtect) { // Check that CoreProtect is loaded
|
||||
CoreProtectAPI CoreProtect = ((CoreProtect) plugin).getAPI();
|
||||
// Check that the API is enabled and Check that a compatible version of the API is loaded
|
||||
if (CoreProtect.isEnabled() && CoreProtect.APIVersion() >= 6) {
|
||||
return CoreProtect;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigReload() {
|
||||
if (!loadConfigs()) this.getLogger().warning("Config are not reload !");
|
||||
@ -348,23 +326,22 @@ public class SkyBlock extends SongodaPlugin {
|
||||
|
||||
private boolean loadConfigs() {
|
||||
try {
|
||||
biomes = this.getFileManager().getConfig(new File(this.getDataFolder(),"biomes.yml")).getFileConfiguration();
|
||||
challenges = this.getFileManager().getConfig(new File(this.getDataFolder(),"challenges.yml")).getFileConfiguration();
|
||||
config = this.getFileManager().getConfig(new File(this.getDataFolder(),"config.yml")).getFileConfiguration();
|
||||
generators = this.getFileManager().getConfig(new File(this.getDataFolder(),"generators.yml")).getFileConfiguration();
|
||||
language = this.getFileManager().getConfig(new File(this.getDataFolder(),"language.yml")).getFileConfiguration();
|
||||
levelling = this.getFileManager().getConfig(new File(this.getDataFolder(),"levelling.yml")).getFileConfiguration();
|
||||
limits = this.getFileManager().getConfig(new File(this.getDataFolder(),"limits.yml")).getFileConfiguration();
|
||||
menus = this.getFileManager().getConfig(new File(this.getDataFolder(),"menus.yml")).getFileConfiguration();
|
||||
placeholders = this.getFileManager().getConfig(new File(this.getDataFolder(),"placeholders.yml")).getFileConfiguration();
|
||||
rewards = this.getFileManager().getConfig(new File(this.getDataFolder(),"rewards.yml")).getFileConfiguration();
|
||||
scoreboard = this.getFileManager().getConfig(new File(this.getDataFolder(),"scoreboard.yml")).getFileConfiguration();
|
||||
settings = this.getFileManager().getConfig(new File(this.getDataFolder(),"settings.yml")).getFileConfiguration();
|
||||
stackables = this.getFileManager().getConfig(new File(this.getDataFolder(),"stackables.yml")).getFileConfiguration();
|
||||
upgrades = this.getFileManager().getConfig(new File(this.getDataFolder(),"upgrades.yml")).getFileConfiguration();
|
||||
biomes = this.getFileManager().getConfig(new File(this.getDataFolder(), "biomes.yml")).getFileConfiguration();
|
||||
challenges = this.getFileManager().getConfig(new File(this.getDataFolder(), "challenges.yml")).getFileConfiguration();
|
||||
config = this.getFileManager().getConfig(new File(this.getDataFolder(), "config.yml")).getFileConfiguration();
|
||||
generators = this.getFileManager().getConfig(new File(this.getDataFolder(), "generators.yml")).getFileConfiguration();
|
||||
language = this.getFileManager().getConfig(new File(this.getDataFolder(), "language.yml")).getFileConfiguration();
|
||||
levelling = this.getFileManager().getConfig(new File(this.getDataFolder(), "levelling.yml")).getFileConfiguration();
|
||||
limits = this.getFileManager().getConfig(new File(this.getDataFolder(), "limits.yml")).getFileConfiguration();
|
||||
menus = this.getFileManager().getConfig(new File(this.getDataFolder(), "menus.yml")).getFileConfiguration();
|
||||
placeholders = this.getFileManager().getConfig(new File(this.getDataFolder(), "placeholders.yml")).getFileConfiguration();
|
||||
rewards = this.getFileManager().getConfig(new File(this.getDataFolder(), "rewards.yml")).getFileConfiguration();
|
||||
scoreboard = this.getFileManager().getConfig(new File(this.getDataFolder(), "scoreboard.yml")).getFileConfiguration();
|
||||
settings = this.getFileManager().getConfig(new File(this.getDataFolder(), "settings.yml")).getFileConfiguration();
|
||||
stackables = this.getFileManager().getConfig(new File(this.getDataFolder(), "stackables.yml")).getFileConfiguration();
|
||||
upgrades = this.getFileManager().getConfig(new File(this.getDataFolder(), "upgrades.yml")).getFileConfiguration();
|
||||
return true;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
@ -507,10 +484,6 @@ public class SkyBlock extends SongodaPlugin {
|
||||
return guiManager;
|
||||
}
|
||||
|
||||
public CoreProtectAPI getCoreProtectAPI() {
|
||||
return coreProtectAPI;
|
||||
}
|
||||
|
||||
public boolean isPaper() {
|
||||
return paper;
|
||||
}
|
||||
@ -518,42 +491,70 @@ public class SkyBlock extends SongodaPlugin {
|
||||
public boolean isPaperAsync() {
|
||||
return paperAsync;
|
||||
}
|
||||
|
||||
|
||||
public Permission getVaultPermission() {
|
||||
return vaultPermission;
|
||||
}
|
||||
|
||||
|
||||
public EconomyManager getEconomyManager() {
|
||||
return economyManager;
|
||||
}
|
||||
|
||||
|
||||
public FileConfiguration getBiomes() { return biomes; }
|
||||
public FileConfiguration getBiomes() {
|
||||
return biomes;
|
||||
}
|
||||
|
||||
public FileConfiguration getChallenges() { return challenges; }
|
||||
public FileConfiguration getChallenges() {
|
||||
return challenges;
|
||||
}
|
||||
|
||||
public FileConfiguration getConfiguration() { return config; }
|
||||
public FileConfiguration getConfiguration() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public FileConfiguration getGenerators() { return generators; }
|
||||
public FileConfiguration getGenerators() {
|
||||
return generators;
|
||||
}
|
||||
|
||||
public FileConfiguration getLanguage() { return language; }
|
||||
public FileConfiguration getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public FileConfiguration getLevelling() { return levelling; }
|
||||
public FileConfiguration getLevelling() {
|
||||
return levelling;
|
||||
}
|
||||
|
||||
public FileConfiguration getLimits() { return limits; }
|
||||
public FileConfiguration getLimits() {
|
||||
return limits;
|
||||
}
|
||||
|
||||
public FileConfiguration getMenus() { return menus; }
|
||||
public FileConfiguration getMenus() {
|
||||
return menus;
|
||||
}
|
||||
|
||||
public FileConfiguration getPlaceholders() { return placeholders; }
|
||||
public FileConfiguration getPlaceholders() {
|
||||
return placeholders;
|
||||
}
|
||||
|
||||
public FileConfiguration getRewards() { return rewards; }
|
||||
public FileConfiguration getRewards() {
|
||||
return rewards;
|
||||
}
|
||||
|
||||
public FileConfiguration getSettings() { return settings; }
|
||||
public FileConfiguration getSettings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
public FileConfiguration getStackables() { return stackables; }
|
||||
public FileConfiguration getStackables() {
|
||||
return stackables;
|
||||
}
|
||||
|
||||
public FileConfiguration getUpgrades() { return upgrades; }
|
||||
public FileConfiguration getUpgrades() {
|
||||
return upgrades;
|
||||
}
|
||||
|
||||
public FileConfiguration getScoreboard() { return scoreboard; }
|
||||
public FileConfiguration getScoreboard() {
|
||||
return scoreboard;
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -267,7 +267,7 @@ public class Island {
|
||||
playerData.save();
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, this::save);
|
||||
save();
|
||||
|
||||
if (!mainConfigLoad.getBoolean("Island.Coop.Unload")) {
|
||||
File coopDataFile = new File(plugin.getDataFolder().toString() + "/coop-data",
|
||||
@ -554,12 +554,12 @@ public class Island {
|
||||
|
||||
public void addCoopPlayer(UUID uuid, IslandCoop islandCoop) {
|
||||
coopPlayers.put(uuid, islandCoop);
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, this::save);
|
||||
save();
|
||||
}
|
||||
|
||||
public void removeCoopPlayer(UUID uuid) {
|
||||
coopPlayers.remove(uuid);
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, this::save);
|
||||
save();
|
||||
}
|
||||
|
||||
public boolean isCoopPlayer(UUID uuid) {
|
||||
@ -793,7 +793,7 @@ public class Island {
|
||||
if(!islandStatusChangeEvent.isCancelled()) {
|
||||
this.status = status;
|
||||
getVisit().setStatus(status);
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, this::save);
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
@ -973,9 +973,10 @@ public class Island {
|
||||
return apiWrapper;
|
||||
}
|
||||
|
||||
|
||||
public void addWhitelistedPlayer(UUID uuid) {
|
||||
this.whitelistedPlayers.add(uuid);
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, this::save);
|
||||
save();
|
||||
}
|
||||
|
||||
public boolean isPlayerWhitelisted(UUID uuid) {
|
||||
@ -984,7 +985,7 @@ public class Island {
|
||||
|
||||
public void removeWhitelistedPlayer(UUID uuid) {
|
||||
this.whitelistedPlayers.remove(uuid);
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, this::save);
|
||||
save();
|
||||
}
|
||||
|
||||
public Set<UUID> getWhitelistedPlayers() {
|
||||
|
@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.core.hooks.LogManager;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.generator.Generator;
|
||||
import com.songoda.skyblock.generator.GeneratorManager;
|
||||
@ -122,9 +123,8 @@ public class BlockListeners implements Listener {
|
||||
droppedAmount = 1;
|
||||
}
|
||||
|
||||
if (plugin.getCoreProtectAPI() != null) {
|
||||
plugin.getCoreProtectAPI().logRemoval(player.getName(), block.getLocation(), material.getMaterial(), null);
|
||||
}
|
||||
if (LogManager.isEnabled())
|
||||
LogManager.logRemoval(player, block);
|
||||
|
||||
if (stackable.getSize() <= 1) {
|
||||
stackableManager.removeStack(stackable);
|
||||
|
@ -3,9 +3,11 @@ package com.songoda.skyblock.listeners;
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.config.FileManager.Config;
|
||||
import com.songoda.skyblock.island.*;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.island.IslandEnvironment;
|
||||
import com.songoda.skyblock.island.IslandLevel;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.island.IslandWorld;
|
||||
import com.songoda.skyblock.limit.impl.EntityLimitation;
|
||||
import com.songoda.skyblock.stackable.Stackable;
|
||||
import com.songoda.skyblock.stackable.StackableManager;
|
||||
@ -18,7 +20,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -36,10 +37,14 @@ import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class EntityListeners implements Listener {
|
||||
|
||||
@ -61,11 +66,11 @@ public class EntityListeners implements Listener {
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
if(event.getEntity() instanceof Blaze){
|
||||
if (event.getEntity() instanceof Blaze) {
|
||||
WorldManager worldManager = plugin.getWorldManager();
|
||||
|
||||
FileConfiguration configLoad = plugin.getConfiguration();
|
||||
|
||||
|
||||
if (configLoad.getBoolean("Island.Nether.BlazeImmuneToWaterInNether", false) &&
|
||||
worldManager.getIslandWorld(event.getEntity().getWorld()).equals(IslandWorld.Nether) &&
|
||||
event.getCause().equals(DamageCause.DROWNING)) {
|
||||
@ -87,25 +92,25 @@ public class EntityListeners implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
FileConfiguration configLoad = plugin.getConfiguration();
|
||||
|
||||
|
||||
org.bukkit.entity.Entity victim = event.getEntity();
|
||||
Island island = islandManager.getIslandAtLocation(victim.getLocation());
|
||||
|
||||
if(island != null) {
|
||||
|
||||
if (island != null) {
|
||||
org.bukkit.entity.Entity attacker = event.getDamager();
|
||||
if(attacker instanceof Projectile && ((Projectile) attacker).getShooter() instanceof org.bukkit.entity.Entity) {
|
||||
if (attacker instanceof Projectile && ((Projectile) attacker).getShooter() instanceof org.bukkit.entity.Entity) {
|
||||
attacker = (org.bukkit.entity.Entity) ((Projectile) attacker).getShooter();
|
||||
}
|
||||
|
||||
// Rework with better config
|
||||
if(victim instanceof Player && attacker instanceof Player) { // PVP
|
||||
if (victim instanceof Player && attacker instanceof Player) { // PVP
|
||||
if (configLoad.getBoolean("Island.Entity_Damage.PVP")) {
|
||||
if(plugin.getPermissionManager()
|
||||
if (plugin.getPermissionManager()
|
||||
.processPermission(event, (Player) attacker, island)) {
|
||||
plugin.getPermissionManager()
|
||||
.processPermission(event, (Player) victim, island);
|
||||
@ -113,28 +118,25 @@ public class EntityListeners implements Listener {
|
||||
} else {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
else if(victim instanceof Player) { // EVP
|
||||
} else if (victim instanceof Player) { // EVP
|
||||
if (configLoad.getBoolean("Island.Entity_Damage.EVP")) {
|
||||
plugin.getPermissionManager()
|
||||
.processPermission(event, (Player) victim, island, true);
|
||||
}
|
||||
|
||||
}
|
||||
else if(attacker instanceof Player) { // PVE
|
||||
} else if (attacker instanceof Player) { // PVE
|
||||
if (configLoad.getBoolean("Island.Entity_Damage.PVE")) {
|
||||
plugin.getPermissionManager()
|
||||
.processPermission(event, (Player) attacker, island);
|
||||
}
|
||||
|
||||
}
|
||||
else { // EVE
|
||||
} else { // EVE
|
||||
if (configLoad.getBoolean("Island.Entity_Damage.PVE")) {
|
||||
plugin.getPermissionManager()
|
||||
.processPermission(event, island);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Fix a bug in minecraft where arrows with flame still apply fire ticks even if
|
||||
// the shot entity isn't damaged
|
||||
if (event.isCancelled() && event.getDamager() instanceof Arrow && event.getDamager().getFireTicks() != 0) {
|
||||
@ -221,7 +223,7 @@ public class EntityListeners implements Listener {
|
||||
if (player != null) {
|
||||
if (!plugin.getWorldManager().isIslandWorld(player.getWorld())) return;
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
|
||||
|
||||
// Check permissions.
|
||||
plugin.getPermissionManager().processPermission(event, player,
|
||||
islandManager.getIslandAtLocation(event.getEntity().getLocation()));
|
||||
@ -248,7 +250,7 @@ public class EntityListeners implements Listener {
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
|
||||
Player p = null;
|
||||
if(event.getRemover() instanceof Player){
|
||||
if (event.getRemover() instanceof Player) {
|
||||
p = (Player) event.getRemover();
|
||||
}
|
||||
// Check permissions.
|
||||
@ -299,9 +301,12 @@ public class EntityListeners implements Listener {
|
||||
if ((LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone().subtract(0, 1, 0))
|
||||
|| LocationUtil.isLocationLocation(block.getLocation(),
|
||||
island.getLocation(world, IslandEnvironment.Visitor).clone().subtract(0, 1, 0)))
|
||||
&& this.plugin.getConfiguration()
|
||||
.getBoolean("Island.Spawn.Protection")) {
|
||||
event.setCancelled(true);
|
||||
&& this.plugin.getConfiguration().getBoolean("Island.Spawn.Protection")) {
|
||||
CompatibleMaterial material = CompatibleMaterial.getMaterial(block);
|
||||
Bukkit.getScheduler().runTaskLater(plugin, () -> {
|
||||
event.getEntity().remove();
|
||||
event.getBlock().setType(material.getBlockMaterial());
|
||||
}, 1L);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -321,7 +326,7 @@ public class EntityListeners implements Listener {
|
||||
data = (byte) Math.ceil(data / 4.0);
|
||||
}
|
||||
fallingBlock.getWorld().dropItemNaturally(fallingBlock.getLocation(), new ItemStack(fallingBlock.getMaterial(), 1, data));
|
||||
} catch(NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -347,7 +352,7 @@ public class EntityListeners implements Listener {
|
||||
|
||||
removeBlockFromLevel(island, block);
|
||||
CompatibleMaterial materials;
|
||||
|
||||
|
||||
if (event.getTo() != Material.AIR) {
|
||||
materials = CompatibleMaterial.getBlockMaterial(event.getTo());
|
||||
|
||||
@ -383,7 +388,7 @@ public class EntityListeners implements Listener {
|
||||
|
||||
boolean removed;
|
||||
Iterator<org.bukkit.block.Block> it = event.blockList().iterator();
|
||||
while (it.hasNext()){
|
||||
while (it.hasNext()) {
|
||||
removed = false;
|
||||
org.bukkit.block.Block block = it.next();
|
||||
if (SkyBlock.getInstance().getConfiguration().getBoolean("Island.Spawn.Protection")) {
|
||||
@ -403,7 +408,7 @@ public class EntityListeners implements Listener {
|
||||
CompatibleMaterial material = CompatibleMaterial.getMaterial(block);
|
||||
byte data = block.getData();
|
||||
|
||||
int removedAmount = (int) (Math.random() * Math.min(64, stackable.getSize()-1));
|
||||
int removedAmount = (int) (Math.random() * Math.min(64, stackable.getSize() - 1));
|
||||
stackable.take(removedAmount);
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
block.getWorld().dropItemNaturally(blockLocation.clone().add(.5, 1, .5),
|
||||
@ -420,19 +425,15 @@ public class EntityListeners implements Listener {
|
||||
removeBlockFromLevel(island, block);
|
||||
}
|
||||
|
||||
if(plugin.getCoreProtectAPI() != null) {
|
||||
plugin.getCoreProtectAPI().logRemoval("#" + entity.getType().toString().toLowerCase(), block.getLocation(), material.getMaterial(), null);
|
||||
}
|
||||
|
||||
it.remove();
|
||||
if(!removed){
|
||||
if (!removed) {
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.plugin.getConfiguration()
|
||||
.getBoolean("Island.Block.Level.Enable")) {
|
||||
if(!removed){
|
||||
if (!removed) {
|
||||
removeBlockFromLevel(island, block);
|
||||
}
|
||||
|
||||
@ -442,7 +443,7 @@ public class EntityListeners implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private void removeBlockFromLevel(Island island, CompatibleMaterial material){
|
||||
private void removeBlockFromLevel(Island island, CompatibleMaterial material) {
|
||||
if (material != null) {
|
||||
IslandLevel level = island.getLevel();
|
||||
|
||||
@ -513,15 +514,17 @@ public class EntityListeners implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) {
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) {
|
||||
if (livingEntity instanceof Steerable) {
|
||||
Steerable steerable = (Steerable) livingEntity;
|
||||
if (steerable.hasSaddle()) dontMultiply.add(new ItemStack(CompatibleMaterial.SADDLE.getMaterial(), 1));
|
||||
if (steerable.hasSaddle())
|
||||
dontMultiply.add(new ItemStack(CompatibleMaterial.SADDLE.getMaterial(), 1));
|
||||
}
|
||||
} else {
|
||||
if (livingEntity instanceof Pig) {
|
||||
Pig pig = (Pig) livingEntity;
|
||||
if (pig.hasSaddle()) dontMultiply.add(new ItemStack(CompatibleMaterial.SADDLE.getMaterial(), 1));
|
||||
if (pig.hasSaddle())
|
||||
dontMultiply.add(new ItemStack(CompatibleMaterial.SADDLE.getMaterial(), 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -560,7 +563,7 @@ public class EntityListeners implements Listener {
|
||||
if (raid != null) CHECKED_REASONS.add(raid);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
LivingEntity entity = event.getEntity();
|
||||
@ -583,7 +586,7 @@ public class EntityListeners implements Listener {
|
||||
boolean isSplit = event.getSpawnReason().equals(SpawnReason.SLIME_SPLIT);
|
||||
boolean splitBypass = configLoad.getBoolean("Island.Challenge.PerIsland", true);
|
||||
|
||||
if(!isSplit || !splitBypass){
|
||||
if (!isSplit || !splitBypass) {
|
||||
long count = limits.getEntityCount(island, plugin.getWorldManager().getIslandWorld(entityLocation.getWorld()), type);
|
||||
if (limits.hasTooMuch(count + 1, type)) {
|
||||
entity.remove();
|
||||
@ -614,14 +617,14 @@ public class EntityListeners implements Listener {
|
||||
});
|
||||
event.setCancelled(true); // For other plugin API reasons.
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||
WorldManager worldManager = plugin.getWorldManager();
|
||||
if(worldManager.isIslandWorld(event.getLocation().getWorld())) {
|
||||
if (worldManager.isIslandWorld(event.getLocation().getWorld())) {
|
||||
org.bukkit.entity.Entity entity = event.getEntity();
|
||||
|
||||
if(event.getEntity() instanceof EnderSignal) {
|
||||
|
||||
if (event.getEntity() instanceof EnderSignal) {
|
||||
((EnderSignal) entity).setTargetLocation(entity.getLocation().add(0d, 50d, 0d));
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,9 @@ package com.songoda.skyblock.listeners;
|
||||
import com.songoda.core.compatibility.CompatibleHand;
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.core.hooks.LogManager;
|
||||
import com.songoda.core.utils.ItemUtils;
|
||||
import com.songoda.core.utils.NumberUtils;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.config.FileManager;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
@ -16,7 +18,6 @@ import com.songoda.skyblock.message.MessageManager;
|
||||
import com.songoda.skyblock.sound.SoundManager;
|
||||
import com.songoda.skyblock.stackable.Stackable;
|
||||
import com.songoda.skyblock.stackable.StackableManager;
|
||||
import com.songoda.core.utils.NumberUtils;
|
||||
import com.songoda.skyblock.utils.structure.StructureUtil;
|
||||
import com.songoda.skyblock.utils.world.LocationUtil;
|
||||
import com.songoda.skyblock.world.WorldManager;
|
||||
@ -51,8 +52,8 @@ public class InteractListeners implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onWaterPlace(PlayerInteractEvent event){
|
||||
if(event.getItem() == null) return;
|
||||
public void onWaterPlace(PlayerInteractEvent event) {
|
||||
if (event.getItem() == null) return;
|
||||
Player player = event.getPlayer();
|
||||
org.bukkit.block.Block block = event.getClickedBlock().getRelative(event.getBlockFace());
|
||||
|
||||
@ -63,7 +64,7 @@ public class InteractListeners implements Listener {
|
||||
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK &&
|
||||
worldManager.getIslandWorld(block.getWorld()).equals(IslandWorld.Nether) &&
|
||||
event.getItem().getType().equals(Material.WATER_BUCKET)){
|
||||
event.getItem().getType().equals(Material.WATER_BUCKET)) {
|
||||
Location blockLoc = block.getLocation();
|
||||
|
||||
Island island = islandManager.getIslandAtLocation(blockLoc);
|
||||
@ -120,11 +121,11 @@ public class InteractListeners implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if(configLoad.getBoolean("Island.Nether.AllowNetherWater", false)){
|
||||
if (configLoad.getBoolean("Island.Nether.AllowNetherWater", false)) {
|
||||
event.setCancelled(true);
|
||||
block.setType(Material.WATER, true);
|
||||
block.getWorld().playSound(block.getLocation(), CompatibleSound.ITEM_BUCKET_EMPTY.getSound(), 1f, 1f);
|
||||
if(!event.getPlayer().getGameMode().equals(GameMode.CREATIVE)){
|
||||
if (!event.getPlayer().getGameMode().equals(GameMode.CREATIVE)) {
|
||||
event.getItem().setType(Material.BUCKET);
|
||||
}
|
||||
}
|
||||
@ -169,13 +170,13 @@ public class InteractListeners implements Listener {
|
||||
} else {
|
||||
heldType = CompatibleMaterial.AIR;
|
||||
}
|
||||
|
||||
|
||||
if (stackableManager != null && block != null && stackableManager.isStacked(block.getLocation())) {
|
||||
if(blockType.equals(CompatibleMaterial.DRAGON_EGG)){
|
||||
if (blockType.equals(CompatibleMaterial.DRAGON_EGG)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (stackableManager != null && stackableManager.isStackableMaterial(heldType) && blockType == heldType
|
||||
&& !player.isSneaking() && plugin.getPermissionManager().hasPermission(player, island, "Place")
|
||||
&& (!this.plugin.getConfiguration().getBoolean("Island.Stackable.RequirePermission")
|
||||
@ -245,9 +246,8 @@ public class InteractListeners implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if(plugin.getCoreProtectAPI() != null && material != null) {
|
||||
plugin.getCoreProtectAPI().logPlacement(player.getName(), location, material.getMaterial(), null);
|
||||
}
|
||||
if (LogManager.isEnabled() && material != null)
|
||||
LogManager.logPlacement(player, block);
|
||||
|
||||
if (player.getGameMode() != GameMode.CREATIVE)
|
||||
ItemUtils.takeActiveItem(player, CompatibleHand.getHand(event), itemAmount);
|
||||
@ -355,7 +355,7 @@ public class InteractListeners implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
plugin.getSoundManager().playSound(player, CompatibleSound.ENTITY_CHICKEN_EGG.getSound(), 10.0F, 10.0F);
|
||||
|
||||
event.setCancelled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user