-
Notifications
You must be signed in to change notification settings - Fork 1
Updated to 1.8 #1
base: master
Are you sure you want to change the base?
Changes from all commits
289b384
b2a7072
db9bdc0
ab7632a
cd5fef2
6feb234
7e9f3be
e63f5d3
c29f1ca
16b5102
cdbf618
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,4 @@ | |
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
.idea/ | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused |
||
|
||
public class FactionChannel extends CustomChannel { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
@@ -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.")); | ||
|
@@ -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] |
There was a problem hiding this comment.
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.