-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3.1.0]小修改+一滴血事件,对应BluestarGameAPI[3.1]
- Loading branch information
Showing
11 changed files
with
277 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/me/lanzhi/bluestargame/listener/randoms/oneHealthListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package me.lanzhi.bluestargame.listener.randoms; | ||
|
||
import me.lanzhi.bluestarapi.Api.config.YamlFile; | ||
import me.lanzhi.bluestargame.BluestarGamePlugin; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.player.PlayerJoinEvent; | ||
import org.bukkit.event.player.PlayerQuitEvent; | ||
|
||
import java.io.File; | ||
|
||
public final class oneHealthListener implements Listener | ||
{ | ||
private final BluestarGamePlugin plugin; | ||
|
||
public oneHealthListener(BluestarGamePlugin plugin) | ||
{ | ||
this.plugin=plugin; | ||
} | ||
|
||
@EventHandler | ||
public void onPlayerJoin(PlayerJoinEvent event) | ||
{ | ||
if (!plugin.getBluestarGameManager().getRandomEventManger().oneHealth()) | ||
{ | ||
return; | ||
} | ||
double maxHealth=YamlFile.loadYamlFile(new File(plugin.getPlayerData(),event.getPlayer().getUniqueId()+".yml")).getDouble("maxhealth"); | ||
plugin.getBluestarGameManager().getRandomEventManger().oneHealth_playerHealth.put(event.getPlayer(),maxHealth!=0?maxHealth:20); | ||
} | ||
|
||
@EventHandler | ||
public void onPlayerQuit(PlayerQuitEvent event) | ||
{ | ||
if (!plugin.getBluestarGameManager().getRandomEventManger().oneHealth()) | ||
{ | ||
return; | ||
} | ||
plugin.getBluestarGameManager().getRandomEventManger().oneHealth_playerHealth.remove(event.getPlayer()); | ||
} | ||
} |
Oops, something went wrong.