forked from magnusulf/MassiveCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creating start of a compatibility layer with FactionsV1/FactionsUUID.
- Loading branch information
1 parent
9c58035
commit 42982b5
Showing
10 changed files
with
1,823 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.massivecraft.factions; | ||
|
||
import com.massivecraft.factions.entity.BoardColl; | ||
import com.massivecraft.massivecore.ps.PS; | ||
|
||
/** | ||
* This class attempts to provide minimal compatibility with Factions V1/FactionsUUID | ||
* by providing wrapper classes/methods that convert to the V2/V3 class structure. | ||
* | ||
* <p><strong>DO NOT USE THIS FOR NEW IMPLEMENTATIONS.</strong></p> | ||
* | ||
* @deprecated | ||
*/ | ||
@Deprecated | ||
public class Board | ||
{ | ||
|
||
// -------------------------------------------- // | ||
// INSTANCE & CONSTRUCT | ||
// -------------------------------------------- // | ||
|
||
private static Board instance; | ||
public static Board getInstance() | ||
{ | ||
if (instance == null) { | ||
instance = new Board(); | ||
} | ||
return instance; | ||
} | ||
// Private constructor to prevent instantiation | ||
private Board() {} | ||
|
||
// -------------------------------------------- // | ||
// METHODS | ||
// -------------------------------------------- // | ||
|
||
public Faction getFactionAt(FLocation location) | ||
{ | ||
com.massivecraft.factions.entity.Board realBoard = BoardColl.get().get(location.getLocation().getWorld()); | ||
com.massivecraft.factions.entity.Faction faction = realBoard.getFactionAt(PS.valueOf(location.getLocation()).getChunkCoords(true)); | ||
|
||
return new LegacyFaction(faction); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.massivecraft.factions; | ||
|
||
import org.bukkit.Location; | ||
|
||
/** | ||
* This class attempts to provide minimal compatibility with Factions V1/FactionsUUID | ||
* by providing wrapper classes/methods that convert to the V2/V3 class structure. | ||
* | ||
* <p><strong>DO NOT USE THIS FOR NEW IMPLEMENTATIONS.</strong></p> | ||
* | ||
* @deprecated | ||
*/ | ||
@Deprecated | ||
public class FLocation | ||
{ | ||
|
||
private Location location; | ||
|
||
public FLocation(Location location) | ||
{ | ||
this.location = location; | ||
} | ||
|
||
public Location getLocation() | ||
{ | ||
return this.location; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
package com.massivecraft.factions; | ||
|
||
import java.util.List; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
|
||
/** | ||
* This class attempts to provide minimal compatibility with Factions V1/FactionsUUID | ||
* by providing wrapper classes/methods that convert to the V2/V3 class structure. | ||
* | ||
* <p><strong>DO NOT USE THIS FOR NEW IMPLEMENTATIONS.</strong></p> | ||
* | ||
* @deprecated | ||
*/ | ||
@Deprecated | ||
public interface FPlayer | ||
{ | ||
|
||
public Faction getFaction(); | ||
|
||
boolean hasFaction(); | ||
|
||
void setFaction(Faction faction); | ||
|
||
public boolean shouldTakeFallDamage(); | ||
|
||
// public void setTakeFallDamage(boolean fallDamage); | ||
|
||
double getPowerBoost(); | ||
|
||
void setPowerBoost(double powerBoost); | ||
|
||
Faction getAutoClaimFor(); | ||
|
||
void setAutoClaimFor(Faction faction); | ||
|
||
Faction getAutoUnclaimFor(); | ||
|
||
void setAutoUnclaimFor(Faction faction); | ||
|
||
boolean isAdminBypassing(); | ||
|
||
boolean isVanished(); | ||
|
||
void setIsAdminBypassing(boolean val); | ||
|
||
void resetFactionData(boolean doSpoutUpdate); | ||
|
||
void resetFactionData(); | ||
|
||
long getLastLoginTime(); | ||
|
||
boolean isMapAutoUpdating(); | ||
|
||
void setMapAutoUpdating(boolean mapAutoUpdating); | ||
|
||
String getTitle(); | ||
|
||
void setTitle(CommandSender sender, String title); | ||
|
||
String getName(); | ||
|
||
String getTag(); | ||
|
||
// Base concatenations: | ||
|
||
String getNameAndSomething(String something); | ||
|
||
String getNameAndTitle(); | ||
|
||
String getNameAndTag(); | ||
|
||
// Colored concatenations: | ||
// These are used in information messages | ||
|
||
String getNameAndTitle(Faction faction); | ||
|
||
String getNameAndTitle(FPlayer fplayer); | ||
|
||
//----------------------------------------------// | ||
// Health | ||
//----------------------------------------------// | ||
void heal(int amnt); | ||
|
||
|
||
//----------------------------------------------// | ||
// Power | ||
//----------------------------------------------// | ||
double getPower(); | ||
|
||
void alterPower(double delta); | ||
|
||
double getPowerMax(); | ||
|
||
double getPowerMin(); | ||
|
||
int getPowerRounded(); | ||
|
||
int getPowerMaxRounded(); | ||
|
||
int getPowerMinRounded(); | ||
|
||
void updatePower(); | ||
|
||
void losePowerFromBeingOffline(); | ||
|
||
//----------------------------------------------// | ||
// Territory | ||
//----------------------------------------------// | ||
boolean isInOwnTerritory(); | ||
|
||
boolean isInOthersTerritory(); | ||
|
||
boolean isInAllyTerritory(); | ||
|
||
boolean isInNeutralTerritory(); | ||
|
||
boolean isInEnemyTerritory(); | ||
|
||
void sendFactionHereMessage(Faction from); | ||
|
||
// ------------------------------- | ||
// Actions | ||
// ------------------------------- | ||
|
||
void leave(boolean makePay); | ||
|
||
boolean canClaimForFaction(Faction forFaction); | ||
|
||
@Deprecated | ||
boolean canClaimForFactionAtLocation(Faction forFaction, Location location, boolean notifyFailure); | ||
|
||
boolean canClaimForFactionAtLocation(Faction forFaction, FLocation location, boolean notifyFailure); | ||
|
||
boolean attemptClaim(Faction forFaction, Location location, boolean notifyFailure); | ||
|
||
boolean attemptClaim(Faction forFaction, FLocation location, boolean notifyFailure); | ||
|
||
boolean attemptUnclaim(Faction forFaction, FLocation flocation, boolean notifyFailure); | ||
|
||
String getId(); | ||
|
||
Player getPlayer(); | ||
|
||
boolean isOnline(); | ||
|
||
void sendMessage(String message); | ||
|
||
void sendMessage(List<String> messages); | ||
|
||
boolean isOnlineAndVisibleTo(Player me); | ||
|
||
boolean isOffline(); | ||
|
||
void flightCheck(); | ||
|
||
boolean isFlying(); | ||
|
||
void setFlying(boolean fly); | ||
|
||
void setFlying(boolean fly, boolean damage); | ||
|
||
boolean canFlyAtLocation(); | ||
|
||
boolean canFlyAtLocation(FLocation location); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.massivecraft.factions; | ||
|
||
import org.bukkit.OfflinePlayer; | ||
|
||
/** | ||
* This class attempts to provide minimal compatibility with Factions V1/FactionsUUID | ||
* by providing wrapper classes/methods that convert to the V2/V3 class structure. | ||
* | ||
* <p><strong>DO NOT USE THIS FOR NEW IMPLEMENTATIONS.</strong></p> | ||
* | ||
* @deprecated | ||
*/ | ||
@Deprecated | ||
public class FPlayers | ||
{ | ||
// -------------------------------------------- // | ||
// INSTANCE & CONSTRUCT | ||
// -------------------------------------------- // | ||
|
||
private static FPlayers instance; | ||
public static FPlayers getInstance() | ||
{ | ||
if (instance == null) { | ||
instance = new FPlayers(); | ||
} | ||
return instance; | ||
} | ||
// Private constructor to prevent instantiation | ||
private FPlayers() {} | ||
|
||
// -------------------------------------------- // | ||
// METHODS | ||
// -------------------------------------------- // | ||
|
||
public FPlayer getByOfflinePlayer(OfflinePlayer player) | ||
{ | ||
return new LegacyFPlayer(player); | ||
} | ||
|
||
} |
Oops, something went wrong.