Skip to content

Commit

Permalink
Release 1.0, this is what was used on the server on 2024-04-01
Browse files Browse the repository at this point in the history
  • Loading branch information
x86-39 committed Apr 2, 2024
1 parent 47bfd88 commit 1dc1c19
Show file tree
Hide file tree
Showing 44 changed files with 3,517 additions and 9 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Build JAR for release

on:
release:
types: [published]
workflow_dispatch:

jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: amd64
qemu_arch: x86_64
tag_suffix: ''
latest_tag: latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build native image with Gradle
run: ./gradlew build

- name: Upload JAR as an artifact
uses: actions/upload-artifact@v2
with:
name: "AprilFools2024 Jar"
path: build/libs/AprilFools2024-*.jar
if-no-files-found: error

- name: Publish package
uses: gradle/gradle-build-action@v2
# Only run on amd64
if: matrix.arch == 'amd64'
with:
arguments: publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload STLs to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "build/libs/AprilFools2024-*.jar"
tag: ${{ github.ref }}
overwrite: true
file_glob: true
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and Push Packages

on:
push:
branches:
- 'main'

jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: amd64
qemu_arch: x86_64
tag_suffix: ''
latest_tag: latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build native image with Gradle
run: ./gradlew build
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# April Fools 2024

This is a simple quick and dirty plugin making use of my `InvUILib` library which you can find here [diademiemi/InvUILib](https://github.com/diademiemi/InvUILib).

This was made for Queercraft's April Fools 2024 event. The joke was that the server needed extra security, which costed too much. This would explain the "CAPTCHA" which this plugin adds, along with the "popup ads".

## Installation
You can get a copy of the plugin from the [releases page](https://github.com/Queercraft/AprilFools2024/releases).
The plugin requires `InvUILib` to be installed on your server. You can get a copy of `InvUILib` from the [InvUILib releases page](https://github.com/diademiemi/InvUILib/releases).

## Usage
When a player joins with the `aprilfools2024.track` permission, they will be tracked by the plugin. This will include some of their actions.

Upon a tracked player joining, they will be greeted with a popup prompting them to accept cookies, a terms of service, privacy policy, EULA and complete a CAPTCHA. These are all humorous and do not actually do anything.
When accepting the cookie, the player will be given a cookie item. This item is purely cosmetic and does not do anything, it includes special lore because people love their collectible items from events...

All these are tracked in a jsonData field in the player's data, this is to track whether they've already received a reward or seen a popup.

Certain tasks will be tracked. For example, placing 64 blocks gives you a popup to "Renew your Minecraft license". Upon getting this popup, a boolean is stored in the player's data to prevent them from getting the popup again.

The plugin also includes a "popup ad" feature. This is a simple scheduler which shows a random popup to every online player once every 10-30 minutes (random interval).

## Commands
- `/aprilfools2024 get <player> <flag>` - Get a flag from a player's data.
- `/aprilfools2024 setbool <player> <flag> <value>` - Set a boolean flag in a player's data.
- `/aprilfools2024 setint <player> <flag> <value>` - Set an integer flag in a player's data.
- `/aprilfools2024 setstring <player> <flag> <value>` - Set a string flag in a player's data.
- `/aprilfools2024 clear <player>` - Reset a player's data.
- `/aprilfools2024 save` - Save the plugin's data to data.yml.
- `/aprilfools2024 test <player> <popupname>` - Test a popup on a player.

## Permissions
- `aprilfools2024.track` - Allows a player to be tracked by the plugin.
- `aprilfools2024.admin` - Allows a player to use the commands.

## the funny bit

ok so im done writing as if this is a serious plugin lmfao. this shit SUCKS. the code is abysmal and was written on a huge time crunch bcs i never EVER start on time with any project with a deadline.

you can use this as inspo for how to use InvUILib, but for the love of god, the code sucks.

gonna write some interesting files

[DgFirstJoin1](src/main/java/me/diademiemi/aprilfools2024/dialogs/DgFirstJoin1.java) contains the code for the initial login prompt. this i wrote when i still thought i had time, so its a bit nicer. There are 8 of these DgFirstJoin files.
[DgFirstJoin6](src/main/java/me/diademiemi/aprilfools2024/dialogs/DgFirstJoin6.java) contins an easy captcha (BOOBIES!!!). It keeps calling itself until the proper digits are entered.

[DgGlobalCaptcha](src/main/java/me/diademiemi/aprilfools2024/dialogs/DgGlobalCaptcha.java) is the file that shows the FUCKED UP captcha. this is 15 digits. wanna know the fun bit? after 8 digits, the keypad shuffles itself. its awful!!!!!!
Wanna shut someone up? `/aprilfools2024 test <player> GlobalCaptcha`. Wanna halve your playerbase? `/aprilfools2024 test * GlobalCaptcha`. Bam. Now everyones pissed. I LOVED it when this randomly happened. God this is the best fucking file I've ever written.
OH PLEASE DONT LOOK AT THE CODE ITS SO UGLY BUT I MADE IT IN LIKE 5 MINUTES BCS I HAD TO RUSH.

boring files incoming!!!

[TrackedPlayer](src/main/java/me/diademiemi/aprilfools2024/player/TrackedPlayer.java) contains the data structure for the players. This is what gets saved to disk and makes it persistent. Getting this right at first made it easy to add new dialogs.

[EventListener](src/main/java/me/diademiemi/aprilfools2024/event/EventListener.java) contains the tracking code that actually sees what players do like tracking stats, block places, movement. Based on this it shows the popups dependent on booleans and sets those booleans.
14 changes: 9 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group = 'me.diademiemi'
version = '1.0-SNAPSHOT'
version = '1.0'

repositories {
mavenCentral()
Expand All @@ -15,19 +15,23 @@ repositories {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
maven {
url = uri("https://repo.opencollab.dev/main/")
}
maven {
name = "invuilib"
url = uri("https://maven.pkg.github.com/diademiemi/invuilib")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
username = "$System.env.GITHUB_ACTOR"
password = "$System.env.GITHUB_TOKEN"
}
}
}

dependencies {
compileOnly "org.spigotmc:spigot-api:1.13-R0.1-SNAPSHOT"
compileOnly "me.diademiemi:invuilib:1.0-SNAPSHOT"
compileOnly "org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT"
compileOnly "me.diademiemi:invuilib:0.1"
compileOnly "org.geysermc.geyser:api:2.2.0-SNAPSHOT"
}

def targetJavaVersion = 8
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/me/diademiemi/aprilfools2024/AprilFools2024.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package me.diademiemi.aprilfools2024;

import me.diademiemi.aprilfools2024.command.CommandHandler;
import me.diademiemi.aprilfools2024.listener.EventListener;
import me.diademiemi.aprilfools2024.listener.RandomScheduler;
import me.diademiemi.aprilfools2024.listener.TrackingListener;
import me.diademiemi.aprilfools2024.player.TrackedPlayer;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
Expand Down Expand Up @@ -30,6 +33,13 @@ public void onEnable() {

// Register the tracking listener (join and quit)
getServer().getPluginManager().registerEvents(new TrackingListener(), this);
getServer().getPluginManager().registerEvents(new EventListener(), this);

// Register CommandHandler
getCommand("aprilfools2024").setExecutor(new CommandHandler());

// Schedule the random global dialogues
RandomScheduler.scheduleRandom();

}

Expand Down
Loading

0 comments on commit 1dc1c19

Please sign in to comment.