Skip to content

Commit

Permalink
Bump version to 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
caoli5288 committed Oct 22, 2015
1 parent cc4946e commit 5703193
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 95 deletions.
1 change: 0 additions & 1 deletion PlayerSQL
Submodule PlayerSQL deleted from 6ff7b9
135 changes: 73 additions & 62 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,64 +1,75 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mengcraft</groupId>
<artifactId>playersql</artifactId>
<version>1.17.2</version>
<name>PlayerSQL</name>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>ci.mengcraft.com</id>
<url>http://ci.mengcraft.com:8080/plugin/repository/everything/</url>
</repository>
<repository>
<id>repo-spigot</id>
<url>http://repo.md-5.net/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.7.10-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<minimizeJar>true</minimizeJar>
<artifactSet>
<includes>
<include>com.google.code.gson:gson</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>com.google.gson</pattern>
<shadedPattern>com.mengcraft.playersql.lib.gson</shadedPattern>
</relocation>
</relocations>
</configuration>
</plugin>
</plugins>
</build>
<modelVersion>4.0.0</modelVersion>

<groupId>com.mengcraft</groupId>
<artifactId>playersql</artifactId>
<version>1.18</version>
<name>PlayerSQL</name>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<repositories>
<repository>
<id>ci.mengcraft.com</id>
<url>http://ci.mengcraft.com:8080/plugin/repository/everything/</url>
</repository>
<repository>
<id>repo-spigot</id>
<url>http://repo.md-5.net/content/groups/public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.7.10-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources/</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<minimizeJar>true</minimizeJar>
<artifactSet>
<includes>
<include>com.google.code.gson:gson</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>com.google.gson</pattern>
<shadedPattern>com.mengcraft.playersql.lib.gson</shadedPattern>
</relocation>
</relocations>
</configuration>
</plugin>
</plugins>
</build>
</project>
48 changes: 17 additions & 31 deletions src/main/java/com/mengcraft/playersql/Events.java
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
package com.mengcraft.playersql;

import java.util.UUID;
import java.util.concurrent.CountDownLatch;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerLoginEvent.Result;
import org.bukkit.event.player.PlayerQuitEvent;

import com.mengcraft.playersql.SyncManager.State;
import com.mengcraft.playersql.api.PlayerPreSwitchServerEvent;

public class Events implements Listener {

private final SyncManager manager;
private final DataCompound compond = DataCompound.DEFAULT;
private final DataCompound compound = DataCompound.DEFAULT;
private final Main main;

public Events(Main main) {
Expand All @@ -35,8 +29,8 @@ public Events(Main main) {
public void handle(PlayerPreSwitchServerEvent event) {
if (!event.isCancelled()) {
Player player = event.getPlayer();
if (compond.state(player.getUniqueId()) == null) {
compond.state(player.getUniqueId(), State.SWIT_WAIT);
if (compound.state(player.getUniqueId()) == null) {
compound.state(player.getUniqueId(), State.SWIT_WAIT);
manager.saveAndSwitch(player, event.getTarget());
}
}
Expand All @@ -45,18 +39,18 @@ public void handle(PlayerPreSwitchServerEvent event) {
@EventHandler
public void handle(PlayerLoginEvent event) {
UUID uuid = event.getPlayer().getUniqueId();
State state = compond.state(uuid);
State state = compound.state(uuid);
if (state != null && state != State.CONN_DONE) {
event.setResult(Result.KICK_OTHER);
event.setKickMessage(DataCompound.MESSAGE_KICK);
} else if (event.getResult() == Result.ALLOWED) {
compond.state(uuid, State.CONN_DONE);
compound.state(uuid, State.CONN_DONE);
}
}

@EventHandler
public void handle(PlayerJoinEvent event) {
compond.state(event.getPlayer().getUniqueId(),
compound.state(event.getPlayer().getUniqueId(),
State.JOIN_WAIT);
if (Configs.MSG_ENABLE) event.getPlayer().sendMessage(
Configs.MSG_LOADING);
Expand All @@ -69,7 +63,7 @@ public void handle(PlayerJoinEvent event) {
public void handle(PlayerQuitEvent event) {
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
if (compond.state(uuid) == null) {
if (compound.state(uuid) == null) {
manager.save(player, true);
}
}
Expand All @@ -78,62 +72,54 @@ public void handle(PlayerQuitEvent event) {
public void handle(EntityDamageEvent event) {
if (!(event.getEntity() instanceof Player)) return;
UUID uuid = event.getEntity().getUniqueId();
if (compond.state(uuid) != null) {
if (compound.state(uuid) != null) {
event.setCancelled(true);
}
}

@EventHandler
public void handle(PlayerPickupItemEvent event) {
UUID uuid = event.getPlayer().getUniqueId();
if (compond.state(uuid) != null) {
if (compound.state(uuid) != null) {
event.setCancelled(true);
}
}

@EventHandler
public void handle(PlayerDropItemEvent event) {
UUID uuid = event.getPlayer().getUniqueId();
if (compond.state(uuid) != null) {
if (compound.state(uuid) != null) {
event.setCancelled(true);
}
}

@EventHandler
public void handle(PlayerInteractEvent event) {
UUID uuid = event.getPlayer().getUniqueId();
if (compond.state(uuid) != null) {
if (compound.state(uuid) != null) {
event.setCancelled(true);
}
}

@EventHandler
public void handle(InventoryOpenEvent event) {
if (compond.state(event.getPlayer().getUniqueId()) != null) {
if (compound.state(event.getPlayer().getUniqueId()) != null) {
event.setCancelled(true);
}
}

@EventHandler
public void handle(PlayerInteractAtEntityEvent event) {
public void handle(PlayerInteractEntityEvent e) {
UUID uuid = e.getPlayer().getUniqueId();
if (compond.state(uuid) != null) {
e.setCancelled(true);
}
}

@EventHandler
public void handle(PlayerInteractEntityEvent event) {
UUID uuid = e.getPlayer().getUniqueId();
if (compond.state(uuid) != null) {
if (compound.state(uuid) != null) {
e.setCancelled(true);
}
}

@EventHandler
public void handle(PlayerCommandPreprocessEvent event) {
public void handle(PlayerCommandPreprocessEvent e) {
UUID uuid = e.getPlayer().getUniqueId();
if (compond.state(uuid) != null) {
if (compound.state(uuid) != null) {
e.setCancelled(true);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
main: com.mengcraft.playersql.Main
name: PlayerSQL
version: 1.17.2
version: ${project.version}
website: http://www.spigotmc.org/resources/playersql.552/

commands:
Expand Down

0 comments on commit 5703193

Please sign in to comment.