mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-02-17 04:41:21 +01:00
Cleanup
This commit is contained in:
parent
e1a6d8ee73
commit
761796b012
@ -49,12 +49,8 @@ public class Alchemy extends EcoEnchant {
|
||||
|
||||
entity.removePotionEffect(effect.getType());
|
||||
|
||||
Bukkit.getScheduler().runTask(EcoEnchantsPlugin.getInstance(), () -> {
|
||||
newEffect.apply(entity);
|
||||
});
|
||||
Bukkit.getScheduler().runTask(EcoEnchantsPlugin.getInstance(), () -> newEffect.apply(entity));
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> {
|
||||
entity.removeMetadata(newEffect.toString(), EcoEnchantsPlugin.getInstance());
|
||||
}, 1);
|
||||
Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> entity.removeMetadata(newEffect.toString(), EcoEnchantsPlugin.getInstance()), 1);
|
||||
}
|
||||
}
|
||||
|
@ -4,5 +4,5 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public interface MMOEnchant {
|
||||
public static final Set<MMOEnchant> REGISTRY = new HashSet<>();
|
||||
Set<MMOEnchant> REGISTRY = new HashSet<>();
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -56,11 +57,13 @@ public abstract class AbstractCommand implements CommandExecutor, Registerable {
|
||||
|
||||
@Override
|
||||
public final void register() {
|
||||
Bukkit.getPluginCommand(name).setExecutor(this);
|
||||
PluginCommand command = Bukkit.getPluginCommand(name);
|
||||
assert command != null;
|
||||
command.setExecutor(this);
|
||||
|
||||
AbstractTabCompleter tabCompleter = this.getTab();
|
||||
if(tabCompleter != null) {
|
||||
Bukkit.getPluginCommand(name).setTabCompleter(tabCompleter);
|
||||
command.setTabCompleter(tabCompleter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ public abstract class EnchantmentYamlConfig {
|
||||
update();
|
||||
}
|
||||
|
||||
private void saveResource(boolean replace) {
|
||||
private void saveResource() {
|
||||
String resourcePath = "/enchants/" + type.getName() + "/" + name + ".yml";
|
||||
|
||||
InputStream in = source.getResourceAsStream(resourcePath);
|
||||
@ -69,7 +69,7 @@ public abstract class EnchantmentYamlConfig {
|
||||
}
|
||||
|
||||
try {
|
||||
if (!outFile.exists() || replace) {
|
||||
if (!outFile.exists() || false) {
|
||||
OutputStream out = new FileOutputStream(outFile);
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
@ -83,7 +83,7 @@ public abstract class EnchantmentYamlConfig {
|
||||
}
|
||||
|
||||
private void createFile() {
|
||||
saveResource(false);
|
||||
saveResource();
|
||||
}
|
||||
|
||||
public void update() {
|
||||
|
@ -25,6 +25,7 @@ import java.util.List;
|
||||
/**
|
||||
* All methods and fields pertaining to showing players the enchantments on their items.
|
||||
*/
|
||||
@SuppressWarnings("DeprecatedIsStillUsed")
|
||||
public class EnchantDisplay {
|
||||
/**
|
||||
* The meta key to hide enchantments in lore
|
||||
|
@ -39,7 +39,7 @@ public class Succession extends EcoEnchant {
|
||||
DurabilityUtils.damageItem((Player) shooter, ((Player) shooter).getInventory().getItemInMainHand(), 1, ((Player) shooter).getInventory().getHeldItemSlot());
|
||||
}
|
||||
}
|
||||
}, i * 2);
|
||||
}, i * 2L);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,9 @@ public class AnvilMerge {
|
||||
if(!EnchantmentTarget.ALL.getMaterials().contains(left.getType()) || right == null || !EnchantmentTarget.ALL.getMaterials().contains(right.getType())) {
|
||||
ItemStack out = left.clone();
|
||||
ItemMeta outMeta = out.getItemMeta();
|
||||
assert outMeta != null;
|
||||
assert left.getItemMeta() != null;
|
||||
|
||||
outMeta.setDisplayName(name);
|
||||
|
||||
if(left.getItemMeta().getDisplayName().equals(name)) {
|
||||
|
@ -53,7 +53,7 @@ public class EnchantChecks {
|
||||
* Get all {@link EcoEnchant}s on a specified ItemStack
|
||||
*
|
||||
* @param item The ItemStack to query
|
||||
* @return A {@link HashMap<EcoEnchant, Integer>} of all EcoEnchants, where the key represents the level
|
||||
* @return A {@link HashMap} of all EcoEnchants, where the key represents the level
|
||||
*/
|
||||
public static Map<EcoEnchant, Integer> getEnchantsOnItem(ItemStack item) {
|
||||
if (item == null) return new HashMap<>();
|
||||
@ -110,7 +110,7 @@ public class EnchantChecks {
|
||||
* Get all {@link EcoEnchant}s on a specified Arrow
|
||||
*
|
||||
* @param arrow The Arrow to query
|
||||
* @return A {@link HashMap<EcoEnchant, Integer>} of all EcoEnchants, where the key represents the level
|
||||
* @return A {@link HashMap} of all EcoEnchants, where the key represents the level
|
||||
*/
|
||||
public static Map<EcoEnchant, Integer> getEnchantsOnArrow(Arrow arrow) {
|
||||
if (arrow.getMetadata("enchantments").isEmpty()) return new HashMap<>();
|
||||
@ -160,7 +160,7 @@ public class EnchantChecks {
|
||||
* Get all {@link EcoEnchant}s on a queried {@link LivingEntity}s main hand item
|
||||
*
|
||||
* @param entity The entity to query
|
||||
* @return A {@link HashMap<EcoEnchant, Integer>} of all EcoEnchants, where the key represents the level
|
||||
* @return A {@link HashMap} of all EcoEnchants, where the key represents the level
|
||||
*/
|
||||
public static Map<EcoEnchant, Integer> getEnchantsOnMainhand(LivingEntity entity) {
|
||||
if (entity.getEquipment() == null)
|
||||
@ -212,7 +212,7 @@ public class EnchantChecks {
|
||||
* Get all {@link EcoEnchant}s on a queried {@link LivingEntity}s offhand item
|
||||
*
|
||||
* @param entity The entity to query
|
||||
* @return A {@link HashMap<EcoEnchant, Integer>} of all EcoEnchants, where the key represents the level
|
||||
* @return A {@link HashMap} of all EcoEnchants, where the key represents the level
|
||||
*/
|
||||
public static Map<EcoEnchant, Integer> getEnchantsOnOffhand(LivingEntity entity) {
|
||||
if (entity.getEquipment() == null)
|
||||
@ -291,7 +291,7 @@ public class EnchantChecks {
|
||||
* Get all {@link EcoEnchant}s on a queried {@link LivingEntity}s armor
|
||||
*
|
||||
* @param entity The entity to query
|
||||
* @return A {@link HashMap<EcoEnchant, Integer>} of all EcoEnchants, where the key represents the cumulative total levels
|
||||
* @return A {@link HashMap} of all EcoEnchants, where the key represents the cumulative total levels
|
||||
*/
|
||||
public static Map<EcoEnchant, Integer> getEnchantsOnArmor(LivingEntity entity) {
|
||||
if (entity.getEquipment() == null)
|
||||
|
@ -26,7 +26,7 @@ public class SpellRunnable {
|
||||
}
|
||||
|
||||
public void updateEndTime() {
|
||||
endTime = System.currentTimeMillis() + (spell.getCooldownTime()*1000);
|
||||
endTime = System.currentTimeMillis() + (spell.getCooldownTime()* 1000L);
|
||||
}
|
||||
|
||||
public void setTask(Callable callable) {
|
||||
|
@ -145,15 +145,6 @@ public class ArmorListener implements Listener {
|
||||
}
|
||||
}
|
||||
// Debug shit
|
||||
/*System.out.println("Slots: " + event.getInventorySlots().toString());
|
||||
System.out.println("Raw Slots: " + event.getRawSlots().toString());
|
||||
if(event.getCursor() != null){
|
||||
System.out.println("Cursor: " + event.getCursor().getType().name());
|
||||
}
|
||||
if(event.getOldCursor() != null){
|
||||
System.out.println("OldCursor: " + event.getOldCursor().getType().name());
|
||||
}
|
||||
System.out.println("Type: " + event.getType().name());*/
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -8,7 +8,9 @@ import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
||||
import com.sk89q.worldguard.protection.regions.RegionQuery;
|
||||
import com.willfp.ecoenchants.integrations.antigrief.AntigriefWrapper;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -31,9 +33,11 @@ public class AntigriefWorldGuard implements AntigriefWrapper {
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
RegionQuery query = container.createQuery();
|
||||
World world = location.getWorld();
|
||||
Validate.notNull(world, "World cannot be null!");
|
||||
|
||||
if (!query.testState(BukkitAdapter.adapt(location), localPlayer, Flags.OTHER_EXPLOSION)) {
|
||||
return WorldGuard.getInstance().getPlatform().getSessionManager().hasBypass(localPlayer, BukkitAdapter.adapt(location.getWorld()));
|
||||
return WorldGuard.getInstance().getPlatform().getSessionManager().hasBypass(localPlayer, BukkitAdapter.adapt(world));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* A placeholder entry consists of an identifier and an {@link ObjectBiCallable<String, Player>} to fetch the result
|
||||
* A placeholder entry consists of an identifier and an {@link ObjectBiCallable} to fetch the result
|
||||
*/
|
||||
public class PlaceholderEntry {
|
||||
private final String identifier;
|
||||
|
Loading…
Reference in New Issue
Block a user