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

Commit

Permalink
Add compatibility checker.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnaude committed Jun 28, 2015
1 parent 9a791a3 commit 405a724
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/cnaude/purpleirc/PurpleIRC.java
Expand Up @@ -54,6 +54,7 @@
import com.cnaude.purpleirc.Utilities.CaseInsensitiveMap;
import com.cnaude.purpleirc.Utilities.ChatTokenizer;
import com.cnaude.purpleirc.Utilities.ColorConverter;
import com.cnaude.purpleirc.Utilities.CompatChecker;
import com.cnaude.purpleirc.Utilities.NetPackets;
import com.cnaude.purpleirc.Utilities.Query;
import com.cnaude.purpleirc.Utilities.RegexGlobber;
Expand Down Expand Up @@ -251,8 +252,7 @@ public PurpleIRC() {
public void onEnable() {
LOG_HEADER = "[" + this.getName() + "]";
LOG_HEADER_F = ChatColor.LIGHT_PURPLE + "[" + this.getName() + "]" + ChatColor.RESET;
if (getServer().getVersion().contains("Spigot") && getServer().getVersion().contains("MC: 1.8")) {
logError("This plugin is not compatible with Spigot 1.8. Please download the Spigot version from the Spigot site.");
if (!CompatChecker.isCompatible(this)) {
this.getPluginLoader().disablePlugin(this);
return;
}
Expand Down
33 changes: 33 additions & 0 deletions src/main/java/com/cnaude/purpleirc/Utilities/CompatChecker.java
@@ -0,0 +1,33 @@
/*
* 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.cnaude.purpleirc.PurpleIRC;

/**
*
* @author cnaude
*/
public class CompatChecker {
public static boolean isCompatible(PurpleIRC plugin) {
if (plugin.getServer().getVersion().contains("Spigot") && plugin.getServer().getVersion().contains("MC: 1.8")) {
plugin.logError("This plugin is not compatible with Spigot 1.8. Please download the Spigot version from the Spigot site.");
return false;
}
return true;
}
}
4 changes: 2 additions & 2 deletions src/main/resources/plugin.yml
@@ -1,8 +1,8 @@
name: ${project.name}
name: ${project.artifactId}
version: ${project.version}
description: ${project.description}
author: cnaude
website: http://dev.bukkit.org/server-mods/purpleirc/
website: ${project.url}
main: com.cnaude.purpleirc.PurpleIRC
softdepend:
- Vault
Expand Down

0 comments on commit 405a724

Please sign in to comment.