Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/Development' into Development
Browse files Browse the repository at this point in the history
Signed-off-by: Narimm <benjicharlton@gmail.com>
  • Loading branch information
Narimm committed Jun 16, 2018
2 parents 431e1e3 + b7bbf1b commit 8bf7867
Show file tree
Hide file tree
Showing 17 changed files with 244 additions and 126 deletions.
25 changes: 21 additions & 4 deletions Minigames/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@
<version>1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.3.3</version>
</dependency>
</dependencies>

<build>
Expand All @@ -96,10 +101,11 @@
<filtering>true</filtering>
<directory>src/main/resources</directory>
<includes>
<include>plugin.yml</include>
<include>config.yml</include>
<include>lang/*.yml</include>
<include>presets/*.yml</include>
<include>plugin.yml</include>
<include>config.yml</include>
<include>*.properties</include>
<include>lang/*.yml</include>
<include>presets/*.yml</include>
</includes>
</resource>
</resources>
Expand Down Expand Up @@ -144,7 +150,18 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
15 changes: 7 additions & 8 deletions Minigames/src/main/java/au/com/mineauz/minigames/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,7 @@ public void onPlayerConnect(PlayerJoinEvent event){
ply.setQuitPos(floc);

if(!ply.getPlayer().isDead() && ply.isRequiredQuit()){
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {

@Override
public void run() {
ply.restorePlayerData();
}
});
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, ply::restorePlayerData);
ply.teleport(ply.getQuitPos());

ply.setRequiredQuit(false);
Expand All @@ -214,6 +208,11 @@ public void run() {
ply.loadClaimedRewards();

if(Bukkit.getServer().getOnlinePlayers().size() == 1){
for (Minigame mgm : mdata.getAllMinigames().values()) {
if (mgm != null && mgm.getType() == MinigameType.GLOBAL) {
if (mgm.getMinigameTimer() != null) mgm.getMinigameTimer().startTimer();
}
}
for(String mgm : mdata.getAllMinigames().keySet()){
if(mdata.getMinigame(mgm).getType() == MinigameType.GLOBAL){
// if(minigameManager.getMinigame(mgm).getThTimer() != null){
Expand Down Expand Up @@ -436,7 +435,7 @@ private void commandExecute(PlayerCommandPreprocessEvent event){

@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
private void entityDamageEntity(EntityDamageByEntityEvent event){
if (event.getEntity() instanceof Player && !event.isCancelled()) {
if (event.getEntity() instanceof Player) {
if (event.getDamager() instanceof Snowball) {
MinigamePlayer ply = pdata.getMinigamePlayer((Player) event.getEntity());
if (ply == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public void spectateMinigame(MinigamePlayer player, Minigame minigame) {
Bukkit.getServer().getPluginManager().callEvent(event);

if(!event.isCancelled()){
boolean tpd = false;
boolean tpd;
if(minigame.getSpectatorLocation() != null)
tpd = player.teleport(minigame.getSpectatorLocation());
else{
Expand Down Expand Up @@ -785,6 +785,8 @@ public void removeMinigamePlayer(Player player){

@NotNull
public MinigamePlayer getMinigamePlayer(Player player){
if (minigamePlayers.containsKey(player.getName())) return minigamePlayers.get(player.getName());
else addMinigamePlayer(player);
return minigamePlayers.get(player.getName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import java.util.logging.Level;

public class MinigameSave {
FileConfiguration minigameSave = null;
File minigameSaveFile = null;
private FileConfiguration minigameSave = null;
private File minigameSaveFile = null;
String minigame = null;
private static Minigames plugin = Minigames.getPlugin();
private String name = null;
private String name;

public MinigameSave(String name){
this.name = name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
import org.bukkit.inventory.ItemStack;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;

//import net.minecraft.server.v1_6_R2.EntityPlayer;
//
Expand Down Expand Up @@ -431,8 +433,14 @@ public static Map<String, Object> serializeLocation(Location loc){
sloc.put("z", loc.getZ());
sloc.put("yaw", loc.getYaw());
sloc.put("pitch", loc.getPitch());
sloc.put("world", loc.getWorld().getName());

String name;
if (loc.getWorld() != null) {
name = loc.getWorld().getName();
} else {
debugMessage("A Location could not be deserialized the world was null");
return Collections.emptyMap();
}
sloc.put("world", name);
return sloc;
}

Expand Down Expand Up @@ -532,6 +540,17 @@ public static String limitIgnoreCodes(String string, int maxLength) {
return string;
}
}

public static String sanitizeYamlString(String input){
final Pattern pattern = Pattern.compile("^[a-zA-Z\\d_]+$");
if (!pattern.matcher(input).matches()) {
return null;
}
else{
return input;
}
}


// public static void removePlayerArrows(MinigamePlayer player){
// try{
Expand Down
Loading

0 comments on commit 8bf7867

Please sign in to comment.