Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69c163468f | ||
|
|
34421b64f7 | ||
|
|
0edf160f43 | ||
|
|
45d4642086 | ||
|
|
af35a98b1d | ||
|
|
950cf9460b | ||
|
|
1b6d2ec667 | ||
|
|
d7910262be | ||
|
|
8459181f77 |
No files matched your search
@@ -41,7 +41,7 @@ Maven
|
||||
<dependency>
|
||||
<groupId>net.coreprotect</groupId>
|
||||
<artifactId>coreprotect</artifactId>
|
||||
<version>22.0</version>
|
||||
<version>22.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'net.coreprotect'
|
||||
String projectVersion = '22.0'
|
||||
String projectVersion = '22.1'
|
||||
String projectBranch = ''
|
||||
version = projectVersion // `version` might be modified, we don't always want that (e.g. plugin.yml)
|
||||
description = 'Provides block protection for your server.'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.coreprotect</groupId>
|
||||
<artifactId>CoreProtect</artifactId>
|
||||
<version>22.0</version>
|
||||
<version>22.1</version>
|
||||
<properties>
|
||||
<project.branch></project.branch>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -191,8 +191,8 @@ public class CoreProtectAPI extends Queue {
|
||||
boolean match = false;
|
||||
|
||||
if (Config.getGlobal().API_ENABLED) {
|
||||
long timestamp = System.currentTimeMillis() / 1000L;
|
||||
long offsetTime = timestamp - offset;
|
||||
long timestamp = System.currentTimeMillis();
|
||||
long offsetTime = timestamp - offset * 1000L;
|
||||
List<String[]> check = blockLookup(block, time);
|
||||
|
||||
for (String[] value : check) {
|
||||
@@ -212,8 +212,8 @@ public class CoreProtectAPI extends Queue {
|
||||
boolean match = false;
|
||||
|
||||
if (Config.getGlobal().API_ENABLED) {
|
||||
long timestamp = System.currentTimeMillis() / 1000L;
|
||||
long offsetTime = timestamp - offset;
|
||||
long timestamp = System.currentTimeMillis();
|
||||
long offsetTime = timestamp - offset * 1000L;
|
||||
List<String[]> check = blockLookup(block, time);
|
||||
|
||||
for (String[] value : check) {
|
||||
|
||||
@@ -43,6 +43,7 @@ public class Config extends Language {
|
||||
public String MYSQL_PASSWORD;
|
||||
public String LANGUAGE;
|
||||
public boolean ENABLE_AWE;
|
||||
public boolean ENABLE_SSL;
|
||||
public boolean DISABLE_WAL;
|
||||
public boolean HOVER_EVENTS;
|
||||
public boolean DATABASE_LOCK;
|
||||
@@ -190,6 +191,7 @@ public class Config extends Language {
|
||||
|
||||
private void readValues() {
|
||||
this.ENABLE_AWE = this.getBoolean("enable-awe", false);
|
||||
this.ENABLE_SSL = this.getBoolean("enable-ssl", false);
|
||||
this.DISABLE_WAL = this.getBoolean("disable-wal", false);
|
||||
this.HOVER_EVENTS = this.getBoolean("hover-events", true);
|
||||
this.DATABASE_LOCK = this.getBoolean("database-lock", true);
|
||||
|
||||
@@ -249,7 +249,7 @@ public class ConfigHandler extends Queue {
|
||||
config.addDataSourceProperty("maintainTimeStats", "false");
|
||||
/* Disable SSL to suppress the unverified server identity warning */
|
||||
config.addDataSourceProperty("allowPublicKeyRetrieval", "true");
|
||||
config.addDataSourceProperty("useSSL", "false");
|
||||
config.addDataSourceProperty("useSSL", Config.getGlobal().ENABLE_SSL);
|
||||
|
||||
ConfigHandler.hikariDataSource = new HikariDataSource(config);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package net.coreprotect.event;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class CoreProtectPreLogEvent extends Event {
|
||||
public class CoreProtectPreLogEvent extends Event implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled = false;
|
||||
@@ -18,10 +19,12 @@ public class CoreProtectPreLogEvent extends Event {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public final class BlockDispenseListener extends Queue implements Listener {
|
||||
boolean dispenseSuccess = !event.getVelocity().equals(new Vector()); // true if velocity is set
|
||||
boolean dispenseRelative = newBlock.getLocation().equals(velocityLocation); // true if velocity location matches relative location
|
||||
|
||||
if (!BlockPreDispenseListener.useBlockPreDispenseEvent) {
|
||||
if (!BlockPreDispenseListener.useBlockPreDispenseEvent || (!BlockPreDispenseListener.useForDroppers && block.getType() == Material.DROPPER)) {
|
||||
if (dispenseRelative || material.equals(Material.FLINT_AND_STEEL) || material.equals(Material.SHEARS)) {
|
||||
forceItem = false;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,13 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockFertilizeEvent;
|
||||
|
||||
@@ -18,7 +20,7 @@ import net.coreprotect.thread.CacheHandler;
|
||||
|
||||
public final class BlockFertilizeListener extends Queue implements Listener {
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
protected void onBlockFertilize(BlockFertilizeEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
@@ -31,12 +33,16 @@ public final class BlockFertilizeListener extends Queue implements Listener {
|
||||
|
||||
Location location = block.getLocation();
|
||||
List<BlockState> blocks = event.getBlocks();
|
||||
|
||||
if (Tag.SAPLINGS.isTagged(block.getType()) && (!Config.getConfig(location.getWorld()).TREE_GROWTH || (blocks.size() == 1 && blocks.get(0).getLocation().equals(location)))) {
|
||||
return;
|
||||
}
|
||||
if (block.getType().name().toLowerCase(Locale.ROOT).contains("mushroom") && (!Config.getConfig(location.getWorld()).MUSHROOM_GROWTH || (blocks.size() == 1 && blocks.get(0).getLocation().equals(location)))) {
|
||||
return;
|
||||
}
|
||||
if (block.getType() == Material.AIR && blocks.size() > 1 && Tag.LOGS.isTagged(blocks.get(1).getType()) && !Config.getConfig(location.getWorld()).TREE_GROWTH) {
|
||||
return;
|
||||
}
|
||||
|
||||
String user = "#bonemeal";
|
||||
Player player = event.getPlayer();
|
||||
|
||||
@@ -642,7 +642,7 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
||||
});
|
||||
*/
|
||||
}
|
||||
else if ((type == Material.CAMPFIRE || type == Material.SOUL_CAMPFIRE) && CampfireStartListener.useCampfireStartEvent) {
|
||||
else if (CampfireStartListener.useCampfireStartEvent && (type == Material.CAMPFIRE || type == Material.SOUL_CAMPFIRE)) {
|
||||
ItemStack handItem = null;
|
||||
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
||||
ItemStack offHand = player.getInventory().getItemInOffHand();
|
||||
|
||||
@@ -8,6 +8,10 @@ public class Paper_v1_17 extends Paper_v1_16 implements PaperInterface {
|
||||
|
||||
@Override
|
||||
public String getLine(Sign sign, int line) {
|
||||
if (line >= 4) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// https://docs.adventure.kyori.net/serializer/
|
||||
return LegacyComponentSerializer.legacySection().serialize(sign.line(line));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.coreprotect.paper.listener;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
@@ -18,6 +19,7 @@ import net.coreprotect.listener.player.InventoryChangeListener;
|
||||
public final class BlockPreDispenseListener extends Queue implements Listener {
|
||||
|
||||
public static boolean useBlockPreDispenseEvent = true;
|
||||
public static boolean useForDroppers = false;
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockPreDispense(BlockPreDispenseEvent event) {
|
||||
@@ -29,6 +31,10 @@ public final class BlockPreDispenseListener extends Queue implements Listener {
|
||||
|
||||
BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Dispenser) {
|
||||
if (!useForDroppers && block.getType() == Material.DROPPER) {
|
||||
useForDroppers = true;
|
||||
}
|
||||
|
||||
String user = "#dispenser";
|
||||
ItemStack[] inventory = ((InventoryHolder) block.getState()).getInventory().getStorageContents();
|
||||
InventoryChangeListener.inventoryTransaction(user, block.getLocation(), inventory);
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
@@ -28,6 +27,7 @@ import org.bukkit.inventory.meta.SuspiciousStewMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import net.coreprotect.bukkit.BukkitAdapter;
|
||||
import net.coreprotect.utility.Color;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
public class ItemMetaHandler {
|
||||
@@ -96,7 +96,8 @@ public class ItemMetaHandler {
|
||||
|
||||
public static List<String> getEnchantments(ItemStack item, String displayName) {
|
||||
List<String> result = new ArrayList<>();
|
||||
Map<Enchantment, Integer> enchantments = getEnchantments(item.getItemMeta());
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
Map<Enchantment, Integer> enchantments = getEnchantments(itemMeta);
|
||||
|
||||
for (Entry<Enchantment, Integer> entry : enchantments.entrySet()) {
|
||||
Enchantment enchantment = entry.getKey();
|
||||
@@ -105,6 +106,12 @@ public class ItemMetaHandler {
|
||||
result.add(getEnchantmentName(enchantment, level));
|
||||
}
|
||||
|
||||
if (itemMeta.hasLore()) {
|
||||
for (String lore : itemMeta.getLore()) {
|
||||
result.add(Color.DARK_PURPLE + Color.ITALIC + lore);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -284,11 +291,11 @@ public class ItemMetaHandler {
|
||||
List<Map<String, Object>> fadeList = new ArrayList<>();
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
|
||||
for (Color color : effect.getColors()) {
|
||||
for (org.bukkit.Color color : effect.getColors()) {
|
||||
colorList.add(color.serialize());
|
||||
}
|
||||
|
||||
for (Color color : effect.getFadeColors()) {
|
||||
for (org.bukkit.Color color : effect.getFadeColors()) {
|
||||
fadeList.add(color.serialize());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user