Skip to content
This repository has been archived by the owner on Jul 27, 2019. It is now read-only.

Commit

Permalink
Merge from PurpleIRC-spigot source
Browse files Browse the repository at this point in the history
  • Loading branch information
cnaude committed Sep 16, 2017
1 parent 93112e4 commit 60fd520
Show file tree
Hide file tree
Showing 4 changed files with 249 additions and 40 deletions.
84 changes: 44 additions & 40 deletions pom.xml
Expand Up @@ -6,7 +6,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Bukkit API Version, change if out dated -->
<bukkit.version>1.11.1</bukkit.version>
<bukkit.version>1.12.1</bukkit.version>
<build.number>SNAPSHOT</build.number>
</properties>

Expand Down Expand Up @@ -36,24 +36,6 @@
<enabled>false</enabled>
</snapshots>
</repository>

<!-- FactionChat
<repository>
<id>FactionChat-repo</id>
<url>http://jenkins.lolnet.co.nz/plugin/repository/everything/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository> -->

<!-- Bukkit
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository> -->

<!-- ReportRTS -->
<repository>
Expand All @@ -68,26 +50,27 @@
</repository>

<!-- Vault -->
<repository>
<id>vault-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
</repository>

<!--
<repository>
<id>vault-repo</id>
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
</repository>
-->
<repository>
<id>dmulloy2-repo</id>
<url>http://repo.dmulloy2.net/content/groups/public/</url>
</repository>
-->

<repository>
<id>placeholderapi</id>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>

<repository>
<id>Scarsz-Jenkins</id>
<url>http://scarsz.tech:8080/plugin/repository/everything/</url>
</repository>
<id>dynmap</id>
<url>http://repo.mikeprimm.com/</url>
</repository>

</repositories>

Expand Down Expand Up @@ -149,6 +132,14 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.bukkit</groupId>
<artifactId>spigot-112</artifactId>
<version>1.12</version>
<type>jar</type>
<scope>provided</scope>
</dependency>

<!-- PircBotX -->
<dependency>
<groupId>com.cnaude.pircbotx</groupId>
Expand Down Expand Up @@ -215,8 +206,15 @@
<!-- Vault -->
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>Vault</artifactId>
<version>1.5.6</version>
<artifactId>VaultAPI</artifactId>
<version>1.6</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Herochat -->
Expand Down Expand Up @@ -349,7 +347,7 @@
<dependency>
<groupId>com.cnaude.deathmessagesprime</groupId>
<artifactId>DeathMessagesPrime</artifactId>
<version>1.11.11</version>
<version>1.12.13</version>
</dependency>

<!-- Shortify -->
Expand All @@ -375,9 +373,15 @@

<!-- DynmapAPI -->
<dependency>
<groupId>com.cnaude.dynmap</groupId>
<artifactId>DynmapAPI</artifactId>
<version>2.1</version>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-api</artifactId>
<version>2.5</version>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Prism -->
Expand All @@ -398,7 +402,7 @@
<dependency>
<groupId>com.cnaude.supervanish</groupId>
<artifactId>SuperVanish</artifactId>
<version>5.6.2</version>
<version>5.9.1</version>
</dependency>

<!-- SimpleTicketManager -->
Expand All @@ -419,15 +423,15 @@
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.5.1</version>
<version>2.8.0</version>
<scope>provided</scope>
</dependency>

<!-- DiscordSRV -->
<dependency>
<groupId>com.scarsz.discordsrv</groupId>
<artifactId>DiscordSRV</artifactId>
<version>12.3</version>
<version>14.8</version>
<scope>provided</scope>
</dependency>

Expand Down Expand Up @@ -477,17 +481,17 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
Expand Down
89 changes: 89 additions & 0 deletions src/main/java/com/cnaude/purpleirc/Commands/Nickserv.java
@@ -0,0 +1,89 @@
/*
* Copyright (C) 2014 cnaude
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.cnaude.purpleirc.Commands;

import com.cnaude.purpleirc.PurpleBot;
import com.cnaude.purpleirc.PurpleIRC;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

/**
*
* @author Chris Naude
*/
public class Nickserv implements IRCCommandInterface {

private final PurpleIRC plugin;
private final String usage = "([bot]) [message]";
private final String desc = "Send nickserv commands to the IRC server.";
private final String name = "nickserv";
private final String fullUsage = ChatColor.WHITE + "Usage: " + ChatColor.GOLD + "/irc " + name + " " + usage;

/**
*
* @param plugin the PurpleIRC plugin
*/
public Nickserv(PurpleIRC plugin) {
this.plugin = plugin;
}

/**
*
* @param sender
* @param args
*/
@Override
public void dispatch(CommandSender sender, String[] args) {
if (args.length >= 2) {
int msgIdx = 1;
List<PurpleBot> myBots = new ArrayList<>();
if (plugin.ircBots.containsKey(args[1])) {
myBots.add(plugin.ircBots.get(args[1]));
msgIdx = 2;
} else {
myBots.addAll(plugin.ircBots.values());
}
for (PurpleBot ircBot : myBots) {
String msg = "";
for (int i = msgIdx; i < args.length; i++) {
msg = msg + " " + args[i];
}
plugin.logDebug("Sending nickserv message to the server: " + msg.substring(1));
ircBot.asyncRawlineNow("nickserv " + msg.substring(1));
}
} else {
sender.sendMessage(fullUsage);
}
}

@Override
public String name() {
return name;
}

@Override
public String desc() {
return desc;
}

@Override
public String usage() {
return usage;
}
}
@@ -0,0 +1,53 @@
/*
* Copyright (C) 2014 cnaude
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.cnaude.purpleirc.GameListeners;

import com.cnaude.purpleirc.PurpleBot;
import com.cnaude.purpleirc.PurpleIRC;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerAdvancementDoneEvent;

/**
*
* @author Chris Naude
*/
public class GamePlayerPlayerAdvancementDoneListener implements Listener {

private final PurpleIRC plugin;

/**
*
* @param plugin the PurpleIRC plugin
*/
public GamePlayerPlayerAdvancementDoneListener(PurpleIRC plugin) {
this.plugin = plugin;
}

/**
*
* @param event
*/
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerAchievementAwardedEvent(PlayerAdvancementDoneEvent event) {
plugin.logDebug("ACHIEVEMENT: " + event.getPlayer().getName() + " => " + event.getAdvancement());
for (PurpleBot ircBot : plugin.ircBots.values()) {
ircBot.gameAdvancement(event.getPlayer(), event.getAdvancement());
}
}
}
63 changes: 63 additions & 0 deletions src/main/java/com/cnaude/purpleirc/Utilities/NetPacket_112.java
@@ -0,0 +1,63 @@
/*
* Copyright (C) 2015 cnaude
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.cnaude.purpleirc.Utilities;

import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.WrappedGameProfile;
import com.google.common.base.Charsets;
import com.mojang.authlib.GameProfile;
import java.util.UUID;
import net.minecraft.server.v1_12_R1.EntityPlayer;
import net.minecraft.server.v1_12_R1.MinecraftServer;
import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_12_R1.PlayerInteractManager;

/**
*
* @author Chris Naude
*/
public class NetPacket_112 {

public static PacketContainer add(String displayName) {
UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + displayName).getBytes(Charsets.UTF_8));
EntityPlayer pl = new EntityPlayer(
MinecraftServer.getServer(),
MinecraftServer.getServer().getWorldServer(0),
(GameProfile) (new WrappedGameProfile(uuid, displayName)).getHandle(),
new PlayerInteractManager(MinecraftServer.getServer().getWorldServer(0))
);
PacketPlayOutPlayerInfo pi
= new PacketPlayOutPlayerInfo(
PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, pl);
return PacketContainer.fromPacket(pi);
}

public static PacketContainer rem(String displayName) {
UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + displayName).getBytes(Charsets.UTF_8));
EntityPlayer pl = new EntityPlayer(
MinecraftServer.getServer(),
MinecraftServer.getServer().getWorldServer(0),
(GameProfile) (new WrappedGameProfile(uuid, displayName)).getHandle(),
new PlayerInteractManager(MinecraftServer.getServer().getWorldServer(0))
);
PacketPlayOutPlayerInfo pi
= new PacketPlayOutPlayerInfo(
PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, pl);
return PacketContainer.fromPacket(pi);
}

}

0 comments on commit 60fd520

Please sign in to comment.