Skip to content

Commit

Permalink
chore: more style refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Machine-Maker committed Jun 12, 2023
1 parent 9d0c298 commit b312762
Show file tree
Hide file tree
Showing 107 changed files with 939 additions and 423 deletions.
File renamed without changes.
19 changes: 19 additions & 0 deletions .spotless/HEADER_misc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* GNU General Public License v3
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) $YEAR Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
10 changes: 9 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,20 @@ java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}

spotless {
format("javaMisc") {
target("src/**/package-info.java")
licenseHeaderFile(rootProject.file(".spotless/HEADER_misc"), "(\\/\\*\\*|@DefaultQualifier)")
.updateYearWithLatest(true)
}
}

indraSpotlessLicenser {
headerFormat {
starSlash()
property("name", "Machine_Maker")
}
licenseHeaderFile(rootProject.file("HEADER"))
licenseHeaderFile(rootProject.file(".spotless/HEADER"))
extraConfig {
spotless {
updateYearWithLatest(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2021 Machine_Maker
* Copyright (C) 2022-2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2021 Machine_Maker
* Copyright (C) 2022-2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Annotations for PaperTweaks
*/
@DefaultQualifier(NonNull.class)
package me.machinemaker.papertweaks.annotations;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2021 Machine_Maker
* Copyright (C) 2022-2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2021 Machine_Maker
* Copyright (C) 2022-2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2021 Machine_Maker
* Copyright (C) 2022-2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2021 Machine_Maker
* Copyright (C) 2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2021 Machine_Maker
* Copyright (C) 2022-2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2021 Machine_Maker
* Copyright (C) 2022-2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/me/machinemaker/papertweaks/config/package-info.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* GNU General Public License v3
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Configuration management for PaperTweaks
*/
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/me/machinemaker/papertweaks/db/package-info.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* GNU General Public License v3
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Database configuration for PaperTweaks
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2021 Machine_Maker
* Copyright (C) 2022-2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2021 Machine_Maker
* Copyright (C) 2021-2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2021 Machine_Maker
* Copyright (C) 2022-2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2021 Machine_Maker
* Copyright (C) 2021-2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2021 Machine_Maker
* Copyright (C) 2021-2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2021 Machine_Maker
* Copyright (C) 2021-2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2021 Machine_Maker
* Copyright (C) 2022-2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* GNU General Public License v3
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Manage file+config migrations for PaperTweaks
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,27 @@
*/
package me.machinemaker.papertweaks.modules.experimental.confetticreepers;

import java.util.Collection;
import java.util.Set;
import me.machinemaker.papertweaks.annotations.ModuleInfo;
import me.machinemaker.papertweaks.modules.ModuleBase;
import me.machinemaker.papertweaks.modules.ModuleConfig;
import me.machinemaker.papertweaks.annotations.ModuleInfo;
import me.machinemaker.papertweaks.modules.ModuleLifecycle;
import me.machinemaker.papertweaks.modules.ModuleListener;
import org.jetbrains.annotations.NotNull;

import java.util.Collection;
import java.util.Set;

@ModuleInfo(name = "ConfettiCreepers", configPath = "experimental.confetti-creepers", description = "Makes creepers super colorful!")
public class ConfettiCreepers extends ModuleBase {

@NotNull
@Override
protected Class<? extends ModuleLifecycle> lifecycle() {
return ModuleLifecycle.Empty.class;
}

@NotNull
@Override
protected Collection<Class<? extends ModuleListener>> listeners() {
return Set.of(ExplosionListener.class);
}

@NotNull
@Override
protected Collection<Class<? extends ModuleConfig>> configs() {
return Set.of(Config.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package me.machinemaker.papertweaks.modules.experimental.confetticreepers;

import com.google.inject.Inject;
import java.util.concurrent.ThreadLocalRandom;
import me.machinemaker.papertweaks.modules.ModuleListener;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
Expand All @@ -30,39 +31,37 @@
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.inventory.meta.FireworkMeta;

import java.util.concurrent.ThreadLocalRandom;

public class ExplosionListener implements ModuleListener {

private static final FireworkEffect COLORFUL_EFFECT = FireworkEffect.builder()
.flicker(false)
.trail(false)
.with(FireworkEffect.Type.BURST)
.withColor(
Color.fromRGB(11743532),
Color.fromRGB(15435844),
Color.fromRGB(14602026),
Color.fromRGB(4312372),
Color.fromRGB(6719955),
Color.fromRGB(8073150),
Color.fromRGB(14188952)
).build();
.flicker(false)
.trail(false)
.with(FireworkEffect.Type.BURST)
.withColor(
Color.fromRGB(11743532),
Color.fromRGB(15435844),
Color.fromRGB(14602026),
Color.fromRGB(4312372),
Color.fromRGB(6719955),
Color.fromRGB(8073150),
Color.fromRGB(14188952)
).build();

private final Config config;

@Inject
public ExplosionListener(Config config) {
public ExplosionListener(final Config config) {
this.config = config;
}

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onExplosionPrime(ExplosionPrimeEvent event) {
public void onExplosionPrime(final ExplosionPrimeEvent event) {
if (event.getEntityType() != EntityType.CREEPER) return;
if (ThreadLocalRandom.current().nextDouble() < config.chance) {
if (ThreadLocalRandom.current().nextDouble() < this.config.chance) {
event.setFire(false);
event.setRadius(0);
event.getEntity().getWorld().spawn(event.getEntity().getLocation(), Firework.class, firework -> {
FireworkMeta fireworkMeta = firework.getFireworkMeta();
final FireworkMeta fireworkMeta = firework.getFireworkMeta();
fireworkMeta.setPower(0);
fireworkMeta.addEffect(COLORFUL_EFFECT);
firework.setFireworkMeta(fireworkMeta);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* GNU General Public License v3
*
* PaperTweaks, a performant replacement for the VanillaTweaks datapacks.
*
* Copyright (C) 2023 Machine_Maker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* ConfettiCreepers module
*/
@DefaultQualifier(NonNull.class)
package me.machinemaker.papertweaks.modules.experimental.confetticreepers;

import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.framework.qual.DefaultQualifier;
Loading

0 comments on commit b312762

Please sign in to comment.