Skip to content
This repository was archived by the owner on Nov 11, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added FactionChannel.jar
Binary file not shown.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# FactionChannel
This is a 1.8 fork to FactionChannel originally written by fieldmaster. The plugin adds support for Factions within ChannelChat, creating a factions channel.

The .jar is included for your convenience. It is built under Bukkit 1.8-R0.1-SNAPSHOT.
2 changes: 1 addition & 1 deletion .gitignore → faction/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
*.iml
*.ipr
*.iws
.idea/
.idea/
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was merely done so the github engine would recognize the change in the .gitignore file. I'd converted it to ANSI formatting to be compatable with the git engine.

Binary file added faction/lib/ChannelChat.jar
Binary file not shown.
Binary file added faction/lib/Factions.jar
Binary file not shown.
Binary file added faction/lib/MassiveCore.jar
Binary file not shown.
24 changes: 16 additions & 8 deletions pom.xml → faction/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,47 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.feildmaster.module.faction</groupId>
<artifactId>FactionChannel</artifactId>
<version>1.2</version>
<version>2.0</version>
<name>FactionChannel</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url>
</repository>
<repository>
<id>fm-repo</id>
<url>http://repo.feildmaster.com/</url>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your repo resulted in a 404 and fieldmaster.com has been replaced by a page to create ball fields.

<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.1-R3</version>
<version>1.8-R0.1-SNAPSHOT</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.feildmaster.channelchat</groupId>
<artifactId>ChannelChat</artifactId>
<version>0.6-beta</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${project.basedir}/lib/ChannelChat.jar</systemPath>
</dependency>
<dependency>
<groupId>com.massivecraft.factions</groupId>
<artifactId>Factions</artifactId>
<version>1.6.1</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Factions.jar</systemPath>
</dependency>
<dependency>
<groupId>com.massivecraft.massivecore</groupId>
<artifactId>MassiveCore</artifactId>
<version>LATEST</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${project.basedir}/lib/MassiveCore.jar</systemPath>
</dependency>
</dependencies>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,61 @@

import com.feildmaster.channelchat.Chat;
import com.feildmaster.channelchat.channel.CustomChannel;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.Faction;
import java.util.HashSet;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These three were removed for being outdated.

import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused


public class FactionChannel extends CustomChannel {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PlayerChatEvent is depricated

private Faction faction = null;
private MPlayer mplayer;

protected FactionChannel(String name) {
protected FactionChannel(String name)
{
super(name);
}

private void setFaction(Player player) {
if(player == null) {
faction = null;
private void setFaction(Player player)
{
player = player.getPlayer(); //get Bukkit player entity
mplayer = MPlayer.get(player); //Set Massive player to Bukkit player
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relocated declarations to top


if(player == null) //Did a player execute the command?
{
faction = null; //No player, no faction
return;
}
FPlayer p = FPlayers.i.get(player);

if(!p.hasFaction()) {
faction = null;

if(!mplayer.hasFaction()) //Did a massiveplayer execute the command?
{
//This method seems a bit redundant seeing as mplayer is player.
//If player is no, mplayer will be no.
//But, perhaps there's a purpose for this. Leaving in.
faction = null;
return;
}

faction = p.getFaction();
faction = mplayer.getFaction(); //Everything checks out
}

public Set<String> getMembers(Player player) {
public Set<String> getMembers(Player player)
{
Set<String> members = super.getMembers(player);
setFaction(player);

for(String p : new HashSet<String>(members))
if(faction != null) {
FPlayer fp = FPlayers.i.get(Bukkit.getPlayer(p));
if(faction != null)
{
MPlayer fp = MPlayer.get(player);
if(!fp.hasFaction() || !fp.getFaction().equals(faction))
members.remove(p);
} else
}
else
{
members.remove(p);
}

setFaction(null);
return members;
Expand Down Expand Up @@ -71,11 +84,11 @@ public void sendLeaveMessage(Player player) {

public Boolean isMember(Player player) {
if(faction == null) return super.isMember(player);
FPlayer fplayer = FPlayers.i.get(player);
return super.isMember(player) && fplayer.hasFaction() && fplayer.getFaction().equals(faction);
MPlayer mplayer = MPlayer.get(player);
return super.isMember(player) && mplayer.hasFaction() && mplayer.getFaction().equals(faction);
}

public void handleEvent(PlayerChatEvent event) {
public void handleEvent(AsyncPlayerChatEvent event) {
setFaction(event.getPlayer());
if(faction == null) {
event.getPlayer().sendMessage(Chat.info("You do not have a faction."));
Expand All @@ -85,4 +98,4 @@ public void handleEvent(PlayerChatEvent event) {
super.handleEvent(event);
setFaction(null);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: ${name}
name: FactionChannel
main: com.feildmaster.module.faction.Faction
version: ${version}
author: feildmaster
version: 2.0
author: feildmaster, Foxtrek_64
depend: [ChannelChat, Factions]