Skip to content

Commit

Permalink
merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Envel-Nikita-Gutsenkov committed Jul 2, 2023
1 parent a913349 commit a4dff8a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
import network.darkhelmet.prism.Prism;
import network.darkhelmet.prism.actionlibs.ActionsQuery;
import network.darkhelmet.prism.actionlibs.QueryParameters;
import network.darkhelmet.prism.actions.BlockAction;
import network.darkhelmet.prism.actions.GenericAction;
import network.darkhelmet.prism.actions.HangingItemAction;
import network.darkhelmet.prism.actions.ItemStackAction;
import network.darkhelmet.prism.actions.SignAction;
import network.darkhelmet.prism.actions.*;
import network.darkhelmet.prism.api.BlockStateChange;
import network.darkhelmet.prism.api.ChangeResult;
import network.darkhelmet.prism.api.ChangeResultType;
Expand Down Expand Up @@ -262,7 +258,7 @@ private void processWorldChanges() {
if (processType.equals(PrismProcessType.RESTORE)) {
if (match && !action.isRollbacked()) {
if (action instanceof BlockAction || action instanceof HangingItemAction
|| action instanceof ItemStackAction || action instanceof SignAction) {
|| action instanceof ItemStackAction || action instanceof SignChangeAction) {
stateSkippedCount++;
skippedBlockCount++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -788,82 +788,6 @@ public void onEntityBlockForm(final EntityBlockFormEvent event) {
}
}

/**
* EntityExplodeEvent.
* @param event EntityExplodeEvent
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityExplodeChangeBlock(final EntityExplodeEvent event) {

if (event.blockList().isEmpty()) {
return;
}
String name;
String action = "entity-explode";
if (event.getEntity() != null) {
if (event.getEntity() instanceof Creeper) {
if (!Prism.getIgnore().event("creeper-explode", event.getEntity().getWorld())) {
return;
}
action = "creeper-explode";
name = "creeper";
} else if (event.getEntity() instanceof TNTPrimed) {
if (!Prism.getIgnore().event("tnt-explode", event.getEntity().getWorld())) {
return;
}
action = "tnt-explode";
Entity source = ((TNTPrimed) event.getEntity()).getSource();
name = followTntTrail(source);
} else if (event.getEntity() instanceof EnderDragon) {
if (!Prism.getIgnore().event("dragon-eat", event.getEntity().getWorld())) {
return;
}
action = "dragon-eat";
name = "enderdragon";
} else {
if (!Prism.getIgnore().event("entity-explode", event.getLocation().getWorld())) {
return;
}
try {
name = event.getEntity().getType().name().toLowerCase().replace("_", " ");
name = name.length() > 15 ? name.substring(0, 15) : name; // I
} catch (final NullPointerException e) {
name = "unknown";
}
}
} else {
if (!Prism.getIgnore().event("entity-explode", event.getLocation().getWorld())) {
return;
}
name = "magic";
}
contructBlockEvent(action,name,event.blockList());
}

private String followTntTrail(Entity initial) {
int counter = 10000000;

while (initial != null) {
if (initial instanceof Player) {
return initial.getName();
} else if (initial instanceof TNTPrimed) {
initial = (((TNTPrimed) initial).getSource());
if (counter < 0 && initial != null) {
Location last = initial.getLocation();
plugin.getLogger().warning("TnT chain has exceeded one million, will not continue!");
plugin.getLogger().warning("Last Tnt was at " + last.getX() + ", " + last.getY() + ". "
+ last.getZ() + " in world " + last.getWorld());
return "tnt";
}
counter--;
} else {
return initial.getType().name();
}
}

return "tnt";
}

public static class DropItems {

final List<ItemStack> itemStacks;
Expand Down

0 comments on commit a4dff8a

Please sign in to comment.