diff --git a/CHANGELOG.md b/CHANGELOG.md index 76f9462..14545aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## [1.1.0] - 2020-08-08 ### Added - More Events - **Diamond**: Gives you a diamond. @@ -16,12 +16,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **Fire Trail** - **Explosive Beds**: Boom! - **Slippery Buckets**: Dumps bucket contents at your feet. + - **Full Heal**: Sets your HP to max. + - **Full Hunger**: Sets your hunger and saturation to max. + - **Zero Hunger**: Removes all your hunger and saturation. + - **Food Poisoning**: All food items will give you food poisoning. - Effect Events - Speed - Jump Boost - Blindness - Mining Fatigue - Haste +- Event list in the `EVENTS.md` file in the GitHub repository. ### Fixed - Fixed an issue involving effects not being removed. (#1) diff --git a/EVENTS.md b/EVENTS.md new file mode 100644 index 0000000..db96616 --- /dev/null +++ b/EVENTS.md @@ -0,0 +1,191 @@ +# Events +> Haha yes. + +Events are categorized into three. Good, passive, and bad. + +## Table of Contents +- [Good](#good) +- [Passive](#passive) +- [Bad](#bad) + +## Good + +### Beef +- **Description**: Gives you 16 steak. +- **History** + - **v1.0.0**: Added. + +### Diamond +- **Description**: Gives you a diamond. +- **History** + - **v1.1.0**: Added. + +### Diamond Pickaxe +- **Description**: Gives you a diamond pickaxe. +- **History** + - **v1.0.0**: Added. + +### Full Heal +- **Description**: Heals you. +- **History** + - **v1.1.0**: Added. + +### Full Hunger +- **Description**: Fills your saturation and hunger. +- **History** + - **v1.1.0**: Added. + +### Haste +- **Description**: Applies max haste for the duration of the event. +- **History** + - **v1.0.0**: Added, but disabled because it doesn't work. + - **v1.1.0**: Fixed, and enabled. + +### Nice XP +- **Description**: **Sets** your XP to 69. +- **History** + - **v1.1.0**: Added. + +## Passive + +### Aw man? +- **Description**: Plays a creeper hissing sound. +- **History** + - **v1.0.0**: Added. + +### ~~Chat Kick~~ +- **Description**: Kicks you for spamming when you send any message. +- **History** + - **v1.1.0**: Added, and currently disabled because it doesn't work. + +### Gardener +- **Description**: Gives you 16 of *a lot* of different flowers and decoration plants. +- **History** + - **v1.0.0**: Added. + +### H +- **Description**: Gives you a H banner. +- **History** + - **v1.0.0**: Added. + +### Tree +- **Description**: Summons a tree where you are standing. +- **History** + - **v1.1.0**: Added. + +## Bad + +### Anvil +- **Description**: Places an anvil above you. +- **History** + - **v1.0.0**: Added. + +### Aw man. +- **Description**: Spawns a creeper above you. +- **History** + - **v1.0.0**: Added. + +### Bedrock Feet +- **Description**: Places bedrock under where you are standing. +- **History** + - **v1.0.0**: Added. + +### Blindness +- **Description**: Applies blindness for the duration of the event. +- **History** + - **v1.0.0**: Added, but disabled because it doesn't work. + - **v1.1.0**: Fixed, and enabled. + +### Butterfingers +- **Description**: Drops the currently held item. +- **History** + - **v1.0.0**: Added. + +### ClearLag +- **Description**: Kills all items on the ground. +- **History** + - **v1.1.0**: Added. + +### Explosive Beds +- **Description**: Any beds clicked will explode. +- **History** + - **v1.1.0**: Added. + +### Fire Trail +- **Description**: Fire will be set under your feet for the duration of the event. Even if you extinguish it. +- **History** + - **v1.1.0**: Added. + +### Food Poisoning +- **Description**: All food eaten will apply the hunger effect for 30 seconds. +- **History** + - **v1.1.0**: Added. + +### Half a Heart +- **Description**: Sets your HP to half a heart. +- **History** + - **v1.0.0**: Added. + +### Hard +- **Description**: Sets the world difficulty to Hard for the duration of the event. +- **History** + - **v1.1.0**: Added. + +### Hot +- **Description**: Sets fire under your feet one time only. +- **History** + - **v1.0.0**: Added. + +### I am speed. +- **Description**: Applies max speed for the duration of the event. +- **History** +- **v1.0.0**: Added, but disabled because it doesn't work. + - **v1.1.0**: Fixed, and enabled. + +### Jump +- **Description**: Applies max jump boost for the duration of the event. +- **History** + - **v1.0.0**: Added, but disabled because it doesn't work. + - **v1.1.0**: Fixed, and enabled. + +### Mining Fatigue +- **Description**: Applies max mining fatigue for the duration of the event. +- **History** + - **v1.0.0**: Added, but disabled because it doesn't work. + - **v1.1.0**: Fixed, and enabled. + +### Skydive +- **Description**: Teleports you 100 blocks up. +- **History** + - **v1.0.0**: Added. + +### Sky Lava +- **Description**: Sets one lava source block at Y=255 where you are standing. +- **History** + - **v1.0.0**: Added. + +### Slippery Buckets +- **Description**: Any buckets emptied will have their contents emptied at your feet. +- **History** + - **v1.1.0**: Added. + +### Trip +- **Description**: Drops your entire inventory on the ground. +- **History** + - **v1.0.0**: Added. + - **v1.0.1**: Fixed duplication glitch involving the armor and off hand item. + +### Zero Hunger +- **Description**: Sets your hunger and saturation to zero. +- **History** + - **v1.1.0**: Added. + +### Zero XP +- **Description**: Sets your XP to zero. +- **History** + - **v1.1.0**: Added. + +### Zeus +- **Description**: Strikes you with lightning. +- **History** + - **v1.0.0**: Added. \ No newline at end of file diff --git a/README.md b/README.md index 2c0cd28..b194468 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # Chaos > Fun with random Minecraft events. +## About +Chaos is Minecraft plugin that runs random events (good or bad) periodically through out. The default is set to a +random time between 30 and 40 seconds. Read more about the events in the EVENTS.md file in the GitHub repository. + ## Usage - `/chaos [add|remove] [username]` will add or remove players from the list of players that will be affected by the outcome of the chaos events. Note: this does reset whenever the plugin is reloaded. @@ -18,6 +22,9 @@ by the outcome of the chaos events. Note: this does reset whenever the plugin is A config will be generated in a `plugins/Chaos` folder. Two values will be provided, a minimum and a maximum value for how long events should last. +## Demo Video +[https://www.youtube.com/watch?v=mSM8qk2JbMU](https://www.youtube.com/watch?v=mSM8qk2JbMU) + ## Disclaimer This plugin has the possibility to cause permanent damage in your world, or make you *very very* sad. Please do not use this plugin on a world you *really* care about. diff --git a/src/main/java/com/netlify/hparcells/chaos/ChaosThread.java b/src/main/java/com/netlify/hparcells/chaos/ChaosThread.java index 2539d67..06523b1 100644 --- a/src/main/java/com/netlify/hparcells/chaos/ChaosThread.java +++ b/src/main/java/com/netlify/hparcells/chaos/ChaosThread.java @@ -3,6 +3,7 @@ import com.netlify.hparcells.chaos.events.*; import com.netlify.hparcells.chaos.events.explosivebeds.ExplosiveBedsEvent; import com.netlify.hparcells.chaos.events.firetrail.FireTrailEvent; +import com.netlify.hparcells.chaos.events.foodpoisoning.FoodPoisoningEvent; import com.netlify.hparcells.chaos.events.slipperybuckets.SlipperyBucketsEvent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -50,7 +51,12 @@ public class ChaosThread implements Runnable { new DiamondEvent(), new FireTrailEvent(), new ExplosiveBedsEvent(), - new SlipperyBucketsEvent() + new SlipperyBucketsEvent(), + // new ChatKickEvent(), + new FullHealEvent(), + new FullHungerEvent(), + new ZeroHungerEvent(), + new FoodPoisoningEvent() }; private ChaosEvent currentChaosEvent; diff --git a/src/main/java/com/netlify/hparcells/chaos/events/FullHealEvent.java b/src/main/java/com/netlify/hparcells/chaos/events/FullHealEvent.java new file mode 100644 index 0000000..b607054 --- /dev/null +++ b/src/main/java/com/netlify/hparcells/chaos/events/FullHealEvent.java @@ -0,0 +1,20 @@ +package com.netlify.hparcells.chaos.events; + +import com.netlify.hparcells.chaos.Chaos; +import com.netlify.hparcells.chaos.ChaosEvent; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +public class FullHealEvent extends ChaosEvent { + public void onEnable(String username, Chaos plugin) { + Player target = (Bukkit.getServer().getPlayer(username)); + + if(target != null) { + target.setHealth(20); + } + } + + public String getName() { + return "Full Heal"; + } +} diff --git a/src/main/java/com/netlify/hparcells/chaos/events/FullHungerEvent.java b/src/main/java/com/netlify/hparcells/chaos/events/FullHungerEvent.java new file mode 100644 index 0000000..759e338 --- /dev/null +++ b/src/main/java/com/netlify/hparcells/chaos/events/FullHungerEvent.java @@ -0,0 +1,21 @@ +package com.netlify.hparcells.chaos.events; + +import com.netlify.hparcells.chaos.Chaos; +import com.netlify.hparcells.chaos.ChaosEvent; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +public class FullHungerEvent extends ChaosEvent { + public void onEnable(String username, Chaos plugin) { + Player target = (Bukkit.getServer().getPlayer(username)); + + if(target != null) { + target.setFoodLevel(20); + target.setSaturation(20f); + } + } + + public String getName() { + return "Full Hunger"; + } +} diff --git a/src/main/java/com/netlify/hparcells/chaos/events/ZeroHungerEvent.java b/src/main/java/com/netlify/hparcells/chaos/events/ZeroHungerEvent.java new file mode 100644 index 0000000..dd73bc5 --- /dev/null +++ b/src/main/java/com/netlify/hparcells/chaos/events/ZeroHungerEvent.java @@ -0,0 +1,21 @@ +package com.netlify.hparcells.chaos.events; + +import com.netlify.hparcells.chaos.Chaos; +import com.netlify.hparcells.chaos.ChaosEvent; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +public class ZeroHungerEvent extends ChaosEvent { + public void onEnable(String username, Chaos plugin) { + Player target = (Bukkit.getServer().getPlayer(username)); + + if(target != null) { + target.setFoodLevel(0); + target.setSaturation(0f); + } + } + + public String getName() { + return "Zero Hunger"; + } +} diff --git a/src/main/java/com/netlify/hparcells/chaos/events/chatkick/ChatKickEvent.java b/src/main/java/com/netlify/hparcells/chaos/events/chatkick/ChatKickEvent.java new file mode 100644 index 0000000..93d4ac9 --- /dev/null +++ b/src/main/java/com/netlify/hparcells/chaos/events/chatkick/ChatKickEvent.java @@ -0,0 +1,21 @@ +package com.netlify.hparcells.chaos.events.chatkick; + +import com.netlify.hparcells.chaos.Chaos; +import com.netlify.hparcells.chaos.ChaosEvent; +import org.bukkit.event.HandlerList; + +public class ChatKickEvent extends ChaosEvent { + private ChatKickListener chatKickListener = new ChatKickListener(); + + public void onEnable(String username, Chaos plugin) { + plugin.getServer().getPluginManager().registerEvents(chatKickListener, plugin); + } + + public void onDisable(String username, Chaos plugin) { + HandlerList.unregisterAll(chatKickListener); + } + + public String getName() { + return "Chat Kick"; + } +} diff --git a/src/main/java/com/netlify/hparcells/chaos/events/chatkick/ChatKickListener.java b/src/main/java/com/netlify/hparcells/chaos/events/chatkick/ChatKickListener.java new file mode 100644 index 0000000..85b58cb --- /dev/null +++ b/src/main/java/com/netlify/hparcells/chaos/events/chatkick/ChatKickListener.java @@ -0,0 +1,12 @@ +package com.netlify.hparcells.chaos.events.chatkick; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.AsyncPlayerChatEvent; + +public class ChatKickListener implements Listener { + @EventHandler + public void onAsyncPlayerChat(AsyncPlayerChatEvent event) { + event.getPlayer().kickPlayer("Kicked for spamming."); + } +} diff --git a/src/main/java/com/netlify/hparcells/chaos/events/explosivebeds/ExplosiveBedsListener.java b/src/main/java/com/netlify/hparcells/chaos/events/explosivebeds/ExplosiveBedsListener.java index ddefb13..7a200ee 100644 --- a/src/main/java/com/netlify/hparcells/chaos/events/explosivebeds/ExplosiveBedsListener.java +++ b/src/main/java/com/netlify/hparcells/chaos/events/explosivebeds/ExplosiveBedsListener.java @@ -3,13 +3,10 @@ import org.bukkit.Location; import org.bukkit.World; import org.bukkit.block.Block; -import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerBedEnterEvent; -import javax.swing.text.html.parser.Entity; - public class ExplosiveBedsListener implements Listener { @EventHandler public void onPlayerBedEnter(PlayerBedEnterEvent event) { diff --git a/src/main/java/com/netlify/hparcells/chaos/events/foodpoisoning/FoodPoisoningEvent.java b/src/main/java/com/netlify/hparcells/chaos/events/foodpoisoning/FoodPoisoningEvent.java new file mode 100644 index 0000000..da8b37e --- /dev/null +++ b/src/main/java/com/netlify/hparcells/chaos/events/foodpoisoning/FoodPoisoningEvent.java @@ -0,0 +1,21 @@ +package com.netlify.hparcells.chaos.events.foodpoisoning; + +import com.netlify.hparcells.chaos.Chaos; +import com.netlify.hparcells.chaos.ChaosEvent; +import org.bukkit.event.HandlerList; + +public class FoodPoisoningEvent extends ChaosEvent { + private FoodPoisoningListener foodPoisoningListener = new FoodPoisoningListener(); + + public void onEnable(String username, Chaos plugin) { + plugin.getServer().getPluginManager().registerEvents(foodPoisoningListener, plugin); + } + + public void onDisable(String username, Chaos plugin) { + HandlerList.unregisterAll(foodPoisoningListener); + } + + public String getName() { + return "Food Poisoning"; + } +} diff --git a/src/main/java/com/netlify/hparcells/chaos/events/foodpoisoning/FoodPoisoningListener.java b/src/main/java/com/netlify/hparcells/chaos/events/foodpoisoning/FoodPoisoningListener.java new file mode 100644 index 0000000..ab5f1ee --- /dev/null +++ b/src/main/java/com/netlify/hparcells/chaos/events/foodpoisoning/FoodPoisoningListener.java @@ -0,0 +1,19 @@ +package com.netlify.hparcells.chaos.events.foodpoisoning; + +import org.bukkit.Material; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class FoodPoisoningListener implements Listener { + @EventHandler + public void onPlayerItemConsumeEvent(PlayerItemConsumeEvent event) { + Material consumed = event.getItem().getType(); + + if(consumed.isEdible()) { + event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 20 * 30, 0)); + } + } +}