From bcd3cc976b1697077872cbbab9f2ab4d8c0c4077 Mon Sep 17 00:00:00 2001 From: Jan9103 Date: Thu, 13 Aug 2020 23:23:22 +0200 Subject: [PATCH 1/3] Sleep Preventer --- .../de/steamwar/fightsystem/FightSystem.java | 1 + .../fightsystem/listener/SleepListener.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 FightSystem_Main/src/de/steamwar/fightsystem/listener/SleepListener.java diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java index 98706f7..1c1c865 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java @@ -74,6 +74,7 @@ public class FightSystem extends JavaPlugin { new TestListener(); new NormalJoinListener(); new RankedJoinListener(); + new SleepListener(); if(Core.getVersion() > 8) new ExtendedInventoryListener(); diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/listener/SleepListener.java b/FightSystem_Main/src/de/steamwar/fightsystem/listener/SleepListener.java new file mode 100644 index 0000000..8179de4 --- /dev/null +++ b/FightSystem_Main/src/de/steamwar/fightsystem/listener/SleepListener.java @@ -0,0 +1,18 @@ +package de.steamwar.fightsystem.listener; + +import java.util.EnumSet; + +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerBedEnterEvent; + +import de.steamwar.fightsystem.states.FightState; + +public class SleepListener extends BasicListener{ + public SleepListener() {super(EnumSet.allOf(FightState.class));} + @EventHandler + public void onSleep(PlayerBedEnterEvent e) { + Block b=e.getBed(); + b.getWorld().createExplosion(b.getLocation(),4.0F); //4==tnt => dosnt have any advantage in WS (noFire,sameStrength,moreInvSpace,selfDamage) + } +} \ No newline at end of file -- 2.39.5 From 67fcff77118f15dfc85c16e1d526a551955cbabd Mon Sep 17 00:00:00 2001 From: Jan9103 Date: Sun, 16 Aug 2020 11:23:18 +0200 Subject: [PATCH 2/3] code nutzlos gemacht --- .../src/de/steamwar/fightsystem/listener/SleepListener.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/listener/SleepListener.java b/FightSystem_Main/src/de/steamwar/fightsystem/listener/SleepListener.java index 8179de4..8b7ff93 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/listener/SleepListener.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/listener/SleepListener.java @@ -12,7 +12,8 @@ public class SleepListener extends BasicListener{ public SleepListener() {super(EnumSet.allOf(FightState.class));} @EventHandler public void onSleep(PlayerBedEnterEvent e) { - Block b=e.getBed(); - b.getWorld().createExplosion(b.getLocation(),4.0F); //4==tnt => dosnt have any advantage in WS (noFire,sameStrength,moreInvSpace,selfDamage) + e.setCancelled(true); + //Block b=e.getBed(); + //b.getWorld().createExplosion(b.getLocation(),4.0F); //4==tnt => dosnt have any advantage in WS (noFire,sameStrength,moreInvSpace,selfDamage) } } \ No newline at end of file -- 2.39.5 From ddc5874fe92d99685ef2f203ee968ac2090e4a5a Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 18 Aug 2020 17:48:07 +0200 Subject: [PATCH 3/3] It works Signed-off-by: Lixfel --- .../fightsystem/listener/SleepListener.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/listener/SleepListener.java b/FightSystem_Main/src/de/steamwar/fightsystem/listener/SleepListener.java index 8b7ff93..00f53c0 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/listener/SleepListener.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/listener/SleepListener.java @@ -1,19 +1,19 @@ -package de.steamwar.fightsystem.listener; - -import java.util.EnumSet; - -import org.bukkit.block.Block; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerBedEnterEvent; - -import de.steamwar.fightsystem.states.FightState; - -public class SleepListener extends BasicListener{ - public SleepListener() {super(EnumSet.allOf(FightState.class));} - @EventHandler - public void onSleep(PlayerBedEnterEvent e) { - e.setCancelled(true); - //Block b=e.getBed(); - //b.getWorld().createExplosion(b.getLocation(),4.0F); //4==tnt => dosnt have any advantage in WS (noFire,sameStrength,moreInvSpace,selfDamage) - } +package de.steamwar.fightsystem.listener; + +import de.steamwar.fightsystem.states.FightState; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerBedEnterEvent; + +import java.util.EnumSet; + +public class SleepListener extends BasicListener{ + + public SleepListener() { + super(EnumSet.allOf(FightState.class)); + } + + @EventHandler + public void onSleep(PlayerBedEnterEvent e) { + e.setCancelled(true); + } } \ No newline at end of file -- 2.39.5