-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.4.0 - Merge pull request #37 from diademiemi/diademiemi/issue36
- Loading branch information
Showing
16 changed files
with
172 additions
and
91 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ plugins { | |
} | ||
|
||
group 'me.diademiemi.lineation' | ||
version '1.3.2' | ||
version '1.4.0' | ||
|
||
repositories { | ||
/* | ||
|
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
5 changes: 4 additions & 1 deletion
5
.../java/me/diademiemi/lineation/Config.java → ...e/diademiemi/lineation/config/Config.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
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
68 changes: 0 additions & 68 deletions
68
src/main/java/me/diademiemi/lineation/line/LineListener.java
This file was deleted.
Oops, something went wrong.
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
42 changes: 42 additions & 0 deletions
42
src/main/java/me/diademiemi/lineation/listeners/Checker.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,42 @@ | ||
package me.diademiemi.lineation.listeners; | ||
|
||
import org.bukkit.entity.Player; | ||
|
||
import me.diademiemi.lineation.line.Line; | ||
import me.diademiemi.lineation.line.LineTools; | ||
|
||
import java.util.Map; | ||
|
||
public class Checker { | ||
/** | ||
* Check if the player is in a line | ||
* | ||
* @param p Player to check | ||
*/ | ||
public static void checkPlayer(Player p) { | ||
for(Map.Entry<String, Line> entry: Line.getStartedFinishLines().entrySet()) { | ||
if (entry.getValue().getGameModes().contains(p.getGameMode())) { | ||
if (entry.getValue().contains(p)) { | ||
LineTools.playerFinish(entry.getValue(), p); | ||
} else { | ||
int i = entry.getValue().checkpointsContain(p); | ||
if (i != 0) { | ||
if (i - 1 <= entry.getValue().getPlayerCheckpoint(p)) { | ||
entry.getValue().addPlayerCheckpoint(p, i); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
for(Map.Entry<String, Line> entry: Line.getStartedStartLinesIA().entrySet()) { | ||
if (entry.getValue().getGameModes().contains(p.getGameMode())) { | ||
if (entry.getValue().illegalAreaContains(p)) { | ||
p.teleport(entry.getValue().getTeleportLocation()); | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/me/diademiemi/lineation/listeners/MoveEvents.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,46 @@ | ||
package me.diademiemi.lineation.listeners; | ||
|
||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.HandlerList; | ||
import org.bukkit.event.player.PlayerMoveEvent; | ||
|
||
import me.diademiemi.lineation.Lineation; | ||
|
||
/** | ||
* Listens to move events | ||
* | ||
* @author diademiemi | ||
*/ | ||
public class MoveEvents implements Listener { | ||
|
||
/** | ||
* Register plugin listener | ||
* | ||
* @param plugin Instance of this plugin | ||
*/ | ||
public MoveEvents(Lineation plugin) { | ||
plugin.getServer().getPluginManager().registerEvents(this, plugin); | ||
} | ||
|
||
/** | ||
* Unregister plugin listeners | ||
* | ||
* @param plugin Instance of this plugin | ||
*/ | ||
public static void unregisterPluginEvents(Lineation plugin) { | ||
HandlerList.unregisterAll(plugin); | ||
} | ||
|
||
/** | ||
* Player move listener | ||
* | ||
* @param e Player move event | ||
*/ | ||
@EventHandler | ||
public void onMove(PlayerMoveEvent e) { | ||
if (e.getFrom().getBlockX() != e.getTo().getBlockX() || e.getFrom().getBlockY() != e.getTo().getBlockY() || e.getFrom().getBlockZ() != e.getTo().getBlockZ()) { | ||
Checker.checkPlayer(e.getPlayer()); | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/me/diademiemi/lineation/listeners/Scheduled.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,32 @@ | ||
package me.diademiemi.lineation.listeners; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.entity.Player; | ||
|
||
import me.diademiemi.lineation.Lineation; | ||
|
||
/** | ||
* Checks player locations per tick | ||
* | ||
* @author diademiemi | ||
*/ | ||
public class Scheduled { | ||
|
||
public static void cancelTasks(Lineation plugin) { | ||
Bukkit.getServer().getScheduler().cancelTasks(plugin); | ||
} | ||
|
||
/** | ||
* Schedules movement check every tick | ||
*/ | ||
public static void checkMovements() { | ||
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Lineation.getInstance(), new Runnable(){ | ||
public void run() { | ||
for (Player p : Bukkit.getOnlinePlayers()) { | ||
Checker.checkPlayer(p); | ||
} | ||
} | ||
},0, 1); | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# File used to store player wins count | ||
# Format: UUID: number | ||
|
||
#NEVER CHANGE THIS, THIS IS USED FOR MIGRATING | ||
version: 1 |
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