Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@
<version>1.26.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.34</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -157,4 +163,4 @@
</plugins>
</build>

</project>
</project>
6 changes: 3 additions & 3 deletions src/main/java/ce/ajneb97/ConditionalEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void onEnable(){
this.eventsManager = new EventsManager(this);
this.dependencyManager = new DependencyManager(this);
this.bungeeMessagingManager = new BungeeMessagingManager(this);
this.debugManager = new DebugManager(this);
this.debugManager = new DebugManager();
this.playerManager = new PlayerManager(this);
this.savedItemsManager = new SavedItemsManager(this);
this.apiManager = new APIManager(this);
Expand Down Expand Up @@ -109,11 +109,11 @@ public void registerEvents() {
pm.registerEvents(new OtherEventsListener(this), this);
pm.registerEvents(new CustomEventListener(this), this);

if(serverVersion.serverVersionGreaterEqualThan(serverVersion,ServerVersion.v1_9_R1)){
if (ServerVersion.serverVersionGreaterEqualThan(serverVersion, ServerVersion.v1_9_R1)) {
pm.registerEvents(new ItemSelectListenerNew(), this);
pm.registerEvents(new PlayerEventsListenerNew1_9(this), this);
}
if(serverVersion.serverVersionGreaterEqualThan(serverVersion,ServerVersion.v1_16_R1)){
if (ServerVersion.serverVersionGreaterEqualThan(serverVersion, ServerVersion.v1_16_R1)) {
pm.registerEvents(new PlayerEventsListenerNew1_16(this), this);
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/ce/ajneb97/MainCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;


public class MainCommand implements CommandExecutor, TabCompleter {
Expand Down Expand Up @@ -196,7 +195,7 @@ public void debug(String[] args,CommandSender sender,FileConfiguration config,Me
playerName = args[2];
}

boolean result = plugin.getDebugManager().setDebugSender(sender,eventName,playerName);
boolean result = plugin.getDebugManager().addDebugger(sender,eventName,playerName);
if(result){
if(playerName != null){
msgManager.sendMessage(sender,config.getString("Messages.debugEnabledPlayer")
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/ce/ajneb97/configs/ConfigsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,19 @@ public void configureEvents(){
}
}
if(config.contains(path+".cooldown")) {
cooldown = Long.valueOf(config.getString(path+".cooldown"));
cooldown = Long.parseLong(config.getString(path + ".cooldown"));
}
if(config.contains(path+".ignore_with_permission")) {
ignoreWithPermission = config.getString(path+".ignore_with_permission");
}
if(config.contains(path+".one_time")) {
oneTime = Boolean.valueOf(config.getString(path+".one_time"));
oneTime = Boolean.parseBoolean(config.getString(path + ".one_time"));
}
if(config.contains(path+".enabled")) {
enabled = Boolean.valueOf(config.getString(path+".enabled"));
enabled = Boolean.parseBoolean(config.getString(path + ".enabled"));
}
if(config.contains(path+".ignore_if_cancelled")) {
ignoreIfCancelled = Boolean.valueOf(config.getString(path+".ignore_if_cancelled"));
ignoreIfCancelled = Boolean.parseBoolean(config.getString(path + ".ignore_if_cancelled"));
}
if(config.contains(path+".prevent_cooldown_activation")){
preventCooldownActivationActionGroups = config.getStringList(path+".prevent_cooldown_activation");
Expand All @@ -177,7 +177,7 @@ public void configureEvents(){
preventOneTimeActivationActionGroups = config.getStringList(path+".prevent_one_time_activation");
}
if(config.contains(path+".allow_math_formulas_in_conditions")) {
allowMathFormulasInConditions = Boolean.valueOf(config.getString(path+".allow_math_formulas_in_conditions"));
allowMathFormulasInConditions = Boolean.parseBoolean(config.getString(path + ".allow_math_formulas_in_conditions"));
}

event.setEventType(eventType);
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/ce/ajneb97/configs/MainConfigManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@

import ce.ajneb97.ConditionalEvents;
import ce.ajneb97.managers.MessagesManager;
import ce.ajneb97.managers.RepetitiveManager;
import ce.ajneb97.model.CEEvent;
import ce.ajneb97.model.CustomEventProperties;
import ce.ajneb97.model.EventType;
import ce.ajneb97.model.ToConditionGroup;
import ce.ajneb97.model.actions.*;
import org.bukkit.Bukkit;
import lombok.Getter;
import org.bukkit.configuration.file.FileConfiguration;

import java.io.IOException;
Expand All @@ -26,7 +21,10 @@ public class MainConfigManager {
private boolean updateNotifications;
private boolean debugActions;
private boolean experimentalVariableReplacement;
@Getter
private boolean experimentalSerializeItemMeta;
private ArrayList<ToConditionGroup> toConditionGroups;

public MainConfigManager(ConditionalEvents plugin){
this.plugin = plugin;
this.configFile = new CEConfig("config.yml",plugin,null);
Expand All @@ -40,6 +38,7 @@ public void configure(){
updateNotifications = config.getBoolean("Config.update_notification");
debugActions = config.getBoolean("Config.debug_actions");
experimentalVariableReplacement = config.getBoolean("Config.experimental.variable_replacement");
experimentalSerializeItemMeta = config.getBoolean("Config.experimental.serialize_item_meta", true);
toConditionGroups = new ArrayList<ToConditionGroup>();
String path = "Config.to_condition_groups";
if(config.contains(path)){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ public final void inventoryClick(final InventoryClickEvent e){
}
}
}else{
ServerVersion serverVersion = ConditionalEvents.serverVersion;
if(isAirOrNull(e.getCursor()) && !isAirOrNull(e.getCurrentItem())){// unequip with no new item going into the slot.
newArmorType = ArmorType.matchType(e.getCurrentItem());
}
if(ConditionalEvents.serverVersion.serverVersionGreaterEqualThan(serverVersion,ServerVersion.v1_9_R1)){
if (ServerVersion.serverVersionGreaterEqualThan(ConditionalEvents.serverVersion, ServerVersion.v1_9_R1)) {
ItemStack offhandItem = e.getWhoClicked().getInventory().getItemInOffHand();
if(e.getSlotType() == SlotType.ARMOR && !isAirOrNull(offhandItem)){
ArmorType offhandArmorType = ArmorType.matchType(offhandItem);
Expand Down Expand Up @@ -135,12 +134,11 @@ public void playerInteractEvent(PlayerInteractEvent e){

ArmorType newArmorType = ArmorType.matchType(e.getItem());
if(newArmorType != null && !isHead(e.getItem())){
ServerVersion serverVersion = ConditionalEvents.serverVersion;

ItemStack newArmorPiece = e.getItem();
ItemStack oldArmorPiece = null;

if(ConditionalEvents.serverVersion.serverVersionGreaterEqualThan(serverVersion,ServerVersion.v1_20_R1)){
if (ServerVersion.serverVersionGreaterEqualThan(ConditionalEvents.serverVersion, ServerVersion.v1_20_R1)) {
switch(newArmorType){
case HELMET:
oldArmorPiece = player.getInventory().getHelmet();
Expand Down Expand Up @@ -234,8 +232,7 @@ public static boolean isAirOrNull(ItemStack item){

public static boolean isHead(ItemStack item) {
String materialName = item.getType().name();
ServerVersion serverVersion = ConditionalEvents.serverVersion;
if(serverVersion.serverVersionGreaterEqualThan(serverVersion,ServerVersion.v1_13_R1)){
if (ServerVersion.serverVersionGreaterEqualThan(ConditionalEvents.serverVersion, ServerVersion.v1_13_R1)) {
if(materialName.equals("CARVED_PUMPKIN")){
return true;
}
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/ce/ajneb97/libs/armorequipevent/ArmorType.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import ce.ajneb97.ConditionalEvents;
import ce.ajneb97.utils.ServerVersion;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

/**
Expand All @@ -28,8 +27,7 @@ public static ArmorType matchType(final ItemStack itemStack){
if(ArmorListener.isAirOrNull(itemStack)) return null;
String type = itemStack.getType().name();

ServerVersion serverVersion = ConditionalEvents.serverVersion;
if(serverVersion.serverVersionGreaterEqualThan(serverVersion,ServerVersion.v1_13_R1)){
if (ServerVersion.serverVersionGreaterEqualThan(ConditionalEvents.serverVersion, ServerVersion.v1_13_R1)) {
if(type.equals("CARVED_PUMPKIN")){
return HELMET;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ce/ajneb97/listeners/PlayerEventsListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,10 @@ public void onCommandUse(PlayerCommandPreprocessEvent event) {
public void onChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();

new ConditionEvent(plugin, player, event, EventType.PLAYER_CHAT, null)
new ConditionEvent(plugin, player, event, EventType.PLAYER_CHAT, null, true)
.addVariables(
new StoredVariable("%message%",event.getMessage())
).setAsync(true).checkEvent();
).checkEvent();
}

@EventHandler(priority = EventPriority.HIGHEST)
Expand Down
Loading