Archived
Private
Public Access
1
0

Initial commit

This commit is contained in:
2022-09-04 12:45:01 +02:00
commit f4a01d6a69
11601 changed files with 4206660 additions and 0 deletions

3
Plugins/Old/Corona/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@@ -0,0 +1,8 @@
<component name="ArtifactManager">
<artifact type="jar" name="Corona">
<output-path>$PROJECT_DIR$/../../../Plugins</output-path>
<root id="archive" name="Corona.jar">
<element id="module-output" name="Corona" />
</root>
</artifact>
</component>

View File

@@ -0,0 +1,11 @@
<component name="libraryTable">
<library name="spigot 1.8.8">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../Spigot Versions/spigot 1.8.8.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/../Spigot Versions/spigot 1.8.8.jar!/" />
</SOURCES>
</library>
</component>

6
Plugins/Old/Corona/.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
Plugins/Old/Corona/.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Corona.iml" filepath="$PROJECT_DIR$/Corona.iml" />
</modules>
</component>
</project>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="spigot 1.8.8" level="project" />
</component>
</module>

View File

@@ -0,0 +1,4 @@
name: Corona
version: 1.8
main: de.craftix.corona.Main
author: deiner-Mudda

View File

@@ -0,0 +1,17 @@
package de.craftix.corona;
import net.minecraft.server.v1_8_R3.IChatBaseComponent;
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
public class ActionbarAPI {
public static void show(Player p, String content){
IChatBaseComponent base = IChatBaseComponent.ChatSerializer.a("{\"text\": \"\"}").a(content);
PacketPlayOutChat chat = new PacketPlayOutChat(base, (byte) 2);
CraftPlayer cp = (CraftPlayer)p;
cp.getHandle().playerConnection.sendPacket(chat);
}
}

View File

@@ -0,0 +1,82 @@
package de.craftix.corona;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import java.util.ArrayList;
import java.util.Random;
public class CoronaAPI {
public static ArrayList<Player> coronaPlayer = new ArrayList<>();
private static ArrayList<PotionEffectType> effects = new ArrayList<>();
private static int timerID;
private static int infectionTimerID;
public static void setup(){
effects.add(PotionEffectType.BLINDNESS);
effects.add(PotionEffectType.SLOW);
effects.add(PotionEffectType.WEAKNESS);
effects.add(PotionEffectType.CONFUSION);
startInfectionTimer();
}
public static void giveCorona(Player p){
CoronaAPI.coronaPlayer.add(p);
new CoronaPlayer(p);
ActionbarAPI.show(p, "§cDu hast nun Corona!");
}
public static void sendEffects(Player p){
Random rand = new Random();
int value = rand.nextInt(4);
PotionEffect effect = new PotionEffect(effects.get(value), 250, 255);
p.addPotionEffect(effect);
}
public static void startTimer(){
timerID = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getInstance(), new Runnable() {
@Override
public void run() {
for (Player p : coronaPlayer){
for (PotionEffect pe : p.getActivePotionEffects()){
for (PotionEffectType corona : effects){
if (pe.getType().equals(corona)) return;
}
}
Random rand = new Random();
if (rand.nextInt(5) < 2) continue;
ActionbarAPI.show(p, "§cZufällige Corona attacke!");
sendEffects(p);
}
}
}, 0, 500);
}
public static void stopTimer(){
Bukkit.getScheduler().cancelTask(timerID);
}
private static void startInfectionTimer(){
infectionTimerID = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getInstance(), new Runnable() {
@Override
public void run() {
for (Player all : Bukkit.getOnlinePlayers()){
for (Player corona : coronaPlayer){
if (corona == all) continue;
if (all.getLocation().distance(corona.getLocation()) <= 2){
CoronaAPI.coronaPlayer.add(all);
new CoronaPlayer(all);
ActionbarAPI.show(all, "§cDu wurdest mit Corona infiziert!");
}
}
}
}
}, 0, 50);
}
public static void stopInfectionTimer(){
Bukkit.getScheduler().cancelTask(infectionTimerID);
}
}

View File

@@ -0,0 +1,24 @@
package de.craftix.corona;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class CoronaPlayer {
public Player p;
private int timerID;
public CoronaPlayer(Player p){
this.p = p;
startTimer();
}
private void startTimer(){
timerID = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getInstance(), new Runnable() {
@Override
public void run() {
CoronaAPI.coronaPlayer.remove(p);
ActionbarAPI.show(p, "§aDu hast Corona überstanden!");
Bukkit.getScheduler().cancelTask(timerID);
}
}, 12000, 1);
}
}

View File

@@ -0,0 +1,24 @@
package de.craftix.corona.Listener;
import de.craftix.corona.CoronaAPI;
import de.craftix.corona.Main;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import java.util.Random;
public class onEat implements Listener {
@EventHandler
public void onEatEvent(PlayerItemConsumeEvent event){
if (!Main.coronaFood.contains(event.getItem().getType())) return;
Random rand = new Random();
if (rand.nextBoolean() && !CoronaAPI.coronaPlayer.contains(event.getPlayer())){
Player p = event.getPlayer();
CoronaAPI.giveCorona(p);
}
}
}

View File

@@ -0,0 +1,46 @@
package de.craftix.corona;
import de.craftix.corona.Listener.onEat;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
public class Main extends JavaPlugin {
private static Main instance;
public static ArrayList<Material> coronaFood = new ArrayList<>();
@Override
public void onEnable() {
instance = this;
coronaFood.add(Material.RAW_BEEF);
coronaFood.add(Material.RAW_CHICKEN);
coronaFood.add(Material.RAW_FISH);
coronaFood.add(Material.PORK);
coronaFood.add(Material.POTATO);
coronaFood.add(Material.POISONOUS_POTATO);
coronaFood.add(Material.RABBIT);
coronaFood.add(Material.MUTTON);
registerListener();
CoronaAPI.setup();
CoronaAPI.startTimer();
}
@Override
public void onDisable() {
CoronaAPI.stopTimer();
CoronaAPI.stopInfectionTimer();
}
private void registerListener(){
PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(new onEat(), this);
}
public static Main getInstance() {
return instance;
}
}

View File

@@ -0,0 +1,4 @@
name: Corona
version: 1.8
main: de.craftix.corona.Main
author: deiner-Mudda